61 lines
1.5 KiB
Dart
61 lines
1.5 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
|
import 'package:ta_tahsin/core/theme.dart';
|
|
import 'package:ta_tahsin/view/home/quiz/quiz.dart';
|
|
|
|
import '../../view/home/belajar/belajar.dart';
|
|
import '../../view/home/profile/profile.dart';
|
|
import '../../view/home/ujian/ujian.dart';
|
|
|
|
|
|
class NavigationPage extends StatefulWidget {
|
|
const NavigationPage({super.key});
|
|
|
|
@override
|
|
// ignore: library_private_types_in_public_api
|
|
_NavigationPageState createState() => _NavigationPageState();
|
|
}
|
|
|
|
class _NavigationPageState extends State<NavigationPage> {
|
|
int _selectedIndex = 0;
|
|
|
|
final List<Widget> _pages = [
|
|
const BelajarPage(),
|
|
const QuizPage(),
|
|
const ProfilePage(),
|
|
];
|
|
|
|
void _onItemTapped(int index) {
|
|
setState(() {
|
|
_selectedIndex = index;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: _pages[_selectedIndex],
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
currentIndex: _selectedIndex,
|
|
selectedItemColor: secondPrimaryColor,
|
|
unselectedItemColor: Colors.grey,
|
|
onTap: _onItemTapped,
|
|
items: const [
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.menu_book),
|
|
label: "Belajar",
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.quiz),
|
|
label: "Quiz",
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.person),
|
|
label: "Profile",
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|