diff --git a/lib/features/home/presentation/pages/home_page.dart b/lib/features/home/presentation/pages/home_page.dart index 27a16dba..2ed1b623 100644 --- a/lib/features/home/presentation/pages/home_page.dart +++ b/lib/features/home/presentation/pages/home_page.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -12,7 +14,11 @@ import 'package:hub/shared/components/molecules/menu/index.dart'; import 'package:hub/shared/components/molecules/modules/index.dart'; class HomePageWidget extends StatefulWidget { - const HomePageWidget({super.key}); + const HomePageWidget({ + super.key, + this.update, + }); + final Future Function(BuildContext context)? update; @override State createState() => _HomePageWidgetState(); @@ -25,7 +31,11 @@ class _HomePageWidgetState extends State { void initState() { super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) async { - await LocalsRepositoryImpl().update(context); + log('update: ${widget.update == null}'); + log('update: ${widget.update}'); + if (widget.update != null) { + await widget.update!(context); + } }); } diff --git a/lib/flutter_flow/nav/nav.dart b/lib/flutter_flow/nav/nav.dart index 11bb57dd..30aacafd 100644 --- a/lib/flutter_flow/nav/nav.dart +++ b/lib/flutter_flow/nav/nav.dart @@ -122,7 +122,14 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { token: token, ); }), - FFRoute(name: 'homePage', path: '/homePage', builder: (context, params) => HomePageWidget(key: UniqueKey())), + FFRoute(name: 'homePage', path: '/homePage', builder: (context, params) { + log('params: $params'); + final Future Function(BuildContext context)? update = params.getParam('update', ParamType.Function); + log('update: $update'); + + return HomePageWidget(key: UniqueKey(), update: update); + + }), FFRoute(name: 'petsOnThePropertyPage', path: '/petsOnThePropertyPage', builder: (context, params) => Scaffold(body: const PetsHistoryScreen(isApp: true))), FFRoute(name: 'vehiclesOnThePropertyPage', path: '/vehiclesOnThePropertyPage', builder: (context, params) => const VehicleOnTheProperty()), FFRoute(name: 'receptionPage', path: '/receptionPage', builder: (context, params) => const ReceptionPageWidget()), diff --git a/lib/flutter_flow/nav/serialization_util.dart b/lib/flutter_flow/nav/serialization_util.dart index 02f636c4..18018306 100644 --- a/lib/flutter_flow/nav/serialization_util.dart +++ b/lib/flutter_flow/nav/serialization_util.dart @@ -150,7 +150,7 @@ enum ParamType { FFPlace, FFUploadedFile, JSON, - + Function, DataStruct, Enum, } @@ -186,6 +186,8 @@ dynamic deserializeParam( switch (paramType) { case ParamType.int: return int.tryParse(param); + case ParamType.Function: + return param; case ParamType.double: return double.tryParse(param); case ParamType.String: diff --git a/lib/pages/pets_on_the_property_page/pets_history_screen.dart b/lib/pages/pets_on_the_property_page/pets_history_screen.dart index 5c29a948..b0663b1d 100644 --- a/lib/pages/pets_on_the_property_page/pets_history_screen.dart +++ b/lib/pages/pets_on_the_property_page/pets_history_screen.dart @@ -58,7 +58,10 @@ class _PetsHistoryScreenState extends State with TickerProvid return AppBar( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, automaticallyImplyLeading: false, - title: Text(FFLocalizations.of(context).getVariableText(enText: 'Pets', ptText: 'Pets'), + title: Text(FFLocalizations.of(context).getVariableText( + ptText: 'Cadastrar Pets', + enText: 'Pets Register', + ), style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Nunito', color: FlutterFlowTheme.of(context).primaryText, diff --git a/lib/pages/pets_page/pets_page_widget.dart b/lib/pages/pets_page/pets_page_widget.dart index 4beac680..a2d7c1f7 100644 --- a/lib/pages/pets_page/pets_page_widget.dart +++ b/lib/pages/pets_page/pets_page_widget.dart @@ -75,7 +75,10 @@ class _PetsPageWidgetState extends State with SingleTickerProvid PreferredSizeWidget _buildAppBar(BuildContext context) { return AppBarUtil( - title: 'Pets', + title: FFLocalizations.of(context).getVariableText( + ptText: 'Cadastrar Pets', + enText: 'Pets Register', + ), onBackButtonPressed: () => context.pop(), ); } diff --git a/lib/shared/components/molecules/menu/presentation/mappers/menu_entry.dart b/lib/shared/components/molecules/menu/presentation/mappers/menu_entry.dart index 6097c501..de323a54 100644 --- a/lib/shared/components/molecules/menu/presentation/mappers/menu_entry.dart +++ b/lib/shared/components/molecules/menu/presentation/mappers/menu_entry.dart @@ -105,8 +105,8 @@ class MenuEntry implements BaseModule { key: 'FRE-HUB-PETS', icon: Icons.pets, name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText( - ptText: 'Pets', - enText: 'Pets', + ptText: 'Cadastrar Pets', + enText: 'Pets Register' ), route: '/petsPage', types: [MenuEntryType.Home, MenuEntryType.Drawer], diff --git a/lib/shared/services/authentication/authentication_service.dart b/lib/shared/services/authentication/authentication_service.dart index ae3d457a..ef3e4ffb 100644 --- a/lib/shared/services/authentication/authentication_service.dart +++ b/lib/shared/services/authentication/authentication_service.dart @@ -1,6 +1,7 @@ import 'dart:developer'; import 'package:flutter/material.dart'; +import 'package:hub/features/home/presentation/pages/home_page.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/shared/helpers/storage/base_storage.dart'; import 'package:hub/shared/helpers/storage/storage_helper.dart'; @@ -10,6 +11,7 @@ import 'package:hub/shared/utils/snackbar_util.dart'; import '../../../backend/api_requests/api_calls.dart'; import '../../../flutter_flow/flutter_flow_util.dart'; import '../../../flutter_flow/random_data_util.dart'; +import '../../components/molecules/locals/data/index.dart'; import '../../utils/device_util.dart'; import '../../utils/dialog_util.dart'; import '../../utils/log_util.dart'; @@ -30,11 +32,11 @@ class AuthenticationService { await StorageHelper().set(SecureStorageKey.haveLocal.value, false); context.go('/receptionPage'); } else { - await StorageHelper().set(SecureStorageKey.haveLocal.value, true); - context.go('/homePage'); + await StorageHelper().set(SecureStorageKey.isLogged.value, true); + context.go('/homePage', extra: {'update': LocalsRepositoryImpl().update}); } - await StorageHelper().set(SecureStorageKey.isLogged.value, true); + } static Future signIn(