parser logic added
This commit is contained in:
+29
-20
@@ -1,4 +1,4 @@
|
||||
/// Bottom navigation: products, scan, and shop log.
|
||||
/// Bottom navigation: products, lists, add, and shop log.
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -8,6 +8,7 @@ import 'scan_screen.dart';
|
||||
import 'services/app_settings.dart';
|
||||
import 'services/product_repository.dart';
|
||||
import 'shop_log_screen.dart';
|
||||
import 'shopping_lists_screen.dart';
|
||||
|
||||
class HomeShell extends StatefulWidget {
|
||||
const HomeShell({super.key, required this.repository});
|
||||
@@ -19,10 +20,10 @@ class HomeShell extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _HomeShellState extends State<HomeShell> {
|
||||
static const _scanIndex = 1;
|
||||
static const _shopLogIndex = 2;
|
||||
static const _addIndex = 2;
|
||||
static const _shopLogIndex = 3;
|
||||
|
||||
int _index = _scanIndex;
|
||||
int _index = _addIndex;
|
||||
int _revision = 0;
|
||||
AppSettings? _settings;
|
||||
int _seenGeneration = 0;
|
||||
@@ -59,9 +60,8 @@ class _HomeShellState extends State<HomeShell> {
|
||||
});
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Shopping trip saved.')),
|
||||
);
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(const SnackBar(content: Text('Shopping trip saved.')));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -70,17 +70,21 @@ class _HomeShellState extends State<HomeShell> {
|
||||
return Scaffold(
|
||||
body: switch (_index) {
|
||||
0 => ProductsScreen(
|
||||
key: ValueKey('products-$_revision'),
|
||||
repository: widget.repository,
|
||||
),
|
||||
1 => ScanScreen(
|
||||
repository: widget.repository,
|
||||
onTripSaved: _onTripSaved,
|
||||
),
|
||||
key: ValueKey('products-$_revision'),
|
||||
repository: widget.repository,
|
||||
),
|
||||
1 => ShoppingListsScreen(
|
||||
key: ValueKey('lists-$_revision'),
|
||||
repository: widget.repository,
|
||||
),
|
||||
2 => ScanScreen(
|
||||
repository: widget.repository,
|
||||
onTripSaved: _onTripSaved,
|
||||
),
|
||||
_ => ShopLogScreen(
|
||||
key: ValueKey('shops-$_revision'),
|
||||
repository: widget.repository,
|
||||
),
|
||||
key: ValueKey('shops-$_revision'),
|
||||
repository: widget.repository,
|
||||
),
|
||||
},
|
||||
bottomNavigationBar: NavigationBar(
|
||||
selectedIndex: _index,
|
||||
@@ -92,9 +96,14 @@ class _HomeShellState extends State<HomeShell> {
|
||||
label: 'Products',
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.photo_camera_outlined),
|
||||
selectedIcon: Icon(Icons.photo_camera),
|
||||
label: 'Scan',
|
||||
icon: Icon(Icons.checklist_outlined),
|
||||
selectedIcon: Icon(Icons.checklist),
|
||||
label: 'Lists',
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.add),
|
||||
selectedIcon: Icon(Icons.add_circle),
|
||||
label: 'Add',
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.receipt_long_outlined),
|
||||
|
||||
Reference in New Issue
Block a user