felangel / felangel/flow_builder

Clarification needed on automatic routing on state change

Aperta
#111 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Dart
Stelle
416
Fork
68
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I am using flutter bloc for state management and flow builder for routing, just like it has been used in the flutter news toolkit provided by the flutter team.
I expect routing to be handled automatically by flow builder once state changes, however that is not the case in my scenario. Below are code snippets of my setup. What could i be doing wrong?

The Flowbuilder widget:
```dart
class AppView extends StatelessWidget {
const AppView({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
theme: AppTheme().themeData,
darkTheme: AppDarkTheme().themeData,
themeMode: ThemeMode.system,
debugShowCheckedModeBanner: false,
home: AuthenticatedUserListener(
child: FlowBuilder(
state: context.watch().state.status,
onGeneratePages: onGenerateAppViewPages,
),
),
);
}
}
```

Then the ongenerate pages function:
```dart
List> onGenerateAppViewPages(
AppStatus state,
List> pages,
) {
print("Appstate changed");
switch (state) {
case AppStatus.onboardingRequired:
return [OnboardingPage.page()];
case AppStatus.unauthenticated:
return [LoginPage.page()];
case AppStatus.authenticated:
print("OBJECT: HOME PAGE");
return [HomePage.page()];
case AppStatus.maintenanceOngoing:
return [MaintenanceOngoingPage.page()];
case AppStatus.updateRequired:
return [UpdateRequiredPage.page()];
case AppStatus.userPhoneVerificationRequired:
print("OBJECT: PHONE AUTH PAGE");
return [ExtraUserDetailsRequiredPage.page()];
}
}
```
Upon state change, the print statements are being called, however there is no route change, any information is welcome.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.