43 lines
922 B
Dart
43 lines
922 B
Dart
import 'package:flutter/material.dart';
|
|
import 'dashboard_screen.dart';
|
|
import 'location_screen.dart';
|
|
import 'settings_screen.dart';
|
|
import '../widgets/bottom_navbar.dart';
|
|
|
|
class MainScreen extends StatefulWidget {
|
|
const MainScreen({super.key});
|
|
|
|
@override
|
|
State<MainScreen> createState() => _MainScreenState();
|
|
}
|
|
|
|
class _MainScreenState extends State<MainScreen> {
|
|
int _currentIndex = 1; // Monitoring di tengah
|
|
|
|
final List<Widget> _screens = const [
|
|
LocationScreen(),
|
|
DashboardScreen(),
|
|
SettingsScreen(),
|
|
];
|
|
|
|
void onTabTapped(int index) {
|
|
setState(() {
|
|
_currentIndex = index;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: IndexedStack(
|
|
index: _currentIndex,
|
|
children: _screens,
|
|
),
|
|
bottomNavigationBar: BottomNavbar(
|
|
currentIndex: _currentIndex,
|
|
onTap: onTabTapped,
|
|
),
|
|
);
|
|
}
|
|
}
|