128 lines
4.1 KiB
Dart
128 lines
4.1 KiB
Dart
import 'package:absensi_qr/feature_teacher/navigation/presentation/navigation_teacher_controller.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:absensi_qr/constant/app_color.dart';
|
|
import 'package:absensi_qr/constant/app_font_style.dart';
|
|
|
|
class NavigationTeacherPage extends StatelessWidget {
|
|
const NavigationTeacherPage({super.key});
|
|
|
|
Widget _buildNavItem({
|
|
required NavigationTeacherController controller,
|
|
required int index,
|
|
IconData? icon,
|
|
required String label,
|
|
}) {
|
|
final bool isActive = controller.currentIndex.value == index;
|
|
|
|
return GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () => index != -1 ? controller.changePage(index) : null,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 2),
|
|
child: isActive
|
|
? Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
icon != null
|
|
? Icon(icon, color: AppColor.primaryColor)
|
|
: SizedBox
|
|
.shrink(), // Placeholder for spacing when no icon
|
|
Text(
|
|
label,
|
|
style: AppFontStyle.smallText
|
|
.copyWith(color: AppColor.primaryColor),
|
|
),
|
|
],
|
|
)
|
|
: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
icon != null
|
|
? Icon(icon, color: AppColor.colorOutlineBoxinput)
|
|
: SizedBox(
|
|
height: 24,
|
|
), // Placeholder for spacing when no icon
|
|
Text(
|
|
label,
|
|
style: AppFontStyle.smallText
|
|
.copyWith(color: AppColor.colorOutlineBoxinput),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final NavigationTeacherController controller =
|
|
Get.find<NavigationTeacherController>();
|
|
|
|
return Scaffold(
|
|
body: SafeArea(
|
|
child: Obx(() => controller.pages[controller.currentIndex.value]),
|
|
),
|
|
bottomNavigationBar: Obx(
|
|
() => SizedBox(
|
|
height: 100,
|
|
child: Container(
|
|
decoration: const BoxDecoration(
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black26,
|
|
blurRadius: 4,
|
|
),
|
|
],
|
|
),
|
|
child: BottomAppBar(
|
|
color: Colors.white,
|
|
shape: null,
|
|
elevation: 6,
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(left: 4, right: 4, bottom: 12),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
_buildNavItem(
|
|
controller: controller,
|
|
index: 0,
|
|
icon: Icons.home,
|
|
label: 'Home',
|
|
),
|
|
_buildNavItem(
|
|
controller: controller,
|
|
index: 1,
|
|
icon: Icons.event_note,
|
|
label: 'Perizinan',
|
|
),
|
|
_buildNavItem(
|
|
controller: controller,
|
|
index: 2,
|
|
icon: Icons.restore,
|
|
label: 'Presensi',
|
|
),
|
|
_buildNavItem(
|
|
controller: controller,
|
|
index: 3,
|
|
icon: Icons.assignment,
|
|
label: 'Aktivitas',
|
|
),
|
|
// SpacingSize.spacingHugeWidth,
|
|
_buildNavItem(
|
|
controller: controller,
|
|
index: 4,
|
|
icon: Icons.person,
|
|
label: 'Profile',
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|