56 lines
1.5 KiB
Dart
56 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:isipiringku/pages/home/beranda/beranda_tab.dart';
|
|
import 'package:isipiringku/pages/home/kalori/kalori_tab.dart';
|
|
import 'package:isipiringku/pages/home/profile/profile_tab.dart';
|
|
import 'package:isipiringku/pages/home/riwayat/riwayat_tab.dart';
|
|
|
|
class HomePage extends StatefulWidget {
|
|
@override
|
|
_HomePageState createState() => _HomePageState();
|
|
}
|
|
|
|
class _HomePageState extends State<HomePage> {
|
|
int _currentIndex = 0;
|
|
final List<Widget> _tabs = [
|
|
BerandaTab(),
|
|
KaloriTab(),
|
|
RiwayatTab(),
|
|
ProfileTab(),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: _tabs[_currentIndex],
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
currentIndex: _currentIndex,
|
|
onTap: (index) {
|
|
setState(() {
|
|
_currentIndex = index;
|
|
});
|
|
},
|
|
selectedItemColor: Colors.deepOrange,
|
|
unselectedItemColor: Colors.deepOrange,
|
|
items: [
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.home),
|
|
label: 'Beranda',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.calculate),
|
|
label: 'Kalori',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.history),
|
|
label: 'Riwayat',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.person),
|
|
label: 'Profile',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|