From 7d730b2433d5d19e336a44e70e1747611b58724e Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sun, 31 Jul 2022 08:10:35 +0200 Subject: [PATCH] neon: Paste from clipboard when adding news feed if it contains a URL --- .../neon/lib/src/apps/news/dialogs/add_feed.dart | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/neon/lib/src/apps/news/dialogs/add_feed.dart b/packages/neon/lib/src/apps/news/dialogs/add_feed.dart index abb945f1..a7e06285 100644 --- a/packages/neon/lib/src/apps/news/dialogs/add_feed.dart +++ b/packages/neon/lib/src/apps/news/dialogs/add_feed.dart @@ -26,6 +26,20 @@ class _NewsAddFeedDialogState extends State { } } + @override + void initState() { + super.initState(); + + Clipboard.getData(Clipboard.kTextPlain).then((final clipboardContent) { + if (clipboardContent != null && clipboardContent.text != null) { + final uri = Uri.tryParse(clipboardContent.text!); + if (uri != null && (uri.scheme == 'http' || uri.scheme == 'https')) { + controller.text = clipboardContent.text!; + } + } + }); + } + @override Widget build(final BuildContext context) => StandardRxResultBuilder>( bloc: widget.bloc,