felangel / felangel/flow_builder
Clarification needed on automatic routing on state change
- Lenguaje dominante
- Dart
- Estrellas
- 416
- Forks
- 68
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.