54 lines
1.3 KiB
Dart
54 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'me_view.dart';
|
|
import 'devices_view.dart';
|
|
import 'last_heard_view.dart';
|
|
import 'more_view.dart';
|
|
|
|
class MainView extends StatefulWidget {
|
|
const MainView({super.key});
|
|
|
|
@override
|
|
State<MainView> createState() => _MainViewState();
|
|
}
|
|
|
|
class _MainViewState extends State<MainView> {
|
|
int _selectedIndex = 0;
|
|
|
|
final List<Widget> _views = const [
|
|
MeView(),
|
|
DevicesView(),
|
|
LastHeardView(),
|
|
MoreView(),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: _views[_selectedIndex],
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
type: BottomNavigationBarType.fixed,
|
|
currentIndex: _selectedIndex,
|
|
onTap: (index) => setState(() => _selectedIndex = index),
|
|
items: const [
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.person),
|
|
label: 'Me',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.devices),
|
|
label: 'Devices',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.history),
|
|
label: 'Last Activity',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.more_horiz),
|
|
label: 'More',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|