Browse Source

Merge pull request #46 from jld3103/feature/news-add-feed-paste-clipboard

neon: Paste from clipboard when adding news feed if it contains a URL
pull/48/head
jld3103 2 years ago committed by GitHub
parent
commit
e34424b0b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      packages/neon/lib/src/apps/news/dialogs/add_feed.dart

14
packages/neon/lib/src/apps/news/dialogs/add_feed.dart

@ -26,6 +26,20 @@ class _NewsAddFeedDialogState extends State<NewsAddFeedDialog> {
} }
} }
@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 @override
Widget build(final BuildContext context) => StandardRxResultBuilder<NewsBloc, List<NewsFolder>>( Widget build(final BuildContext context) => StandardRxResultBuilder<NewsBloc, List<NewsFolder>>(
bloc: widget.bloc, bloc: widget.bloc,

Loading…
Cancel
Save