82 lines
2.4 KiB
Dart
82 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:skripsi/config/theme.dart';
|
|
import 'package:skripsi/view/data_testing_page.dart';
|
|
import 'package:skripsi/view/data_training_page.dart';
|
|
import 'package:skripsi/view/patroli_page.dart';
|
|
import 'package:skripsi/view/profile_page.dart';
|
|
|
|
class HomePage extends StatefulWidget {
|
|
const HomePage({super.key});
|
|
|
|
@override
|
|
State<HomePage> createState() => _HomePageState();
|
|
}
|
|
|
|
class _HomePageState extends State<HomePage> {
|
|
int _selectedIndex = 0;
|
|
|
|
final List<Widget> _widgetHome = <Widget>[
|
|
const PatroliPage(),
|
|
const TestingPage(),
|
|
const TrainingPage(),
|
|
const ProfilePage(),
|
|
];
|
|
|
|
void itemSelected(int index) {
|
|
setState(() {
|
|
_selectedIndex = index;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: SafeArea(
|
|
child: Stack(
|
|
children: [
|
|
Center(
|
|
child: _widgetHome.elementAt(_selectedIndex),
|
|
),
|
|
Align(
|
|
alignment: Alignment.bottomCenter,
|
|
child: SizedBox(
|
|
width: 360.w,
|
|
height: 60.h,
|
|
child: ClipRect(
|
|
child: BottomNavigationBar(
|
|
unselectedItemColor: blackColor,
|
|
showSelectedLabels: true,
|
|
items: const <BottomNavigationBarItem>[
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.home_outlined),
|
|
label: 'Home',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.assessment_outlined),
|
|
label: 'Testing',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.assessment_outlined),
|
|
label: 'Training',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.account_balance),
|
|
label: 'Profile',
|
|
),
|
|
],
|
|
backgroundColor: secondaryColor,
|
|
currentIndex: _selectedIndex,
|
|
selectedItemColor: primaryColor,
|
|
onTap: itemSelected,
|
|
iconSize: 16.w,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
)),
|
|
);
|
|
}
|
|
}
|