2023-06-26 23:40:05 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2023-07-10 17:32:14 +02:00
|
|
|
import 'package:shlink_app/SettingsView.dart';
|
2023-06-26 23:40:05 +02:00
|
|
|
import 'package:shlink_app/HomeView.dart';
|
|
|
|
import 'package:shlink_app/URLListView.dart';
|
|
|
|
|
|
|
|
class NavigationBarView extends StatefulWidget {
|
|
|
|
const NavigationBarView({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<NavigationBarView> createState() => _NavigationBarViewState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _NavigationBarViewState extends State<NavigationBarView> {
|
|
|
|
|
2023-07-10 17:32:14 +02:00
|
|
|
final List<Widget> views = [HomeView(), URLListView(), SettingsView()];
|
2023-06-26 23:40:05 +02:00
|
|
|
int _selectedView = 0;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
2023-07-09 23:00:00 +02:00
|
|
|
body: views.elementAt(_selectedView),
|
2023-06-26 23:40:05 +02:00
|
|
|
bottomNavigationBar: NavigationBar(
|
|
|
|
destinations: [
|
|
|
|
NavigationDestination(icon: Icon(Icons.home), label: "Home"),
|
2023-07-10 17:32:14 +02:00
|
|
|
NavigationDestination(icon: Icon(Icons.link), label: "Short URLs"),
|
|
|
|
NavigationDestination(icon: Icon(Icons.settings), label: "Settings")
|
2023-06-26 23:40:05 +02:00
|
|
|
],
|
|
|
|
selectedIndex: _selectedView,
|
|
|
|
onDestinationSelected: (int index) {
|
|
|
|
setState(() {
|
|
|
|
_selectedView = index;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|