2023-11-14 15:28:14 -04:00
|
|
|
import 'package:flutter/material.dart';
|
2023-10-03 13:00:59 -04:00
|
|
|
import 'package:recon/widgets/friends/friends_list.dart';
|
|
|
|
import 'package:recon/widgets/friends/friends_list_app_bar.dart';
|
|
|
|
import 'package:recon/widgets/inventory/inventory_browser.dart';
|
|
|
|
import 'package:recon/widgets/inventory/inventory_browser_app_bar.dart';
|
|
|
|
import 'package:recon/widgets/sessions/session_list.dart';
|
|
|
|
import 'package:recon/widgets/sessions/session_list_app_bar.dart';
|
|
|
|
import 'package:recon/widgets/settings_app_bar.dart';
|
|
|
|
import 'package:recon/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 = [
|
|
|
|
FriendsListAppBar(),
|
|
|
|
SessionListAppBar(),
|
|
|
|
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 [
|
|
|
|
FriendsList(),
|
|
|
|
SessionList(),
|
|
|
|
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.message),
|
|
|
|
label: "Chat",
|
|
|
|
),
|
2023-09-30 09:22:37 -04:00
|
|
|
NavigationDestination(
|
2023-09-29 10:24:26 -04:00
|
|
|
icon: Icon(Icons.public),
|
|
|
|
label: "Sessions",
|
|
|
|
),
|
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
|
|
|
}
|