This commit is contained in:
jantunesmesias 2024-08-28 17:39:17 -03:00
parent c25c23634f
commit a7af306b31
4 changed files with 23 additions and 15 deletions

View File

@ -299,8 +299,8 @@ Future toggleSignUpPage(BuildContext context) async {
}
Future toggleApp(BuildContext context, bool haveLocal) async {
if (haveLocal == true)
context.goNamed(
if (haveLocal == true) {
context.pushNamed(
'homePage',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
@ -309,8 +309,8 @@ Future toggleApp(BuildContext context, bool haveLocal) async {
),
},
);
else if (haveLocal == false)
context.goNamed(
} else if (haveLocal == false) {
context.pushNamed(
'receptionPage',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
@ -319,6 +319,7 @@ Future toggleApp(BuildContext context, bool haveLocal) async {
)
},
);
}
}
Future<bool> visitCancelAction(BuildContext context,

View File

@ -15,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:provider/provider.dart';
class HomePageWidget extends StatefulWidget {
const HomePageWidget({super.key});
const HomePageWidget({Key? key});
@override
State<HomePageWidget> createState() => _HomePageWidgetState();
@ -30,6 +29,10 @@ class _HomePageWidgetState extends State<HomePageWidget> {
LocalProfileComponentWidget _localProfileComponentWidget =
const LocalProfileComponentWidget();
_HomePageWidgetState() {
log('HomePageWidget');
}
Future<void> checkData() async {
try {
final response = await PhpGroup.getDadosCall.call(
@ -67,6 +70,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
}
Future<void> checkLocal() async {
log('Checklocal');
try {
final response = await PhpGroup.getLocalsCall.call(
devUUID: AppState().devUUID,
@ -80,9 +84,6 @@ class _HomePageWidgetState extends State<HomePageWidget> {
if (activeLocals.isEmpty || AppState().cliUUID.isEmpty) {
await showBottomSheet().then((_) => checkData());
}
if (AppState().cliUUID.isEmpty) {
await showBottomSheet().then((_) => checkData());
}
} catch (e) {
log('Error in checkLocal: $e');
await showBottomSheet().then((_) => checkData());
@ -110,11 +111,14 @@ class _HomePageWidgetState extends State<HomePageWidget> {
super.initState();
_model = createModel(context, () => HomePageModel());
_model.updateOnChange = true;
AppState().context = context;
() async {
WidgetsBinding.instance.addPostFrameCallback((_) async {
await checkLocal();
});
() async {
await FirebaseMessagingService().updateDeviceToken();
}();
@ -131,7 +135,8 @@ class _HomePageWidgetState extends State<HomePageWidget> {
@override
Widget build(BuildContext context) {
context.watch<AppState>();
// context.watch<AppState>();
return GestureDetector(
onTap: () => _model.unfocusNode.canRequestFocus
? FocusScope.of(context).requestFocus(_model.unfocusNode)

View File

@ -316,7 +316,7 @@ class PreferencesPageModel with ChangeNotifier {
AppState().deleteLocal();
AppState().deleteOwnerUUID();
context.goNamed(
context.pushNamed(
'homePage',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
@ -372,7 +372,7 @@ class PreferencesPageModel with ChangeNotifier {
),
);
});
notifyListeners();
// notifyListeners();
} catch (err, stack) {
Navigator.pop(context);
ScaffoldMessenger.of(context).showSnackBar(
@ -417,7 +417,7 @@ class PreferencesPageModel with ChangeNotifier {
],
);
});
notifyListeners();
// notifyListeners();
}
void deleteAccount(BuildContext context) {

View File

@ -138,7 +138,9 @@ class PreferencesPageWidget extends StatelessWidget {
break;
case 5:
icon = Icons.landscape;
onPressed = () => model.localUnlink(context);
onPressed = () {
model.localUnlink(context);
};
isEnabled = false;
content = FFLocalizations.of(context).getVariableText(
ptText: 'Desative para se desvincular do local selecionado',