diff --git a/apps/mobile_app/lib/app_router_config.dart b/apps/mobile_app/lib/app_router_config.dart deleted file mode 100644 index d9f58b30..00000000 --- a/apps/mobile_app/lib/app_router_config.dart +++ /dev/null @@ -1,52 +0,0 @@ -import 'package:auth/auth.dart'; -import 'package:dashboard_shell/dashboard_builder.dart'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; - -import 'package:navigation/navigation.dart'; -import 'package:get_it/get_it.dart'; - -final GlobalKey navigatorKey = GlobalKey(); - -late GoRouter appRouter; - -void configureAppRouter() { - appRouter = GoRouter( - navigatorKey: navigatorKey, - initialLocation: '/login', - routes: [ - GoRoute( - path: '/onboarding', - pageBuilder: (context, state) => - OnboardingBuilder().buildPage(context, state), - ), - GoRoute( - path: '/link_phone', - pageBuilder: (context, state) => - LinkPhoneBuilder().buildPage(context, state), - ), - GoRoute( - path: '/phone_code', - pageBuilder: (context, state) => - PhoneCodeBuilder().buildPage(context, state), - ), - GoRoute( - path: '/login', - pageBuilder: (context, state) => - LoginBuilder().buildPage(context, state), - ), - GoRoute( - path: '/recover_password', - pageBuilder: (context, state) => - RecoverPasswordBuilder().buildPage(context, state), - ), - GoRoute( - path: '/dashboard_shell', - pageBuilder: (context, state) => - DashboardBuilder().buildPage(context, state), - ), - ], - ); - - GetIt.I().setRouter(appRouter); -} diff --git a/apps/mobile_app/lib/main.dart b/apps/mobile_app/lib/main.dart index edda0d51..37384b82 100644 --- a/apps/mobile_app/lib/main.dart +++ b/apps/mobile_app/lib/main.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:design_system/design_system.dart'; -import 'package:sf_app_platform/app_router_config.dart'; +import 'package:sf_app_platform/navigation/app_router.dart'; import 'package:navigation/navigation_module.dart'; Future main() async { diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart new file mode 100644 index 00000000..020f8866 --- /dev/null +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -0,0 +1,94 @@ +import 'package:auth/auth.dart'; +import 'package:dashboard_shell/dashboard_builder.dart'; +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:home/home.dart'; + +import 'package:navigation/navigation.dart'; +import 'package:get_it/get_it.dart'; +import 'package:notifications/notifications.dart'; +import 'package:profile/profile.dart'; + +final GlobalKey rootNavigatorKey = GlobalKey(); + +late final GoRouter appRouter; + +void configureAppRouter() { + appRouter = GoRouter( + navigatorKey: rootNavigatorKey, + initialLocation: '/login', + // redirect: (context, state) {}, + routes: [ + GoRoute( + path: '/login', + name: 'login', + pageBuilder: LoginBuilder().buildPage, + ), + GoRoute( + path: '/onboarding', + name: 'onboarding', + pageBuilder: OnboardingBuilder().buildPage, + ), + GoRoute( + path: '/link_phone', + name: 'link_phone', + pageBuilder: LinkPhoneBuilder().buildPage, + ), + GoRoute( + path: '/phone_code', + name: 'phone_code', + pageBuilder: PhoneCodeBuilder().buildPage, + ), + GoRoute( + path: '/recover_password', + name: 'recover_password', + pageBuilder: RecoverPasswordBuilder().buildPage, + ), + StatefulShellRoute.indexedStack( + builder: (context, state, navShell) { + return DashboardBuilder().build(context, navShell); + }, + branches: [ + StatefulShellBranch( + routes: [ + GoRoute( + path: '/main/home', + name: 'home', + pageBuilder: const HomeBuilder().buildPage, + ), + ], + ), + StatefulShellBranch( + routes: [ + GoRoute( + path: '/main/activity', + name: 'activity', + pageBuilder: const ActivityBuilder().buildPage, + ), + ], + ), + StatefulShellBranch( + routes: [ + GoRoute( + path: '/main/notifications', + name: 'notifications', + pageBuilder: const NotificationsBuilder().buildPage, + ), + ], + ), + StatefulShellBranch( + routes: [ + GoRoute( + path: '/main/profile', + name: 'profile', + pageBuilder: const ProfileBuilder().buildPage, + ), + ], + ), + ], + ), + ], + ); + + GetIt.I().setRouter(appRouter); +} diff --git a/apps/mobile_app/lib/navigation/app_routes.dart b/apps/mobile_app/lib/navigation/app_routes.dart new file mode 100644 index 00000000..eab5071f --- /dev/null +++ b/apps/mobile_app/lib/navigation/app_routes.dart @@ -0,0 +1,11 @@ +enum AppRoutes { + onboarding, + linkPhone, + phoneCode, + login, + recoverPassword, + home, + activity, + notifications, + profile, +} diff --git a/apps/mobile_app/pubspec.lock b/apps/mobile_app/pubspec.lock index f73b7219..eac07827 100644 --- a/apps/mobile_app/pubspec.lock +++ b/apps/mobile_app/pubspec.lock @@ -48,6 +48,70 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + build: + dependency: transitive + description: + name: build + sha256: ce76b1d48875e3233fde17717c23d1f60a91cc631597e49a400c89b475395b1d + url: "https://pub.dev" + source: hosted + version: "3.1.0" + build_config: + dependency: transitive + description: + name: build_config + sha256: "4f64382b97504dc2fcdf487d5aae33418e08b4703fc21249e4db6d804a4d0187" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: bf05f6e12cfea92d3c09308d7bcdab1906cd8a179b023269eed00c071004b957 + url: "https://pub.dev" + source: hosted + version: "4.1.1" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: d1d57f7807debd7349b4726a19fd32ec8bc177c71ad0febf91a20f84cd2d4b46 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + build_runner: + dependency: "direct main" + description: + name: build_runner + sha256: b24597fceb695969d47025c958f3837f9f0122e237c6a22cb082a5ac66c3ca30 + url: "https://pub.dev" + source: hosted + version: "2.7.1" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "066dda7f73d8eb48ba630a55acb50c4a84a2e6b453b1cb4567f581729e794f7b" + url: "https://pub.dev" + source: hosted + version: "9.3.1" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: a30f0a0e38671e89a492c44d005b5545b830a961575bbd8336d42869ff71066d + url: "https://pub.dev" + source: hosted + version: "8.12.0" characters: dependency: transitive description: @@ -56,6 +120,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.dev" + source: hosted + version: "2.0.4" cli_config: dependency: transitive description: @@ -72,6 +144,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.2" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "11654819532ba94c34de52ff5feb52bd81cba1de00ef2ed622fd50295f9d4243" + url: "https://pub.dev" + source: hosted + version: "4.11.0" collection: dependency: transitive description: @@ -112,6 +192,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.8" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb" + url: "https://pub.dev" + source: hosted + version: "3.1.1" dashboard_shell: dependency: "direct main" description: @@ -150,6 +238,14 @@ packages: url: "https://pub.dev" source: hosted version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" fl_chart: dependency: transitive description: @@ -197,6 +293,22 @@ packages: description: flutter source: sdk version: "0.0.0" + freezed: + dependency: transitive + description: + name: freezed + sha256: "13065f10e135263a4f5a4391b79a8efc5fb8106f8dd555a9e49b750b45393d77" + url: "https://pub.dev" + source: hosted + version: "3.2.3" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8" + url: "https://pub.dev" + source: hosted + version: "3.1.0" frontend_server_client: dependency: transitive description: @@ -229,6 +341,22 @@ packages: url: "https://pub.dev" source: hosted version: "17.0.0" + go_router_builder: + dependency: "direct main" + description: + name: go_router_builder + sha256: e0646fb5586e04e1df92678f539059f38e4314848f06dd4f3cd87fed434e16b5 + url: "https://pub.dev" + source: hosted + version: "4.1.1" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" home: dependency: "direct main" description: @@ -276,6 +404,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.2" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" leak_tracker: dependency: transitive description: @@ -355,14 +491,6 @@ packages: relative: true source: path version: "0.0.1" - nested: - dependency: transitive - description: - name: nested - sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" - url: "https://pub.dev" - source: hosted - version: "1.0.0" node_preamble: dependency: transitive description: @@ -425,14 +553,6 @@ packages: relative: true source: path version: "0.0.1" - provider: - dependency: transitive - description: - name: provider - sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272" - url: "https://pub.dev" - source: hosted - version: "6.1.5+1" pub_semver: dependency: transitive description: @@ -441,6 +561,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.0" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" + url: "https://pub.dev" + source: hosted + version: "1.5.0" riverpod: dependency: transitive description: @@ -493,6 +621,22 @@ packages: description: flutter source: sdk version: "0.0.0" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "800f12fb87434defa13432ab37e33051b43b290a174e15259563b043cda40c46" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "6a3c6cc82073a8797f8c4dc4572146114a39652851c157db37e964d9c7038723" + url: "https://pub.dev" + source: hosted + version: "1.3.8" source_map_stack_trace: dependency: transitive description: @@ -541,6 +685,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" string_scanner: dependency: transitive description: @@ -581,6 +733,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.11" + timing: + dependency: transitive + description: + name: timing + sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" + url: "https://pub.dev" + source: hosted + version: "1.0.2" typed_data: dependency: transitive description: diff --git a/apps/mobile_app/pubspec.yaml b/apps/mobile_app/pubspec.yaml index 5c2bce0f..3568458c 100644 --- a/apps/mobile_app/pubspec.yaml +++ b/apps/mobile_app/pubspec.yaml @@ -33,10 +33,8 @@ dependencies: flutter_riverpod: ^3.0.3 get_it: ^9.0.5 go_router: ^17.0.0 - navigation: - path: ../../packages/navigation - design_system: - path: ../../packages/design_system + + #modules dependencies go here auth: path: ../../modules/auth home: @@ -47,11 +45,18 @@ dependencies: path: ../../modules/notifications dashboard_shell: path: ../../modules/dashboard_shell - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. + + #packages dependencies go here + navigation: + path: ../../packages/navigation + design_system: + path: ../../packages/design_system + + #dependencies go here cupertino_icons: ^1.0.8 flutter_svg: ^2.2.1 - + go_router_builder: ^4.1.1 + build_runner: ^2.7.1 dev_dependencies: flutter_test: diff --git a/modules/auth/lib/src/device_sign_up/add_kid_screen.dart b/modules/auth/lib/src/device_sign_up/add_kid_screen.dart index a40aef4c..37531a5c 100644 --- a/modules/auth/lib/src/device_sign_up/add_kid_screen.dart +++ b/modules/auth/lib/src/device_sign_up/add_kid_screen.dart @@ -1,10 +1,9 @@ import 'package:auth/src/device_sign_up/link_watch/create_profile_screen.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -// import 'package:sf_app_platform/payments/view/screens/core/dashboard_screen.dart'; -// import 'package:sf_app_platform/payments/view/screens/link_watch/create_profile_screen.dart'; class AddKidScreen extends StatelessWidget { + const AddKidScreen({super.key}); + @override Widget build(BuildContext context) { return Scaffold( diff --git a/modules/auth/lib/src/device_sign_up/link_watch/create_profile_screen.dart b/modules/auth/lib/src/device_sign_up/link_watch/create_profile_screen.dart index 487db4ff..23b2973c 100644 --- a/modules/auth/lib/src/device_sign_up/link_watch/create_profile_screen.dart +++ b/modules/auth/lib/src/device_sign_up/link_watch/create_profile_screen.dart @@ -5,9 +5,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; class CreateProfileScreen extends ConsumerWidget { - CreateProfileScreen({super.key}); + const CreateProfileScreen({super.key}); - int currentStep = 0; + final int currentStep = 0; @override Widget build(BuildContext context, WidgetRef ref) { diff --git a/modules/auth/lib/src/login/presentation/loading_google_screen.dart b/modules/auth/lib/src/login/presentation/loading_google_screen.dart index 96db9627..62223b22 100644 --- a/modules/auth/lib/src/login/presentation/loading_google_screen.dart +++ b/modules/auth/lib/src/login/presentation/loading_google_screen.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -// import 'package:flutter_svg/flutter_svg.dart'; class LoadingGoogleScreen extends StatelessWidget { const LoadingGoogleScreen({super.key}); diff --git a/modules/auth/lib/src/login/presentation/login_screen.dart b/modules/auth/lib/src/login/presentation/login_screen.dart index bc3cc2f5..fd7899af 100644 --- a/modules/auth/lib/src/login/presentation/login_screen.dart +++ b/modules/auth/lib/src/login/presentation/login_screen.dart @@ -1,14 +1,8 @@ import 'package:auth/src/login/presentation/loading_google_screen.dart'; -import 'package:auth/src/recover_password/presentation/restore_password_screen.dart'; import 'package:auth/src/sign_up/signup_screen.dart'; -import 'package:dashboard_shell/dashboard_shell.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:navigation/navigation.dart'; -// import 'package:sf_app_platform/payments/view/screens/core/dashboard_screen.dart'; -// import 'package:sf_app_platform/payments/view/screens/loading_google_screen.dart'; -// import 'package:sf_app_platform/payments/view/screens/restore_password/restore_password_screen.dart'; -// import 'package:sf_app_platform/payments/view/screens/signup/signup_screen.dart'; class LoginScreen extends ConsumerWidget { final NavigationContract navigationContract; @@ -66,8 +60,7 @@ class LoginScreen extends ConsumerWidget { child: Text("¿Has olvidado la contraseña?"), ), FilledButton( - onPressed: () => - navigationContract.pushTo('/dashboard_shell'), + onPressed: () => navigationContract.pushTo('/main/home'), child: Text("Iniciar sesión"), ), Stack(children: [Divider(), Text("o continúa con")]), diff --git a/modules/auth/lib/src/login/presentation/phone_code_screen.dart b/modules/auth/lib/src/login/presentation/phone_code_screen.dart index 628a4716..51b220d8 100644 --- a/modules/auth/lib/src/login/presentation/phone_code_screen.dart +++ b/modules/auth/lib/src/login/presentation/phone_code_screen.dart @@ -1,4 +1,3 @@ -import 'package:auth/src/login/presentation/login_screen.dart'; import 'package:flutter/material.dart'; import 'package:navigation/navigation.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/modules/auth/lib/src/onboarding/presentation/welcome_screen.dart b/modules/auth/lib/src/onboarding/presentation/welcome_screen.dart index 4544f6a2..9db4fad3 100644 --- a/modules/auth/lib/src/onboarding/presentation/welcome_screen.dart +++ b/modules/auth/lib/src/onboarding/presentation/welcome_screen.dart @@ -3,11 +3,6 @@ import 'package:flutter_svg/svg.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:navigation/navigation.dart'; -// import 'package:sf_app_platform/payments/view/screens/link_phone_screen.dart'; -// import 'package:sf_app_platform/payments/view/screens/signup/signup_screen.dart'; - -// import '../../../../../apps/mobile_app/lib/payments/view/screens/core/dashboard_screen.dart'; - class WelcomeScreen extends ConsumerWidget { final NavigationContract navigationContract; diff --git a/modules/auth/lib/src/recover_password/presentation/email_sent_screen.dart b/modules/auth/lib/src/recover_password/presentation/email_sent_screen.dart index f47f4493..58694e37 100644 --- a/modules/auth/lib/src/recover_password/presentation/email_sent_screen.dart +++ b/modules/auth/lib/src/recover_password/presentation/email_sent_screen.dart @@ -1,24 +1,15 @@ -import 'package:auth/src/recover_password/presentation/new_password_screen.dart'; import 'package:design_system/design_system.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -// import 'package:sf_app_platform/payments/domain/ports/theme_port.dart'; -// import 'package:sf_app_platform/payments/view/screens/restore_password/new_password_screen.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; -class EmailSentScreen extends StatefulWidget { +class EmailSentScreen extends ConsumerWidget { final String email; const EmailSentScreen({super.key, required this.email}); @override - State createState() => EmailSentScreenState(); -} - -class EmailSentScreenState extends State { - @override - Widget build(BuildContext context) { - final theme = context.read(); + Widget build(BuildContext contex, WidgetRef ref) { + final theme = ref.watch(themePortProvider); return Scaffold( body: Container( @@ -65,12 +56,12 @@ class EmailSentScreenState extends State { Expanded( child: FilledButton( onPressed: () => { - Navigator.push( - context, - MaterialPageRoute( - builder: (_) => NewPasswordScreen(), - ), - ), + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (_) => NewPasswordScreen(), + // ), + // ), }, style: ButtonStyle( backgroundColor: WidgetStatePropertyAll( diff --git a/modules/auth/lib/src/recover_password/presentation/new_password_screen.dart b/modules/auth/lib/src/recover_password/presentation/new_password_screen.dart index 679a616c..35abf19d 100644 --- a/modules/auth/lib/src/recover_password/presentation/new_password_screen.dart +++ b/modules/auth/lib/src/recover_password/presentation/new_password_screen.dart @@ -1,18 +1,15 @@ import 'package:design_system/design_system.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; -// import '../../../domain/ports/theme_port.dart'; - -class NewPasswordScreen extends StatefulWidget { +class NewPasswordScreen extends ConsumerStatefulWidget { const NewPasswordScreen({super.key}); @override - State createState() => NewPasswordScreenState(); + ConsumerState createState() => NewPasswordScreenState(); } -class NewPasswordScreenState extends State { +class NewPasswordScreenState extends ConsumerState { bool passwordVisible = false; bool equalPasswords = false; String password = ""; @@ -39,7 +36,7 @@ class NewPasswordScreenState extends State { @override Widget build(BuildContext context) { - final theme = context.read(); + final theme = ref.watch(themePortProvider); return Scaffold( body: Container( diff --git a/modules/auth/lib/src/recover_password/presentation/restore_password_screen.dart b/modules/auth/lib/src/recover_password/presentation/restore_password_screen.dart index 06590dc8..7dc81a88 100644 --- a/modules/auth/lib/src/recover_password/presentation/restore_password_screen.dart +++ b/modules/auth/lib/src/recover_password/presentation/restore_password_screen.dart @@ -2,13 +2,8 @@ import 'package:auth/src/recover_password/presentation/email_sent_screen.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:navigation/navigation.dart'; -// import 'package:provider/provider.dart'; -import 'package:navigation/navigation.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -// import 'package:sf_app_platform/payments/domain/ports/theme_port.dart'; -// import 'package:sf_app_platform/payments/view/screens/restore_password/email_sent_screen.dart'; - class RestorePasswordScreen extends ConsumerWidget { final NavigationContract navigationContract; @@ -16,7 +11,6 @@ class RestorePasswordScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - // ThemePort theme = context.read(); final theme = ref.watch(themePortProvider); return Scaffold( diff --git a/modules/auth/lib/src/sign_up/account_created_screen.dart b/modules/auth/lib/src/sign_up/account_created_screen.dart index dff054ac..263202ff 100644 --- a/modules/auth/lib/src/sign_up/account_created_screen.dart +++ b/modules/auth/lib/src/sign_up/account_created_screen.dart @@ -1,17 +1,14 @@ import 'package:auth/src/device_sign_up/add_kid_screen.dart'; import 'package:design_system/design_system.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -// import 'package:sf_app_platform/payments/view/screens/add_kid_screen.dart'; -// import 'package:sf_app_platform/payments/view/screens/core/dashboard_screen.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; -// import '../../../../../apps/mobile_app/lib/payments/domain/ports/theme_port.dart'; +class AccountCreatedScreen extends ConsumerWidget { + const AccountCreatedScreen({super.key}); -class AccountCreatedScreen extends StatelessWidget { @override - Widget build(BuildContext context) { - ThemePort theme = context.read(); + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); final email = "usuario@example.com"; final fullName = "Carlos Pérez Cruz"; diff --git a/modules/auth/lib/src/sign_up/signup_address_screen.dart b/modules/auth/lib/src/sign_up/signup_address_screen.dart index d2c713ed..d9cbc557 100644 --- a/modules/auth/lib/src/sign_up/signup_address_screen.dart +++ b/modules/auth/lib/src/sign_up/signup_address_screen.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; -class SignupAddressScreen extends StatelessWidget{ +class SignupAddressScreen extends StatelessWidget { + const SignupAddressScreen({super.key}); @override Widget build(BuildContext context) { @@ -8,10 +9,25 @@ class SignupAddressScreen extends StatelessWidget{ spacing: 30, children: [ Text("Domicilio"), - Text("Tu dirección", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30)), - Text("Tu dirección nos ayuda a verificar y mantener la seguridad de tu cuenta"), - TextField(decoration: InputDecoration(hintText: "Dirección completa", border: OutlineInputBorder())), - TextField(decoration: InputDecoration(hintText: "Ciudad", border: OutlineInputBorder())), + Text( + "Tu dirección", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), + ), + Text( + "Tu dirección nos ayuda a verificar y mantener la seguridad de tu cuenta", + ), + TextField( + decoration: InputDecoration( + hintText: "Dirección completa", + border: OutlineInputBorder(), + ), + ), + TextField( + decoration: InputDecoration( + hintText: "Ciudad", + border: OutlineInputBorder(), + ), + ), DropdownMenu( dropdownMenuEntries: List.generate(3, (int index) { return DropdownMenuEntry(value: "España", label: "España"); @@ -19,9 +35,13 @@ class SignupAddressScreen extends StatelessWidget{ hintText: "País", width: double.infinity, ), - TextField(decoration: InputDecoration(hintText: "Nacionalidad", border: OutlineInputBorder())) + TextField( + decoration: InputDecoration( + hintText: "Nacionalidad", + border: OutlineInputBorder(), + ), + ), ], ); } - -} \ No newline at end of file +} diff --git a/modules/auth/lib/src/sign_up/signup_screen.dart b/modules/auth/lib/src/sign_up/signup_screen.dart index 737331c2..a6432de6 100644 --- a/modules/auth/lib/src/sign_up/signup_screen.dart +++ b/modules/auth/lib/src/sign_up/signup_screen.dart @@ -1,14 +1,11 @@ import 'package:auth/src/sign_up/account_created_screen.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; -// import 'package:sf_app_platform/payments/view/screens/account_created_screen.dart'; import 'package:auth/src/sign_up/signup_address_screen.dart'; import 'package:auth/src/sign_up/signup_personal_screen.dart'; import 'package:auth/src/sign_up/signup_user_screen.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -// import '../../../../../apps/mobile_app/lib/payments/domain/ports/theme_port.dart'; - class SignupScreen extends ConsumerWidget { SignupScreen({super.key}); diff --git a/modules/dashboard_shell/lib/dashboard_shell.dart b/modules/dashboard_shell/lib/dashboard_shell.dart index a2432e2b..98603c17 100644 --- a/modules/dashboard_shell/lib/dashboard_shell.dart +++ b/modules/dashboard_shell/lib/dashboard_shell.dart @@ -1,2 +1,2 @@ -export 'src/presentation/dashboard_screen.dart'; +export 'src/presentation/main_shell_screen.dart'; export 'dashboard_builder.dart'; diff --git a/modules/dashboard_shell/lib/src/presentation/dashboard_screen.dart b/modules/dashboard_shell/lib/src/presentation/dashboard_screen.dart deleted file mode 100644 index fa387c18..00000000 --- a/modules/dashboard_shell/lib/src/presentation/dashboard_screen.dart +++ /dev/null @@ -1,59 +0,0 @@ -import 'package:design_system/design_system.dart'; -import 'package:flutter/material.dart'; -import 'package:home/home.dart'; -import 'package:notifications/notifications.dart'; -import 'package:profile/profile.dart'; -// import 'package:provider/provider.dart'; -import 'package:navigation/navigation.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; - -class DashboardScreen extends ConsumerWidget { - final NavigationContract navigationContract; - - DashboardScreen({super.key, required this.navigationContract}); - - int currentPageIndex = 3; - - @override - Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - - final bodies = [ - HomeScreen(), - ActivityScreen(), - AlertScreen(), - ProfileScreen(), - ]; - - return Scaffold( - bottomNavigationBar: NavigationBar( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), - onDestinationSelected: (int index) { - // setState(() { - // currentPageIndex = index; - // }); - }, - selectedIndex: currentPageIndex, - destinations: [ - NavigationDestination( - icon: Icon(Icons.home_outlined), - label: "Inicio", - ), - NavigationDestination( - icon: Icon(Icons.watch_outlined), - label: "Movimientos", - ), - NavigationDestination( - icon: Icon(Icons.notifications_outlined), - label: "Alertas", - ), - NavigationDestination( - icon: Icon(Icons.person_outline_outlined), - label: "Mi perfil", - ), - ], - ), - body: bodies[currentPageIndex], - ); - } -} diff --git a/modules/dashboard_shell/lib/src/presentation/main_shell_screen.dart b/modules/dashboard_shell/lib/src/presentation/main_shell_screen.dart new file mode 100644 index 00000000..57266179 --- /dev/null +++ b/modules/dashboard_shell/lib/src/presentation/main_shell_screen.dart @@ -0,0 +1,58 @@ +import 'package:dashboard_shell/src/presentation/main_shell_view_model.dart'; +import 'package:dashboard_shell/src/presentation/main_shell_view_state.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_riverpod/legacy.dart'; +import 'package:go_router/go_router.dart'; +import 'package:navigation/navigation.dart'; + +final mainShellViewModelProvider = + StateNotifierProvider.autoDispose( + (ref) => MainShellViewModel(ref: ref), + ); + +class DashboardScreen extends ConsumerWidget { + final NavigationContract navigationContract; + final StatefulNavigationShell navigationShell; + + const DashboardScreen({ + super.key, + required this.navigationContract, + required this.navigationShell, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); + final viewState = ref.watch(mainShellViewModelProvider); + final viewModel = ref.read(mainShellViewModelProvider.notifier); + + return Scaffold( + body: navigationShell, + bottomNavigationBar: NavigationBar( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + selectedIndex: viewState.selectedIndex, + onDestinationSelected: (index) { + viewModel.onTabChanged(index); + navigationShell.goBranch(index); + }, + destinations: const [ + NavigationDestination(icon: Icon(Icons.home_outlined), label: "Home"), + NavigationDestination( + icon: Icon(Icons.watch_outlined), + label: "Activity", + ), + NavigationDestination( + icon: Icon(Icons.notifications_outlined), + label: "Notifications", + ), + NavigationDestination( + icon: Icon(Icons.person_outline_outlined), + label: "Profile", + ), + ], + ), + ); + } +} diff --git a/modules/dashboard_shell/lib/src/presentation/main_shell_view_model.dart b/modules/dashboard_shell/lib/src/presentation/main_shell_view_model.dart new file mode 100644 index 00000000..15e8fc4c --- /dev/null +++ b/modules/dashboard_shell/lib/src/presentation/main_shell_view_model.dart @@ -0,0 +1,13 @@ +import 'package:dashboard_shell/src/presentation/main_shell_view_state.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_riverpod/legacy.dart'; + +class MainShellViewModel extends StateNotifier { + MainShellViewModel({required this.ref}) : super(MainShellViewState()); + + final Ref ref; + + void onTabChanged(int index) { + state = state.copyWith(selectedIndex: index); + } +} diff --git a/modules/dashboard_shell/lib/src/presentation/main_shell_view_state.dart b/modules/dashboard_shell/lib/src/presentation/main_shell_view_state.dart new file mode 100644 index 00000000..ed1e0175 --- /dev/null +++ b/modules/dashboard_shell/lib/src/presentation/main_shell_view_state.dart @@ -0,0 +1,16 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +part 'main_shell_view_state.freezed.dart'; + +@freezed +abstract class MainShellViewState with _$MainShellViewState { + const factory MainShellViewState({ + @Default(0) int selectedIndex, + @Default(false) bool isLoading, + @Default(false) bool isComplete, + String? error, + }) = _MainShellViewState; + + + + +} diff --git a/modules/dashboard_shell/lib/src/presentation/main_shell_view_state.freezed.dart b/modules/dashboard_shell/lib/src/presentation/main_shell_view_state.freezed.dart new file mode 100644 index 00000000..aacd734d --- /dev/null +++ b/modules/dashboard_shell/lib/src/presentation/main_shell_view_state.freezed.dart @@ -0,0 +1,280 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'main_shell_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$MainShellViewState { + + int get selectedIndex; bool get isLoading; bool get isComplete; String? get error; +/// Create a copy of MainShellViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$MainShellViewStateCopyWith get copyWith => _$MainShellViewStateCopyWithImpl(this as MainShellViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is MainShellViewState&&(identical(other.selectedIndex, selectedIndex) || other.selectedIndex == selectedIndex)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.error, error) || other.error == error)); +} + + +@override +int get hashCode => Object.hash(runtimeType,selectedIndex,isLoading,isComplete,error); + +@override +String toString() { + return 'MainShellViewState(selectedIndex: $selectedIndex, isLoading: $isLoading, isComplete: $isComplete, error: $error)'; +} + + +} + +/// @nodoc +abstract mixin class $MainShellViewStateCopyWith<$Res> { + factory $MainShellViewStateCopyWith(MainShellViewState value, $Res Function(MainShellViewState) _then) = _$MainShellViewStateCopyWithImpl; +@useResult +$Res call({ + int selectedIndex, bool isLoading, bool isComplete, String? error +}); + + + + +} +/// @nodoc +class _$MainShellViewStateCopyWithImpl<$Res> + implements $MainShellViewStateCopyWith<$Res> { + _$MainShellViewStateCopyWithImpl(this._self, this._then); + + final MainShellViewState _self; + final $Res Function(MainShellViewState) _then; + +/// Create a copy of MainShellViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? selectedIndex = null,Object? isLoading = null,Object? isComplete = null,Object? error = freezed,}) { + return _then(_self.copyWith( +selectedIndex: null == selectedIndex ? _self.selectedIndex : selectedIndex // ignore: cast_nullable_to_non_nullable +as int,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable +as bool,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [MainShellViewState]. +extension MainShellViewStatePatterns on MainShellViewState { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _MainShellViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _MainShellViewState() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _MainShellViewState value) $default,){ +final _that = this; +switch (_that) { +case _MainShellViewState(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _MainShellViewState value)? $default,){ +final _that = this; +switch (_that) { +case _MainShellViewState() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( int selectedIndex, bool isLoading, bool isComplete, String? error)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _MainShellViewState() when $default != null: +return $default(_that.selectedIndex,_that.isLoading,_that.isComplete,_that.error);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( int selectedIndex, bool isLoading, bool isComplete, String? error) $default,) {final _that = this; +switch (_that) { +case _MainShellViewState(): +return $default(_that.selectedIndex,_that.isLoading,_that.isComplete,_that.error);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( int selectedIndex, bool isLoading, bool isComplete, String? error)? $default,) {final _that = this; +switch (_that) { +case _MainShellViewState() when $default != null: +return $default(_that.selectedIndex,_that.isLoading,_that.isComplete,_that.error);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _MainShellViewState implements MainShellViewState { + const _MainShellViewState({this.selectedIndex = 0, this.isLoading = false, this.isComplete = false, this.error}); + + +@override@JsonKey() final int selectedIndex; +@override@JsonKey() final bool isLoading; +@override@JsonKey() final bool isComplete; +@override final String? error; + +/// Create a copy of MainShellViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$MainShellViewStateCopyWith<_MainShellViewState> get copyWith => __$MainShellViewStateCopyWithImpl<_MainShellViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _MainShellViewState&&(identical(other.selectedIndex, selectedIndex) || other.selectedIndex == selectedIndex)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.error, error) || other.error == error)); +} + + +@override +int get hashCode => Object.hash(runtimeType,selectedIndex,isLoading,isComplete,error); + +@override +String toString() { + return 'MainShellViewState(selectedIndex: $selectedIndex, isLoading: $isLoading, isComplete: $isComplete, error: $error)'; +} + + +} + +/// @nodoc +abstract mixin class _$MainShellViewStateCopyWith<$Res> implements $MainShellViewStateCopyWith<$Res> { + factory _$MainShellViewStateCopyWith(_MainShellViewState value, $Res Function(_MainShellViewState) _then) = __$MainShellViewStateCopyWithImpl; +@override @useResult +$Res call({ + int selectedIndex, bool isLoading, bool isComplete, String? error +}); + + + + +} +/// @nodoc +class __$MainShellViewStateCopyWithImpl<$Res> + implements _$MainShellViewStateCopyWith<$Res> { + __$MainShellViewStateCopyWithImpl(this._self, this._then); + + final _MainShellViewState _self; + final $Res Function(_MainShellViewState) _then; + +/// Create a copy of MainShellViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? selectedIndex = null,Object? isLoading = null,Object? isComplete = null,Object? error = freezed,}) { + return _then(_MainShellViewState( +selectedIndex: null == selectedIndex ? _self.selectedIndex : selectedIndex // ignore: cast_nullable_to_non_nullable +as int,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable +as bool,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + +// dart format on diff --git a/modules/dashboard_shell/pubspec.yaml b/modules/dashboard_shell/pubspec.yaml index 08d224f9..ffbf6a8b 100644 --- a/modules/dashboard_shell/pubspec.yaml +++ b/modules/dashboard_shell/pubspec.yaml @@ -29,11 +29,17 @@ dependencies: get_it: ^9.0.5 go_router: ^17.0.0 flutter_riverpod: ^3.0.3 + freezed_annotation: ^3.1.0 + freezed: ^3.2.3 dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^5.0.0 + riverpod_generator: ^3.0.3 + build_runner: ^2.7.1 + riverpod_lint: ^3.0.3 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/modules/home/lib/home.dart b/modules/home/lib/home.dart index dc1e0ada..93a3c53e 100644 --- a/modules/home/lib/home.dart +++ b/modules/home/lib/home.dart @@ -1 +1,2 @@ export 'src/presentation/home_screen.dart'; +export 'src/home_builder.dart'; diff --git a/modules/home/lib/src/home_builder.dart b/modules/home/lib/src/home_builder.dart new file mode 100644 index 00000000..2cfc9bee --- /dev/null +++ b/modules/home/lib/src/home_builder.dart @@ -0,0 +1,11 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:home/home.dart'; + +class HomeBuilder { + const HomeBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + return MaterialPage(child: HomeScreen()); + } +} diff --git a/modules/home/lib/src/presentation/deposit_screen.dart b/modules/home/lib/src/presentation/deposit_screen.dart index 86d201c2..cc6f80e0 100644 --- a/modules/home/lib/src/presentation/deposit_screen.dart +++ b/modules/home/lib/src/presentation/deposit_screen.dart @@ -1,6 +1,7 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:home/src/presentation/wallet_management_layout.dart'; import 'package:sf_shared/sf_shared.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/modules/home/lib/src/presentation/limits_screen.dart b/modules/home/lib/src/presentation/limits_screen.dart index c9479b06..7b0866f9 100644 --- a/modules/home/lib/src/presentation/limits_screen.dart +++ b/modules/home/lib/src/presentation/limits_screen.dart @@ -1,5 +1,6 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; +import 'package:home/src/presentation/wallet_management_layout.dart'; import 'package:sf_shared/sf_shared.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/modules/home/lib/src/presentation/wage_screen.dart b/modules/home/lib/src/presentation/wage_screen.dart index c86d1e5e..eff4788f 100644 --- a/modules/home/lib/src/presentation/wage_screen.dart +++ b/modules/home/lib/src/presentation/wage_screen.dart @@ -1,7 +1,7 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:provider/provider.dart'; +import 'package:home/src/presentation/wallet_management_layout.dart'; import 'package:sf_shared/sf_shared.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/packages/sf_shared/lib/src/wallet_management_layout.dart b/modules/home/lib/src/presentation/wallet_management_layout.dart similarity index 100% rename from packages/sf_shared/lib/src/wallet_management_layout.dart rename to modules/home/lib/src/presentation/wallet_management_layout.dart diff --git a/modules/home/pubspec.yaml b/modules/home/pubspec.yaml index 8191feae..8cd79e9b 100644 --- a/modules/home/pubspec.yaml +++ b/modules/home/pubspec.yaml @@ -26,7 +26,8 @@ dependencies: #dependencies go here flutter_svg: ^2.2.1 flutter_riverpod: ^3.0.3 - + get_it: ^9.0.5 + go_router: ^17.0.0 dev_dependencies: flutter_test: sdk: flutter diff --git a/modules/notifications/lib/notifications.dart b/modules/notifications/lib/notifications.dart index b895dbfd..ea47e63c 100644 --- a/modules/notifications/lib/notifications.dart +++ b/modules/notifications/lib/notifications.dart @@ -1,3 +1,5 @@ export 'src/presentation/alert_screen.dart'; export 'src/presentation/activity_screen.dart'; export 'src/core/activity_list.dart'; +export 'src/activity_builder.dart'; +export 'src/notifications_builder.dart'; diff --git a/modules/notifications/lib/src/activity_builder.dart b/modules/notifications/lib/src/activity_builder.dart new file mode 100644 index 00000000..3b9f6a3e --- /dev/null +++ b/modules/notifications/lib/src/activity_builder.dart @@ -0,0 +1,11 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:notifications/notifications.dart'; + +class ActivityBuilder { + const ActivityBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + return MaterialPage(child: ActivityScreen()); + } +} diff --git a/modules/notifications/lib/src/notifications_builder.dart b/modules/notifications/lib/src/notifications_builder.dart new file mode 100644 index 00000000..7a9b1624 --- /dev/null +++ b/modules/notifications/lib/src/notifications_builder.dart @@ -0,0 +1,11 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:notifications/notifications.dart'; + +class NotificationsBuilder { + const NotificationsBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + return MaterialPage(child: AlertScreen()); + } +} diff --git a/modules/notifications/pubspec.yaml b/modules/notifications/pubspec.yaml index bedad565..d45d707d 100644 --- a/modules/notifications/pubspec.yaml +++ b/modules/notifications/pubspec.yaml @@ -21,7 +21,8 @@ dependencies: path: ../../packages/sf_shared #dependencies go here flutter_riverpod: ^3.0.3 - + get_it: ^9.0.5 + go_router: ^17.0.0 dev_dependencies: flutter_test: sdk: flutter diff --git a/modules/profile/lib/profile.dart b/modules/profile/lib/profile.dart index ac614ad6..357976e9 100644 --- a/modules/profile/lib/profile.dart +++ b/modules/profile/lib/profile.dart @@ -1 +1,2 @@ export 'src/presentation/profile_screen.dart'; +export 'src/profile_builder.dart'; diff --git a/modules/profile/lib/src/profile_builder.dart b/modules/profile/lib/src/profile_builder.dart new file mode 100644 index 00000000..e314bd25 --- /dev/null +++ b/modules/profile/lib/src/profile_builder.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:notifications/notifications.dart'; +import 'package:profile/profile.dart'; + +class ProfileBuilder { + const ProfileBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + return MaterialPage(child: ProfileScreen()); + } +} diff --git a/modules/profile/pubspec.yaml b/modules/profile/pubspec.yaml index 7b1ef832..bddcae03 100644 --- a/modules/profile/pubspec.yaml +++ b/modules/profile/pubspec.yaml @@ -23,7 +23,9 @@ dependencies: #dependencies go here flutter_riverpod: ^3.0.3 - + get_it: ^9.0.5 + go_router: ^17.0.0 + dev_dependencies: flutter_test: sdk: flutter diff --git a/packages/design_system/lib/src/theme/theme_sf_adapter.dart b/packages/design_system/lib/src/theme/theme_sf_adapter.dart index 4fb68de4..846e3a90 100644 --- a/packages/design_system/lib/src/theme/theme_sf_adapter.dart +++ b/packages/design_system/lib/src/theme/theme_sf_adapter.dart @@ -1,12 +1,10 @@ -import 'dart:collection'; import 'dart:ui'; import 'package:design_system/src/theme/theme_port.dart'; import 'package:flutter/material.dart'; class ThemeSfAdapter extends ThemePort { - @override - Map theme = HashMap.from({ + final Map _theme = { ThemeCode.backgroundPrimary: Color(0xFFFFFFFF), ThemeCode.backgroundSecondary: Color(0xFFF7F7F7), ThemeCode.backgroundTertiary: Color(0x4D329E95), @@ -15,11 +13,16 @@ class ThemeSfAdapter extends ThemePort { ThemeCode.textTertiary: Color(0xFFE0E0E0), ThemeCode.buttonPrimary: Color(0xFF329e95), ThemeCode.buttonSecondary: Color(0xFF4B4B4B), - }); + }; @override - List> cardColors = [ - [Color(0xFFFA5C9F), Color(0xFFEB2579), Color(0xFFE60866)], - [Color(0xFF00A1C6), Color(0xFF00819E)], + Map get theme => _theme; + + final List> _cardColors = [ + [Color(0xFFFA5C9F), Color(0xFFEB2579), Color(0xFFE60866)], + [Color(0xFF00A1C6), Color(0xFF00819E)], ]; + + @override + List> get cardColors => _cardColors; } diff --git a/packages/sf_shared/lib/sf_shared.dart b/packages/sf_shared/lib/sf_shared.dart index f045fb7e..513ec32e 100644 --- a/packages/sf_shared/lib/sf_shared.dart +++ b/packages/sf_shared/lib/sf_shared.dart @@ -1,7 +1,6 @@ -export 'src/kid.dart'; -export 'src/line_graph.dart'; -export 'src/deposit_block.dart'; -export 'src/wallet_management_layout.dart'; -export 'src/connection_error_screen.dart'; -export 'src/server_error_screen.dart'; -export 'src/no_plan_error_screen.dart'; +export 'src/models/kid.dart'; +export 'src/widgets/line_graph.dart'; +export 'src/widgets/deposit_block.dart'; +export 'src/screens/connection_error_screen.dart'; +export 'src/screens/server_error_screen.dart'; +export 'src/screens/no_plan_error_screen.dart'; diff --git a/packages/sf_shared/lib/src/kid.dart b/packages/sf_shared/lib/src/models/kid.dart similarity index 100% rename from packages/sf_shared/lib/src/kid.dart rename to packages/sf_shared/lib/src/models/kid.dart diff --git a/packages/sf_shared/lib/src/connection_error_screen.dart b/packages/sf_shared/lib/src/screens/connection_error_screen.dart similarity index 100% rename from packages/sf_shared/lib/src/connection_error_screen.dart rename to packages/sf_shared/lib/src/screens/connection_error_screen.dart diff --git a/packages/sf_shared/lib/src/no_plan_error_screen.dart b/packages/sf_shared/lib/src/screens/no_plan_error_screen.dart similarity index 100% rename from packages/sf_shared/lib/src/no_plan_error_screen.dart rename to packages/sf_shared/lib/src/screens/no_plan_error_screen.dart diff --git a/packages/sf_shared/lib/src/server_error_screen.dart b/packages/sf_shared/lib/src/screens/server_error_screen.dart similarity index 100% rename from packages/sf_shared/lib/src/server_error_screen.dart rename to packages/sf_shared/lib/src/screens/server_error_screen.dart diff --git a/packages/sf_shared/lib/src/deposit_block.dart b/packages/sf_shared/lib/src/widgets/deposit_block.dart similarity index 100% rename from packages/sf_shared/lib/src/deposit_block.dart rename to packages/sf_shared/lib/src/widgets/deposit_block.dart diff --git a/packages/sf_shared/lib/src/line_graph.dart b/packages/sf_shared/lib/src/widgets/line_graph.dart similarity index 100% rename from packages/sf_shared/lib/src/line_graph.dart rename to packages/sf_shared/lib/src/widgets/line_graph.dart diff --git a/packages/utils/lib/src/size_utils.dart b/packages/utils/lib/src/size_utils.dart index a337b23d..576cebc0 100755 --- a/packages/utils/lib/src/size_utils.dart +++ b/packages/utils/lib/src/size_utils.dart @@ -1,10 +1,10 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -class MainConstants { - static const double minWebAppRatio = 9.0 / 21.0; - static const double maxWebAppRatio = 9.0 / 18.0; -} +// class MainConstants { +// static const double minWebAppRatio = 9.0 / 21.0; +// static const double maxWebAppRatio = 9.0 / 18.0; +// } /// Utils for dynamic sizes class SizeUtils { @@ -22,7 +22,7 @@ class SizeUtils { // Padding of the screen where we cannot render elements without the SafeArea static EdgeInsets padding = const EdgeInsets.all(0); - static const double kWebDesiredAspectRatio = MainConstants.minWebAppRatio; + // static const double kWebDesiredAspectRatio = MainConstants.minWebAppRatio; const SizeUtils();