put regex to private variable

This commit is contained in:
Filip Krawczyk 2022-07-04 17:18:38 +02:00
parent 7db538084a
commit cab4aeebb7
1 changed files with 4 additions and 2 deletions

View File

@ -151,9 +151,11 @@ class AddLinkDialog extends HookWidget {
final String url;
final String selection;
static final _websiteRegex = RegExp(r'https?:\/\/', caseSensitive: false);
AddLinkDialog(this.selection)
: title = selection.startsWith('https?://') ? '' : selection,
url = selection.startsWith('https?://') ? selection : '';
: title = selection.startsWith(_websiteRegex) ? '' : selection,
url = selection.startsWith(_websiteRegex) ? selection : '';
@override
Widget build(BuildContext context) {