hwhub/lib/screens/home_shell.dart
Lukas Müllner 4b9cefb319 feat: multi-collection support, shared collections, invite by email
- Add collections & collection_members tables (SQL migration)
- Create CollectionService for CRUD, invite/remove members
- Add CollectionsScreen with create/manage/open flow
- Add ManageCollectionScreen (rename, invite by email, leave/delete)
- Update GarageScreen to filter by collection_id
- Update ScanTab with collection picker dropdown
- Update HomeShell: Collections tab replaces Garage tab
- Fix RLS policies (infinite recursion, owner visibility)
- Change package ID to com.dltw.derkauzigekoala.hwhub
- Fix unused variable warning in AboutScreen
2026-02-24 17:28:44 +01:00

65 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'collections_screen.dart';
import 'scan_tab.dart';
import 'profile_screen.dart';
/// Bottom-navigation shell that hosts the three main tabs.
class HomeShell extends StatefulWidget {
const HomeShell({super.key});
@override
State<HomeShell> createState() => _HomeShellState();
}
class _HomeShellState extends State<HomeShell> {
int _currentIndex = 0;
final _collectionsKey = GlobalKey<CollectionsScreenState>();
final _scanKey = GlobalKey<ScanTabState>();
late final List<Widget> _pages = <Widget>[
CollectionsScreen(key: _collectionsKey),
ScanTab(key: _scanKey),
const ProfileScreen(),
];
void _onTabSelected(int i) {
setState(() => _currentIndex = i);
if (i == 0) {
_collectionsKey.currentState?.refresh();
}
if (i == 1) {
_scanKey.currentState?.refresh();
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: IndexedStack(
index: _currentIndex,
children: _pages,
),
bottomNavigationBar: NavigationBar(
selectedIndex: _currentIndex,
onDestinationSelected: _onTabSelected,
destinations: const [
NavigationDestination(
icon: Icon(Icons.collections_bookmark_outlined),
selectedIcon: Icon(Icons.collections_bookmark),
label: 'Collections',
),
NavigationDestination(
icon: Icon(Icons.qr_code_scanner_outlined),
selectedIcon: Icon(Icons.qr_code_scanner),
label: 'Scan',
),
NavigationDestination(
icon: Icon(Icons.person_outline),
selectedIcon: Icon(Icons.person),
label: 'Profile',
),
],
),
);
}
}