jld3103
2 years ago
7 changed files with 99 additions and 89 deletions
@ -0,0 +1,51 @@ |
|||||||
|
part of '../neon.dart'; |
||||||
|
|
||||||
|
// ignore: prefer_mixin |
||||||
|
class AppRouter extends RouterDelegate<Account> with ChangeNotifier, PopNavigatorRouterDelegateMixin<Account> { |
||||||
|
AppRouter({ |
||||||
|
required this.navigatorKey, |
||||||
|
required this.accountsBloc, |
||||||
|
required this.onThemeChanged, |
||||||
|
}); |
||||||
|
|
||||||
|
final AccountsBloc accountsBloc; |
||||||
|
final Function(NextcloudTheme? theme) onThemeChanged; |
||||||
|
final _globalPopups = const GlobalPopups(); |
||||||
|
|
||||||
|
@override |
||||||
|
final GlobalKey<NavigatorState> navigatorKey; |
||||||
|
|
||||||
|
@override |
||||||
|
Future setNewRoutePath(final Account? configuration) async {} |
||||||
|
|
||||||
|
@override |
||||||
|
Account? get currentConfiguration => accountsBloc.activeAccount.valueOrNull; |
||||||
|
|
||||||
|
@override |
||||||
|
Widget build(final BuildContext context) => Navigator( |
||||||
|
key: navigatorKey, |
||||||
|
onPopPage: (final route, final result) => route.didPop(result), |
||||||
|
pages: [ |
||||||
|
if (currentConfiguration == null) ...[ |
||||||
|
const MaterialPage( |
||||||
|
child: LoginPage(), |
||||||
|
), |
||||||
|
] else ...[ |
||||||
|
MaterialPage( |
||||||
|
child: Scaffold( |
||||||
|
resizeToAvoidBottomInset: false, |
||||||
|
body: Stack( |
||||||
|
children: [ |
||||||
|
_globalPopups, |
||||||
|
HomePage( |
||||||
|
account: currentConfiguration!, |
||||||
|
onThemeChanged: onThemeChanged, |
||||||
|
), |
||||||
|
], |
||||||
|
), |
||||||
|
), |
||||||
|
), |
||||||
|
], |
||||||
|
], |
||||||
|
); |
||||||
|
} |
Loading…
Reference in new issue