Skip to content

Commit

Permalink
fix: 🐛 Fix routing + add skeleton widget implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
redDwarf03 committed Jul 11, 2024
1 parent 4e22082 commit 39bcb8f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 60 deletions.
15 changes: 3 additions & 12 deletions lib/router/router.authenticated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,7 @@ final _authenticatedRoutes = [
transitionDuration: Duration.zero,
reverseTransitionDuration: Duration.zero,
key: state.pageKey,
child: NFTCreationProcessImportTabAEWebForm(
onConfirm: (state.extra! as Map<String, dynamic>)['onConfirm']! as void
Function(String uri),
),
child: const NFTCreationProcessImportTabAEWebForm(),
transitionsBuilder: (context, animation, secondaryAnimation, child) =>
FadeTransition(
opacity: animation,
Expand All @@ -352,10 +349,7 @@ final _authenticatedRoutes = [
transitionDuration: Duration.zero,
reverseTransitionDuration: Duration.zero,
key: state.pageKey,
child: NFTCreationProcessImportTabHTTPForm(
onConfirm: (state.extra! as Map<String, dynamic>)['onConfirm']! as void
Function(String uri),
),
child: const NFTCreationProcessImportTabHTTPForm(),
transitionsBuilder: (context, animation, secondaryAnimation, child) =>
FadeTransition(
opacity: animation,
Expand All @@ -369,10 +363,7 @@ final _authenticatedRoutes = [
transitionDuration: Duration.zero,
reverseTransitionDuration: Duration.zero,
key: state.pageKey,
child: NFTCreationProcessImportTabIPFSForm(
onConfirm: (state.extra! as Map<String, dynamic>)['onConfirm']! as void
Function(String uri),
),
child: const NFTCreationProcessImportTabIPFSForm(),
transitionsBuilder: (context, animation, secondaryAnimation, child) =>
FadeTransition(
opacity: animation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand Down Expand Up @@ -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();
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand Down Expand Up @@ -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();
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand Down Expand Up @@ -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();
},
);
Expand Down

0 comments on commit 39bcb8f

Please sign in to comment.