Refactor onboarding to single page

bottom navigation bar
This commit is contained in:
Dr-Blank 2024-05-10 17:49:47 -04:00
parent d9345cad2b
commit 5e152a0baf
No known key found for this signature in database
GPG key ID: 7452CC63F210A266
10 changed files with 285 additions and 101 deletions

View file

@ -20,13 +20,7 @@ void main() async {
);
}
// final _router = MyAppRouter(needOnboarding: _needAuth());
// bool _needAuth() {
// final apiSettings = ApiSettings().readFromBoxOrCreate();
// final servers = AudiobookShelfServer().readFromBoxOrCreate();
// return apiSettings.activeUser == null || servers.isEmpty;
// }
var routerConfig = const MyAppRouter().config;
class MyApp extends ConsumerWidget {
const MyApp({super.key});
@ -36,16 +30,12 @@ class MyApp extends ConsumerWidget {
final servers = ref.watch(audiobookShelfServerProvider);
final apiSettings = ref.watch(apiSettingsProvider);
bool needOnboarding() {
return apiSettings.activeUser == null || servers.isEmpty;
final needOnboarding = apiSettings.activeUser == null || servers.isEmpty;
if (needOnboarding) {
routerConfig.goNamed(Routes.onboarding.name);
}
var routerConfig = MyAppRouter(needOnboarding: needOnboarding()).config;
// if (needOnboarding()) {
// routerConfig.goNamed(Routes.onboarding);
// }
return MaterialApp.router(
theme: lightTheme,
darkTheme: darkTheme,
@ -53,7 +43,6 @@ class MyApp extends ConsumerWidget {
? ThemeMode.dark
: ThemeMode.light,
routerConfig: routerConfig,
// routerConfig: _router.config,
);
}
}