From 9c5081bc07a054a11c4711024bc58be7e791f3c5 Mon Sep 17 00:00:00 2001 From: appflowy Date: Tue, 31 May 2022 21:53:04 +0800 Subject: [PATCH] chore: enable the richtext widget as large as parent --- .../src/widgets/cell/url_cell/url_cell.dart | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/url_cell/url_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/url_cell/url_cell.dart index 91624c9dd1..9570d1219f 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/url_cell/url_cell.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/url_cell/url_cell.dart @@ -71,11 +71,18 @@ class _GridURLCellState extends State { fontSize: 14, decoration: TextDecoration.underline, ), - recognizer: _tapGesture(context), ), ); - return Align(alignment: Alignment.centerLeft, child: richText); + return SizedBox.expand( + child: GestureDetector( + child: Align(alignment: Alignment.centerLeft, child: richText), + onTap: () async { + widget.onFocus.value = true; + final url = context.read().state.url; + await _openUrlOrEdit(url); + }, + )); }, ), ); @@ -94,15 +101,6 @@ class _GridURLCellState extends State { super.didUpdateWidget(oldWidget); } - TapGestureRecognizer _tapGesture(BuildContext context) { - final gesture = TapGestureRecognizer(); - gesture.onTap = () async { - final url = context.read().state.url; - await _openUrlOrEdit(url); - }; - return gesture; - } - Future _openUrlOrEdit(String url) async { final uri = Uri.parse(url); if (url.isNotEmpty && await canLaunchUrl(uri)) {