2023-11-14 15:28:14 -04:00
|
|
|
import 'package:flutter/material.dart';
|
2024-07-15 00:23:04 -04:00
|
|
|
import 'package:OpenContacts/widgets/friends/friends_list.dart';
|
|
|
|
import 'package:OpenContacts/widgets/friends/friends_list_app_bar.dart';
|
|
|
|
import 'package:OpenContacts/widgets/inventory/inventory_browser.dart';
|
|
|
|
import 'package:OpenContacts/widgets/inventory/inventory_browser_app_bar.dart';
|
|
|
|
import 'package:OpenContacts/widgets/sessions/session_list.dart';
|
|
|
|
import 'package:OpenContacts/widgets/sessions/session_list_app_bar.dart';
|
|
|
|
import 'package:OpenContacts/widgets/settings_app_bar.dart';
|
|
|
|
import 'package:OpenContacts/widgets/settings_page.dart';
|
2023-06-17 10:58:32 -04:00
|
|
|
|
|
|
|
class Home extends StatefulWidget {
|
|
|
|
const Home({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<Home> createState() => _HomeState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _HomeState extends State<Home> {
|
|
|
|
static const List<Widget> _appBars = [
|
|
|
|
SessionListAppBar(),
|
2024-07-15 11:13:40 -04:00
|
|
|
FriendsListAppBar(),
|
2023-06-17 10:58:32 -04:00
|
|
|
InventoryBrowserAppBar(),
|
|
|
|
SettingsAppBar()
|
|
|
|
];
|
|
|
|
final PageController _pageController = PageController();
|
|
|
|
|
|
|
|
int _selectedPage = 0;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
2023-09-29 10:24:26 -04:00
|
|
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
2023-06-17 10:58:32 -04:00
|
|
|
appBar: PreferredSize(
|
|
|
|
preferredSize: const Size.fromHeight(kToolbarHeight),
|
|
|
|
child: AnimatedSwitcher(
|
|
|
|
duration: const Duration(milliseconds: 200),
|
|
|
|
child: _appBars[_selectedPage],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
body: PageView(
|
|
|
|
controller: _pageController,
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
children: const [
|
|
|
|
SessionList(),
|
2024-07-15 11:13:40 -04:00
|
|
|
FriendsList(),
|
2023-06-17 10:58:32 -04:00
|
|
|
InventoryBrowser(),
|
|
|
|
SettingsPage(),
|
|
|
|
],
|
|
|
|
),
|
2023-09-30 09:22:37 -04:00
|
|
|
bottomNavigationBar: NavigationBar(
|
|
|
|
selectedIndex: _selectedPage,
|
|
|
|
onDestinationSelected: (index) {
|
2023-09-29 10:24:26 -04:00
|
|
|
_pageController.animateToPage(
|
|
|
|
index,
|
|
|
|
duration: const Duration(milliseconds: 200),
|
|
|
|
curve: Curves.easeOut,
|
|
|
|
);
|
|
|
|
setState(() {
|
|
|
|
_selectedPage = index;
|
|
|
|
});
|
|
|
|
},
|
2023-09-30 09:22:37 -04:00
|
|
|
destinations: const [
|
|
|
|
NavigationDestination(
|
2023-09-29 10:24:26 -04:00
|
|
|
icon: Icon(Icons.public),
|
|
|
|
label: "Sessions",
|
|
|
|
),
|
2024-07-15 11:13:40 -04:00
|
|
|
NavigationDestination(
|
2024-07-25 17:02:29 -04:00
|
|
|
icon: Icon(Icons.contacts),
|
|
|
|
label: "Contacts",
|
2024-07-15 11:13:40 -04:00
|
|
|
),
|
2023-09-30 09:22:37 -04:00
|
|
|
NavigationDestination(
|
2023-09-29 10:24:26 -04:00
|
|
|
icon: Icon(Icons.inventory),
|
|
|
|
label: "Inventory",
|
|
|
|
),
|
2023-09-30 09:22:37 -04:00
|
|
|
NavigationDestination(
|
2023-09-29 10:24:26 -04:00
|
|
|
icon: Icon(Icons.settings),
|
|
|
|
label: "Settings",
|
|
|
|
),
|
|
|
|
],
|
2023-06-17 10:58:32 -04:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2023-11-14 15:28:14 -04:00
|
|
|
}
|