43 lines
1.2 KiB
Dart
43 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:sigap/src/features/panic/presentation/pages/panic_button_page.dart';
|
|
import 'package:sigap/src/shared/widgets/navigation/custom_bottom_navigation_bar.dart';
|
|
|
|
class NavigationMenu extends StatelessWidget {
|
|
const NavigationMenu({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// Using GetX controller to manage navigation state
|
|
final controller = Get.put(NavigationController());
|
|
|
|
return Scaffold(
|
|
body: Obx(
|
|
() => IndexedStack(
|
|
index: controller.selectedIndex.value,
|
|
children: const [
|
|
// HomePage(),
|
|
// SearchPage(),
|
|
PanicButtonPage(),
|
|
// HistoryPage(),
|
|
// AccountPage(),
|
|
],
|
|
),
|
|
),
|
|
bottomNavigationBar: const CustomBottomNavigationBar(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class NavigationController extends GetxController {
|
|
static NavigationController get instance => Get.find();
|
|
|
|
// Observable variable to track the current selected index
|
|
final Rx<int> selectedIndex = 2.obs; // Start with PanicButtonPage (index 2)
|
|
|
|
// Method to change selected index
|
|
void changeIndex(int index) {
|
|
selectedIndex.value = index;
|
|
}
|
|
}
|