mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-13 21:36:42 +02:00
Added strechy appbars to all pages
This commit is contained in:
@ -12,31 +12,38 @@ class HomePage extends StatefulWidget {
|
||||
State<HomePage> createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class NavigationPageItem {
|
||||
late String title;
|
||||
late IconData icon;
|
||||
late Widget widget;
|
||||
|
||||
NavigationPageItem(this.title, this.icon, this.widget);
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage> {
|
||||
List<int> selectedIndexHistory = [];
|
||||
List<Widget> pages = [
|
||||
const AppsPage(),
|
||||
const AddAppPage(),
|
||||
const ImportExportPage(),
|
||||
const SettingsPage()
|
||||
|
||||
List<NavigationPageItem> pages = [
|
||||
NavigationPageItem('Apps', Icons.apps, const AppsPage()),
|
||||
NavigationPageItem('Add App', Icons.add, const AddAppPage()),
|
||||
NavigationPageItem(
|
||||
'Import/Export', Icons.import_export, const ImportExportPage()),
|
||||
NavigationPageItem('Settings', Icons.settings, const SettingsPage())
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(title: const Text('Obtainium')),
|
||||
body: pages.elementAt(
|
||||
selectedIndexHistory.isEmpty ? 0 : selectedIndexHistory.last),
|
||||
body: pages
|
||||
.elementAt(
|
||||
selectedIndexHistory.isEmpty ? 0 : selectedIndexHistory.last)
|
||||
.widget,
|
||||
bottomNavigationBar: NavigationBar(
|
||||
destinations: const [
|
||||
NavigationDestination(icon: Icon(Icons.apps), label: 'Apps'),
|
||||
NavigationDestination(icon: Icon(Icons.add), label: 'Add App'),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.import_export), label: 'Import/Export'),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.settings), label: 'Settings'),
|
||||
],
|
||||
destinations: pages
|
||||
.map((e) =>
|
||||
NavigationDestination(icon: Icon(e.icon), label: e.title))
|
||||
.toList(),
|
||||
onDestinationSelected: (int index) {
|
||||
HapticFeedback.lightImpact();
|
||||
setState(() {
|
||||
|
Reference in New Issue
Block a user