home added

This commit is contained in:
gitea
2026-08-31 12:57:17 +02:00
parent 92581e6d55
commit 7692809219
18 changed files with 1446 additions and 384 deletions
+49 -22
View File
@@ -1,8 +1,9 @@
/// Bottom navigation: products, lists, add, and shop log.
/// Bottom navigation: home, products, lists, add, and shop log.
library;
import 'package:flutter/material.dart';
import 'home_screen.dart';
import 'products_screen.dart';
import 'scan_screen.dart';
import 'services/app_settings.dart';
@@ -20,11 +21,14 @@ class HomeShell extends StatefulWidget {
}
class _HomeShellState extends State<HomeShell> {
static const _homeIndex = 0;
static const _productsIndex = 1;
static const _addIndex = 2;
static const _shopLogIndex = 3;
static const _listsIndex = 3;
static const _shopLogIndex = 4;
static const _fabGap = 56.0;
int _index = _addIndex;
int _index = _homeIndex;
int _revision = 0;
AppSettings? _settings;
int _seenGeneration = 0;
@@ -77,15 +81,23 @@ class _HomeShellState extends State<HomeShell> {
return Scaffold(
body: switch (_index) {
0 => ProductsScreen(
_homeIndex => HomeScreen(
key: ValueKey('home-$_revision'),
repository: widget.repository,
onOpenProducts: () => _select(_productsIndex),
onOpenLists: () => _select(_listsIndex),
onOpenShopLog: () => _select(_shopLogIndex),
onOpenAdd: () => _select(_addIndex),
),
_productsIndex => ProductsScreen(
key: ValueKey('products-$_revision'),
repository: widget.repository,
),
1 => ShoppingListsScreen(
_listsIndex => ShoppingListsScreen(
key: ValueKey('lists-$_revision'),
repository: widget.repository,
),
2 => ScanScreen(
_addIndex => ScanScreen(
repository: widget.repository,
onTripSaved: _onTripSaved,
),
@@ -118,20 +130,20 @@ class _HomeShellState extends State<HomeShell> {
children: [
Expanded(
child: _NavButton(
icon: Icons.inventory_2_outlined,
selectedIcon: Icons.inventory_2,
label: 'Products',
selected: _index == 0,
onTap: () => _select(0),
icon: Icons.home_outlined,
selectedIcon: Icons.home,
label: 'Home',
selected: _index == _homeIndex,
onTap: () => _select(_homeIndex),
),
),
Expanded(
child: _NavButton(
icon: Icons.checklist_outlined,
selectedIcon: Icons.checklist,
label: 'Lists',
selected: _index == 1,
onTap: () => _select(1),
icon: Icons.inventory_2_outlined,
selectedIcon: Icons.inventory_2,
label: 'Products',
selected: _index == _productsIndex,
onTap: () => _select(_productsIndex),
),
),
],
@@ -139,12 +151,27 @@ class _HomeShellState extends State<HomeShell> {
),
const SizedBox(width: _fabGap),
Expanded(
child: _NavButton(
icon: Icons.receipt_long_outlined,
selectedIcon: Icons.receipt_long,
label: 'Shop log',
selected: _index == _shopLogIndex,
onTap: () => _select(_shopLogIndex),
child: Row(
children: [
Expanded(
child: _NavButton(
icon: Icons.checklist_outlined,
selectedIcon: Icons.checklist,
label: 'Lists',
selected: _index == _listsIndex,
onTap: () => _select(_listsIndex),
),
),
Expanded(
child: _NavButton(
icon: Icons.receipt_long_outlined,
selectedIcon: Icons.receipt_long,
label: 'Shop log',
selected: _index == _shopLogIndex,
onTap: () => _select(_shopLogIndex),
),
),
],
),
),
],