fix: requests overflow
This commit is contained in:
parent
6e100c84ce
commit
6cd090f361
|
@ -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<bool> Function(BuildContext context)? update;
|
||||
|
||||
@override
|
||||
State<HomePageWidget> createState() => _HomePageWidgetState();
|
||||
|
@ -25,7 +31,11 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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<bool> 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()),
|
||||
|
|
|
@ -150,7 +150,7 @@ enum ParamType {
|
|||
FFPlace,
|
||||
FFUploadedFile,
|
||||
JSON,
|
||||
|
||||
Function,
|
||||
DataStruct,
|
||||
Enum,
|
||||
}
|
||||
|
@ -186,6 +186,8 @@ dynamic deserializeParam<T>(
|
|||
switch (paramType) {
|
||||
case ParamType.int:
|
||||
return int.tryParse(param);
|
||||
case ParamType.Function:
|
||||
return param;
|
||||
case ParamType.double:
|
||||
return double.tryParse(param);
|
||||
case ParamType.String:
|
||||
|
|
|
@ -58,7 +58,10 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen> 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,
|
||||
|
|
|
@ -75,7 +75,10 @@ class _PetsPageWidgetState extends State<PetsPageWidget> with SingleTickerProvid
|
|||
|
||||
PreferredSizeWidget _buildAppBar(BuildContext context) {
|
||||
return AppBarUtil(
|
||||
title: 'Pets',
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Cadastrar Pets',
|
||||
enText: 'Pets Register',
|
||||
),
|
||||
onBackButtonPressed: () => context.pop(),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue