diff --git a/lib/router/router.authenticated.dart b/lib/router/router.authenticated.dart index 2aea945fe..d61d34bd8 100644 --- a/lib/router/router.authenticated.dart +++ b/lib/router/router.authenticated.dart @@ -335,10 +335,7 @@ final _authenticatedRoutes = [ transitionDuration: Duration.zero, reverseTransitionDuration: Duration.zero, key: state.pageKey, - child: NFTCreationProcessImportTabAEWebForm( - onConfirm: (state.extra! as Map)['onConfirm']! as void - Function(String uri), - ), + child: const NFTCreationProcessImportTabAEWebForm(), transitionsBuilder: (context, animation, secondaryAnimation, child) => FadeTransition( opacity: animation, @@ -352,10 +349,7 @@ final _authenticatedRoutes = [ transitionDuration: Duration.zero, reverseTransitionDuration: Duration.zero, key: state.pageKey, - child: NFTCreationProcessImportTabHTTPForm( - onConfirm: (state.extra! as Map)['onConfirm']! as void - Function(String uri), - ), + child: const NFTCreationProcessImportTabHTTPForm(), transitionsBuilder: (context, animation, secondaryAnimation, child) => FadeTransition( opacity: animation, @@ -369,10 +363,7 @@ final _authenticatedRoutes = [ transitionDuration: Duration.zero, reverseTransitionDuration: Duration.zero, key: state.pageKey, - child: NFTCreationProcessImportTabIPFSForm( - onConfirm: (state.extra! as Map)['onConfirm']! as void - Function(String uri), - ), + child: const NFTCreationProcessImportTabIPFSForm(), transitionsBuilder: (context, animation, secondaryAnimation, child) => FadeTransition( opacity: animation, diff --git a/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_aeweb.dart b/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_aeweb.dart index 88991f41f..7902e2234 100644 --- a/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_aeweb.dart +++ b/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_aeweb.dart @@ -8,22 +8,10 @@ class NFTCreationProcessImportTabAEWeb extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final localizations = AppLocalizations.of(context)!; - final nftCreationNotifier = ref.watch( - NftCreationFormProvider.nftCreationForm.notifier, - ); - return InkWell( onTap: () async { await context.push( NFTCreationProcessImportTabAEWebForm.routerPage, - extra: { - 'onConfirm': (uri) { - nftCreationNotifier.setContentAEWebProperties( - context, - uri, - ); - }, - }, ); }, child: SizedBox( diff --git a/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_aeweb_form.dart b/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_aeweb_form.dart index 7212b3102..861d39dcd 100644 --- a/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_aeweb_form.dart +++ b/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_aeweb_form.dart @@ -2,6 +2,7 @@ import 'package:aewallet/ui/themes/archethic_theme.dart'; import 'package:aewallet/ui/util/ui_util.dart'; +import 'package:aewallet/ui/views/nft_creation/bloc/provider.dart'; import 'package:aewallet/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_template_form.dart'; import 'package:aewallet/util/url_util.dart'; import 'package:flutter/material.dart'; @@ -12,11 +13,8 @@ import 'package:go_router/go_router.dart'; class NFTCreationProcessImportTabAEWebForm extends ConsumerWidget with UrlUtil { const NFTCreationProcessImportTabAEWebForm({ super.key, - required this.onConfirm, }); - final void Function(String uri) onConfirm; - static const routerPage = '/nft_creation_process_import_tab_aeweb'; @override @@ -52,9 +50,17 @@ class NFTCreationProcessImportTabAEWebForm extends ConsumerWidget with UrlUtil { setError(localizations.nftAEWebUrlNotValid); return; } - onConfirm( + + final nftCreationNotifier = ref.read( + NftCreationFormProvider.nftCreationForm.notifier, + ); + + // ignore: cascade_invocations + nftCreationNotifier.setContentAEWebProperties( + context, valueCleaned, ); + contextForm.pop(); }, ); diff --git a/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_http.dart b/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_http.dart index f13caf121..004d8d9b2 100644 --- a/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_http.dart +++ b/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_http.dart @@ -8,22 +8,10 @@ class NFTCreationProcessImportTabHTTP extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final localizations = AppLocalizations.of(context)!; - final nftCreationNotifier = ref.watch( - NftCreationFormProvider.nftCreationForm.notifier, - ); - return InkWell( onTap: () async { await context.push( NFTCreationProcessImportTabHTTPForm.routerPage, - extra: { - 'onConfirm': (uri) { - nftCreationNotifier.setContentHTTPProperties( - context, - uri, - ); - }, - }, ); }, child: SizedBox( diff --git a/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_http_form.dart b/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_http_form.dart index 17a42695e..090520ab8 100644 --- a/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_http_form.dart +++ b/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_http_form.dart @@ -2,6 +2,7 @@ import 'package:aewallet/ui/themes/archethic_theme.dart'; import 'package:aewallet/ui/util/ui_util.dart'; +import 'package:aewallet/ui/views/nft_creation/bloc/provider.dart'; import 'package:aewallet/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_template_form.dart'; import 'package:aewallet/util/url_util.dart'; import 'package:flutter/material.dart'; @@ -12,11 +13,8 @@ import 'package:go_router/go_router.dart'; class NFTCreationProcessImportTabHTTPForm extends ConsumerWidget with UrlUtil { const NFTCreationProcessImportTabHTTPForm({ super.key, - required this.onConfirm, }); - final void Function(String uri) onConfirm; - static const routerPage = '/nft_creation_process_import_tab_http'; @override @@ -51,9 +49,16 @@ class NFTCreationProcessImportTabHTTPForm extends ConsumerWidget with UrlUtil { return; } - onConfirm( + final nftCreationNotifier = ref.read( + NftCreationFormProvider.nftCreationForm.notifier, + ); + + // ignore: cascade_invocations + nftCreationNotifier.setContentHTTPProperties( + context, value.replaceAll(' ', ''), ); + contextForm.pop(); }, ); diff --git a/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_ipfs.dart b/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_ipfs.dart index 6b395242a..b4663cbc5 100644 --- a/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_ipfs.dart +++ b/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_ipfs.dart @@ -8,22 +8,10 @@ class NFTCreationProcessImportTabIPFS extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final localizations = AppLocalizations.of(context)!; - final nftCreationNotifier = ref.watch( - NftCreationFormProvider.nftCreationForm.notifier, - ); - return InkWell( onTap: () async { await context.push( NFTCreationProcessImportTabIPFSForm.routerPage, - extra: { - 'onConfirm': (uri) { - nftCreationNotifier.setContentIPFSProperties( - context, - uri, - ); - }, - }, ); }, child: SizedBox( diff --git a/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_ipfs_form.dart b/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_ipfs_form.dart index a1bc68489..0148bcd55 100644 --- a/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_ipfs_form.dart +++ b/lib/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_ipfs_form.dart @@ -2,6 +2,7 @@ import 'package:aewallet/ui/themes/archethic_theme.dart'; import 'package:aewallet/ui/util/ui_util.dart'; +import 'package:aewallet/ui/views/nft_creation/bloc/provider.dart'; import 'package:aewallet/ui/views/nft_creation/layouts/components/import_tab/nft_creation_process_import_tab_template_form.dart'; import 'package:aewallet/util/url_util.dart'; import 'package:flutter/material.dart'; @@ -12,11 +13,8 @@ import 'package:go_router/go_router.dart'; class NFTCreationProcessImportTabIPFSForm extends ConsumerWidget with UrlUtil { const NFTCreationProcessImportTabIPFSForm({ super.key, - required this.onConfirm, }); - final void Function(String uri) onConfirm; - static const routerPage = '/nft_creation_process_import_tab_ipfs'; @override @@ -47,9 +45,17 @@ class NFTCreationProcessImportTabIPFSForm extends ConsumerWidget with UrlUtil { setError(localizations.nftIPFSUrlNotValid); return; } - onConfirm( + + final nftCreationNotifier = ref.read( + NftCreationFormProvider.nftCreationForm.notifier, + ); + + // ignore: cascade_invocations + nftCreationNotifier.setContentIPFSProperties( + context, value.replaceAll(' ', ''), ); + contextForm.pop(); }, );