69 lines
1.3 KiB
Dart
69 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'home_screen.dart';
|
|
import 'riwayat_screen.dart';
|
|
import 'graph_screen.dart';
|
|
import 'dashboard_info_screen.dart';
|
|
|
|
class DashboardScreen extends StatefulWidget {
|
|
const DashboardScreen({super.key});
|
|
|
|
@override
|
|
State<DashboardScreen> createState() => _DashboardScreenState();
|
|
}
|
|
|
|
class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
int selectedIndex = 0;
|
|
|
|
final List<Widget> pages = const [
|
|
DashboardInfoScreen(),
|
|
HomeScreen(),
|
|
RiwayatScreen(),
|
|
GraphScreen(),
|
|
];
|
|
|
|
void onItemTapped(int index){
|
|
setState(() {
|
|
selectedIndex = index;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
body: pages[selectedIndex],
|
|
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
currentIndex: selectedIndex,
|
|
onTap: onItemTapped,
|
|
type: BottomNavigationBarType.fixed,
|
|
|
|
items: const [
|
|
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.dashboard),
|
|
label: "Dashboard",
|
|
),
|
|
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.home),
|
|
label: "Monitoring",
|
|
),
|
|
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.history),
|
|
label: "Riwayat",
|
|
),
|
|
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.show_chart),
|
|
label: "Grafik",
|
|
),
|
|
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |