56 lines
1.5 KiB
Dart
56 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../history/history_screen.dart';
|
|
import '../home/home_screen.dart';
|
|
import '../profile/profile_screen.dart';
|
|
|
|
/// Root shell: bottom tabs **Home**, **History**, **Profile** (English labels).
|
|
class MainScreen extends StatefulWidget {
|
|
const MainScreen({super.key});
|
|
|
|
@override
|
|
State<MainScreen> createState() => _MainScreenState();
|
|
}
|
|
|
|
class _MainScreenState extends State<MainScreen> {
|
|
int _index = 0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: IndexedStack(
|
|
index: _index,
|
|
children: [
|
|
const HomeScreen(),
|
|
HistoryScreen(
|
|
isRootTab: true,
|
|
isTabSelected: _index == 1,
|
|
),
|
|
const ProfileScreen(isRootTab: true),
|
|
],
|
|
),
|
|
bottomNavigationBar: NavigationBar(
|
|
selectedIndex: _index,
|
|
onDestinationSelected: (i) => setState(() => _index = i),
|
|
destinations: const [
|
|
NavigationDestination(
|
|
icon: Icon(Icons.home_outlined),
|
|
selectedIcon: Icon(Icons.home_rounded),
|
|
label: 'Home',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.history_outlined),
|
|
selectedIcon: Icon(Icons.history_rounded),
|
|
label: 'History',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.person_outline_rounded),
|
|
selectedIcon: Icon(Icons.person_rounded),
|
|
label: 'Profile',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|