- Replace noisy no-id snackbars with in-screen red status feedback - Keep success state green and reduce interruption during scan flow - Make scan-tab collection switching session-only (does not overwrite main) - Keep main collection preselected from collections tab preference - Apply recent UX text/layout polish for scan and detail actions
65 lines
1.7 KiB
Dart
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();
|
|
} else 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',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|