Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #1455 - make tappable header no selectable #1874

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,17 @@ class _TableCellWidgetState extends State<TableCellWidget> {
if (widget.cell.color != null) {
style = style.apply(color: widget.cell.color);
}
if (!widget.cell.isHeader || widget.cell.columnGroup!.columns.length == 1) {
return _buildHtmlCell(padding, style);
if (widget.cell.isHeader && widget.cell.columnGroup!.columns.length == 1) {
return _buildHtmlCell(padding, style, false);
} else if (!widget.cell.isHeader ||
widget.cell.columnGroup!.columns.length == 1) {
return _buildHtmlCell(padding, style, true);
}
return _buildDropDownColumnHeader(padding, style);
}

Widget _buildHtmlCell(EdgeInsets padding, TextStyle style) {
Widget _buildHtmlCell(
EdgeInsets padding, TextStyle style, bool isSelectable) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Suggested change
Widget _buildHtmlCell(
EdgeInsets padding, TextStyle style, bool isSelectable) {
Widget _buildHtmlCell(
EdgeInsets padding, TextStyle style, { required bool isSelectable}) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String cellText = widget.cell.text;
if (!_isExpanded) {
const String htmlStyle = '''
Expand All @@ -301,6 +305,7 @@ class _TableCellWidgetState extends State<TableCellWidget> {
child: SmoothHtmlWidget(
cellText,
textStyle: style,
isSelectable: isSelectable,
),
),
),
Expand Down
7 changes: 5 additions & 2 deletions packages/smooth_app/lib/generic_lib/smooth_html_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import 'package:fwfh_selectable_text/fwfh_selectable_text.dart';
import 'package:smooth_app/helpers/launch_url_helper.dart';

class SmoothHtmlWidget extends StatelessWidget {
const SmoothHtmlWidget(this.htmlString, {this.textStyle});
const SmoothHtmlWidget(this.htmlString,
{this.textStyle, this.isSelectable = true});

final String htmlString;
final TextStyle? textStyle;
final bool isSelectable;

@override
Widget build(BuildContext context) {
Expand All @@ -18,7 +20,8 @@ class SmoothHtmlWidget extends StatelessWidget {
await LaunchUrlHelper.launchURL(url, false);
return true;
},
factoryBuilder: () => SelectableHtmlWidgetFactory(),
factoryBuilder: () =>
isSelectable ? SelectableHtmlWidgetFactory() : WidgetFactory(),
enableCaching: false,
);
}
Expand Down