Changed file directories, added clear storage setting, updated readme w/ Google Play reference

This commit is contained in:
Anton Stubenbord
2022-11-12 20:48:09 +01:00
parent c4104e75a7
commit afbd4bddb4
21 changed files with 380 additions and 135 deletions

View File

@@ -37,47 +37,39 @@ class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return BlocListener<GlobalErrorCubit, GlobalErrorState>(
return BlocConsumer<ConnectivityCubit, ConnectivityState>(
//Only re-initialize data if the connectivity changed from not connected to connected
listenWhen: (previous, current) => current == ConnectivityState.connected,
listener: (context, state) {
if (state.hasError) {
showSnackBar(context, translateError(context, state.error!.code));
}
initializeLabelData(context);
},
child: BlocConsumer<ConnectivityCubit, ConnectivityState>(
//Only re-initialize data if the connectivity changed from not connected to connected
listenWhen: (previous, current) =>
current == ConnectivityState.connected,
listener: (context, state) {
initializeLabelData(context);
},
builder: (context, connectivityState) {
return Scaffold(
appBar: connectivityState == ConnectivityState.connected
? null
: const OfflineBanner(),
key: rootScaffoldKey,
bottomNavigationBar: BottomNavBar(
selectedIndex: _currentIndex,
onNavigationChanged: (index) =>
setState(() => _currentIndex = index),
builder: (context, connectivityState) {
return Scaffold(
appBar: connectivityState == ConnectivityState.connected
? null
: const OfflineBanner(),
key: rootScaffoldKey,
bottomNavigationBar: BottomNavBar(
selectedIndex: _currentIndex,
onNavigationChanged: (index) =>
setState(() => _currentIndex = index),
),
drawer: const InfoDrawer(),
body: [
MultiBlocProvider(
providers: [
BlocProvider.value(value: getIt<DocumentsCubit>()),
],
child: const DocumentsPage(),
),
drawer: const InfoDrawer(),
body: [
MultiBlocProvider(
providers: [
BlocProvider.value(value: getIt<DocumentsCubit>()),
],
child: const DocumentsPage(),
),
BlocProvider.value(
value: getIt<DocumentScannerCubit>(),
child: const ScannerPage(),
),
const LabelsPage(),
][_currentIndex],
);
},
),
BlocProvider.value(
value: getIt<DocumentScannerCubit>(),
child: const ScannerPage(),
),
const LabelsPage(),
][_currentIndex],
);
},
);
}