|
|
@ -98,56 +98,54 @@ class _HomePageState extends State<HomePage> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(final BuildContext context) => ResultBuilder<Iterable<AppImplementation>>.behaviorSubject( |
|
|
|
Widget build(final BuildContext context) { |
|
|
|
stream: _appsBloc.appImplementations, |
|
|
|
|
|
|
|
builder: (final context, final appImplementations) => StreamBuilder<AppImplementation>( |
|
|
|
|
|
|
|
stream: _appsBloc.activeApp, |
|
|
|
|
|
|
|
builder: (final context, final activeAppSnapshot) => OptionBuilder<NavigationMode>( |
|
|
|
|
|
|
|
option: _globalOptions.navigationMode, |
|
|
|
|
|
|
|
builder: (final context, final navigationMode) { |
|
|
|
|
|
|
|
final drawerAlwaysVisible = navigationMode == NavigationMode.drawerAlwaysVisible; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const drawer = NeonDrawer(); |
|
|
|
const drawer = NeonDrawer(); |
|
|
|
const appBar = NeonAppBar(); |
|
|
|
const appBar = NeonAppBar(); |
|
|
|
|
|
|
|
|
|
|
|
Widget body = Builder( |
|
|
|
final appView = ResultBuilder<Iterable<AppImplementation>>.behaviorSubject( |
|
|
|
builder: (final context) => Column( |
|
|
|
stream: _appsBloc.appImplementations, |
|
|
|
children: [ |
|
|
|
builder: (final context, final appImplementations) { |
|
|
|
if (appImplementations.hasData) ...[ |
|
|
|
if (!appImplementations.hasData) { |
|
|
|
if (appImplementations.requireData.isEmpty) ...[ |
|
|
|
return const SizedBox(); |
|
|
|
Expanded( |
|
|
|
} |
|
|
|
child: Center( |
|
|
|
|
|
|
|
|
|
|
|
if (appImplementations.requireData.isEmpty) { |
|
|
|
|
|
|
|
return Center( |
|
|
|
child: Text( |
|
|
|
child: Text( |
|
|
|
AppLocalizations.of(context).errorNoCompatibleNextcloudAppsFound, |
|
|
|
AppLocalizations.of(context).errorNoCompatibleNextcloudAppsFound, |
|
|
|
textAlign: TextAlign.center, |
|
|
|
textAlign: TextAlign.center, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
] else ...[ |
|
|
|
|
|
|
|
if (activeAppSnapshot.hasData) ...[ |
|
|
|
|
|
|
|
Expanded( |
|
|
|
|
|
|
|
child: activeAppSnapshot.requireData.page, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
body = MultiProvider( |
|
|
|
return StreamBuilder<AppImplementation>( |
|
|
|
providers: _appsBloc.appBlocProviders, |
|
|
|
stream: _appsBloc.activeApp, |
|
|
|
child: Scaffold( |
|
|
|
builder: (final context, final activeAppIDSnapshot) { |
|
|
|
|
|
|
|
if (!activeAppIDSnapshot.hasData) { |
|
|
|
|
|
|
|
return const SizedBox(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return activeAppIDSnapshot.requireData.page; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final body = OptionBuilder<NavigationMode>( |
|
|
|
|
|
|
|
option: _globalOptions.navigationMode, |
|
|
|
|
|
|
|
builder: (final context, final navigationMode) { |
|
|
|
|
|
|
|
final drawerAlwaysVisible = navigationMode == NavigationMode.drawerAlwaysVisible; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final body = Scaffold( |
|
|
|
key: _scaffoldKey, |
|
|
|
key: _scaffoldKey, |
|
|
|
resizeToAvoidBottomInset: false, |
|
|
|
resizeToAvoidBottomInset: false, |
|
|
|
drawer: !drawerAlwaysVisible ? drawer : null, |
|
|
|
drawer: !drawerAlwaysVisible ? drawer : null, |
|
|
|
appBar: appBar, |
|
|
|
appBar: appBar, |
|
|
|
body: body, |
|
|
|
body: appView, |
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (drawerAlwaysVisible) { |
|
|
|
if (drawerAlwaysVisible) { |
|
|
|
body = Row( |
|
|
|
return Row( |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
drawer, |
|
|
|
drawer, |
|
|
|
Expanded( |
|
|
|
Expanded( |
|
|
@ -157,6 +155,10 @@ class _HomePageState extends State<HomePage> { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return body; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return WillPopScope( |
|
|
|
return WillPopScope( |
|
|
|
onWillPop: () async { |
|
|
|
onWillPop: () async { |
|
|
|
if (_scaffoldKey.currentState!.isDrawerOpen) { |
|
|
|
if (_scaffoldKey.currentState!.isDrawerOpen) { |
|
|
@ -167,10 +169,10 @@ class _HomePageState extends State<HomePage> { |
|
|
|
_scaffoldKey.currentState!.openDrawer(); |
|
|
|
_scaffoldKey.currentState!.openDrawer(); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
child: MultiProvider( |
|
|
|
|
|
|
|
providers: _appsBloc.appBlocProviders, |
|
|
|
child: body, |
|
|
|
child: body, |
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|