TKK-E32222355/lib/widgets/costum_button.dart

57 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import '../../screens/dashboard/dashboard_screen.dart';
import '../../screens/history/history_screen.dart';
import '../../screens/billing/billing_screen.dart';
class CustomBottomNav extends StatefulWidget {
const CustomBottomNav({super.key});
@override
State<CustomBottomNav> createState() => _CustomBottomNavState();
}
class _CustomBottomNavState extends State<CustomBottomNav> {
int _currentIndex = 0;
final List<Widget> _screens = const [
DashboardScreen(),
HistoryScreen(),
BillingScreen(),
];
void _onTap(int index) {
setState(() {
_currentIndex = index;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: _screens[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex,
onTap: _onTap,
selectedItemColor: Colors.blueAccent,
unselectedItemColor: Colors.grey,
backgroundColor: Colors.white,
type: BottomNavigationBarType.fixed,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.dashboard),
label: 'Dashboard',
),
BottomNavigationBarItem(
icon: Icon(Icons.history),
label: 'Riwayat',
),
BottomNavigationBarItem(
icon: Icon(Icons.receipt_long),
label: 'Tagihan',
),
],
),
);
}
}