Corre????es para Navega????o e Sele????o de Locais
This commit is contained in:
parent
ae0fe2f75f
commit
c3d2048457
|
@ -0,0 +1,2 @@
|
|||
gradle 8.7
|
||||
kotlin 1.7.10
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2,6 +2,9 @@ import 'package:flutter/material.dart';
|
|||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hub/components/molecular_components/menu_item/menu_item.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||
import 'package:hub/shared/utils/dialog_util.dart';
|
||||
|
||||
import '../../../app_state.dart';
|
||||
|
||||
class MenuButtonWidget extends MenuEntry {
|
||||
const MenuButtonWidget({
|
||||
|
@ -30,7 +33,11 @@ class _MenuButtonWidgetState extends State<MenuButtonWidget> {
|
|||
hoverColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: () async {
|
||||
await widget.action?.call();
|
||||
if (AppState().cliUUID.isEmpty) {
|
||||
return DialogUtil.warningDefault(context);
|
||||
} else {
|
||||
await widget.action?.call();
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
|
||||
|
|
|
@ -79,6 +79,15 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
|||
_loading = false;
|
||||
});
|
||||
|
||||
// Verifica se há apenas um local e se o status é 'A'
|
||||
if (locals.length == 1 && locals[0]['CLU_STATUS'] == 'A') {
|
||||
final local = locals[0];
|
||||
AppState().cliUUID = local['CLI_ID'];
|
||||
AppState().local = local['CLI_NOME'];
|
||||
AppState().ownerUUID = local['CLU_OWNER_ID'];
|
||||
context.pop();
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -90,7 +99,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
|||
});
|
||||
|
||||
return null;
|
||||
} catch (e, s) {
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
|
|
|
@ -282,8 +282,8 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
|
|||
'en': 'Does the visit end after the first access?',
|
||||
},
|
||||
'lgv0q5ht': {
|
||||
'pt': 'Visita única',
|
||||
'en': 'Single visit',
|
||||
'pt': 'Entrada única',
|
||||
'en': 'Single entry',
|
||||
},
|
||||
'eftcs67c': {
|
||||
'pt': 'Você tem alguma observação sobre esta visita?',
|
||||
|
|
|
@ -80,7 +80,11 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
|
|||
FFRoute(
|
||||
name: 'homePage',
|
||||
path: '/homePage',
|
||||
builder: (context, params) => const HomePageWidget(),
|
||||
builder: (context, params) {
|
||||
return HomePageWidget(
|
||||
key: UniqueKey(),
|
||||
);
|
||||
},
|
||||
),
|
||||
FFRoute(
|
||||
name: 'receptionPage',
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:app_tracking_transparency/app_tracking_transparency.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
@ -15,7 +16,6 @@ import 'package:hub/flutter_flow/internationalization.dart';
|
|||
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:responsive_framework/responsive_framework.dart';
|
||||
import 'package:app_tracking_transparency/app_tracking_transparency.dart';
|
||||
|
||||
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
||||
|
||||
|
@ -115,8 +115,6 @@ class _AppState extends State<App> {
|
|||
// log("UUID de Publicidade: $uuid");
|
||||
// }
|
||||
|
||||
|
||||
|
||||
void setLocale(String language) {
|
||||
setState(() => _locale = createLocale(language));
|
||||
FFLocalizations.storeLocale(language);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'dart:async';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -16,10 +15,9 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
|||
import 'package:hub/pages/home_page/home_page_model.dart';
|
||||
import 'package:hub/shared/utils/dialog_util.dart';
|
||||
import 'package:hub/shared/widgets/drawer_widget/drawer_widget.dart';
|
||||
import 'package:rxdart/rxdart.dart';
|
||||
|
||||
class HomePageWidget extends StatefulWidget {
|
||||
const HomePageWidget({Key? key});
|
||||
const HomePageWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<HomePageWidget> createState() => _HomePageWidgetState();
|
||||
|
@ -31,7 +29,8 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
late LocalProfileComponentWidget _localProfileComponentWidget;
|
||||
|
||||
_HomePageWidgetState() {
|
||||
_localProfileComponentWidget = LocalProfileComponentWidget(showBottomSheet: showModalSelectLocal);
|
||||
_localProfileComponentWidget =
|
||||
LocalProfileComponentWidget(showBottomSheet: showModalSelectLocal);
|
||||
}
|
||||
|
||||
Future<void> processData() async {
|
||||
|
@ -57,7 +56,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
DialogUtil.warningDefault(context).whenComplete(() => processLocals());
|
||||
safeSetState(() {});
|
||||
return;
|
||||
} catch(e, s) {
|
||||
} catch (e, s) {
|
||||
DialogUtil.warningDefault(context).whenComplete(() => processLocals());
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +70,8 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
|
||||
List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
||||
|
||||
final activeLocals = locals.where((local) => local['CLU_STATUS'] == 'A').toList();
|
||||
final activeLocals =
|
||||
locals.where((local) => local['CLU_STATUS'] == 'A').toList();
|
||||
|
||||
if (activeLocals.isEmpty || AppState().cliUUID.isEmpty) {
|
||||
await showModalSelectLocal();
|
||||
|
@ -96,8 +96,9 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
),
|
||||
).then((_) async {
|
||||
_model.updatePage(() => safeSetState(() {
|
||||
_localProfileComponentWidget = LocalProfileComponentWidget(showBottomSheet: showModalSelectLocal);
|
||||
}));
|
||||
_localProfileComponentWidget = LocalProfileComponentWidget(
|
||||
showBottomSheet: showModalSelectLocal);
|
||||
}));
|
||||
|
||||
await processData();
|
||||
});
|
||||
|
|
|
@ -317,6 +317,7 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
AppState().deleteOwnerUUID();
|
||||
|
||||
context.pop();
|
||||
|
||||
context.go(
|
||||
'/homePage',
|
||||
extra: <String, dynamic>{
|
||||
|
@ -327,16 +328,6 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
),
|
||||
},
|
||||
);
|
||||
context.replace(
|
||||
'/homePage',
|
||||
extra: <String, dynamic>{
|
||||
kTransitionInfoKey: const TransitionInfo(
|
||||
hasTransition: true,
|
||||
transitionType: PageTransitionType.scale,
|
||||
alignment: Alignment.bottomCenter,
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
|
|
Loading…
Reference in New Issue