From 984260b3df2991225b4c4ce2c5c9d5aee8cc3056 Mon Sep 17 00:00:00 2001 From: X Code Date: Sat, 22 Jan 2022 04:36:35 -0800 Subject: [PATCH] Remove SnackBar 'What is entered is not a link' --- lib/src/widgets/toolbar/link_style_button.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/widgets/toolbar/link_style_button.dart b/lib/src/widgets/toolbar/link_style_button.dart index fab08bba..6f54a314 100644 --- a/lib/src/widgets/toolbar/link_style_button.dart +++ b/lib/src/widgets/toolbar/link_style_button.dart @@ -101,10 +101,11 @@ class _LinkStyleButtonState extends State { context: context, builder: (ctx) { final link = _getLinkAttributeValue(); + final index = widget.controller.selection.baseOffset; + if (link != null) { // TODO: text should be the link's corresponding text, not selection } - final index = widget.controller.selection.baseOffset; final text = widget.controller.document .toPlainText() .substring(index, widget.controller.selection.extentOffset); @@ -206,10 +207,9 @@ class _LinkDialogState extends State<_LinkDialog> { } if (!AutoFormatMultipleLinksRule.linkRegExp.hasMatch(_link)) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('What is entered is not a link'.i18n))); return false; } + return true; }