Files
rasadyar_application/packages/livestock/lib/presentation/page/root/view.dart

76 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
class RootPage extends GetView<RootLogic> {
const RootPage({super.key});
@override
Widget build(BuildContext context) {
return ObxValue((currentIndex) {
return PopScope(
canPop: false,
onPopInvokedWithResult: (didPop, result) {
final navigatorKey = Get.nestedKey(currentIndex);
eLog('Pop invoked with result: $result, didPop: $didPop');
navigatorKey?.currentState?.pop();
/*eLog('Pop invoked with result: $result, didPop: $didPop');
iLog(Get.currentRoute);
iLog(Get.previousRoute);
final navigatorKey = Get.nestedKey(currentIndex);
if (currentIndex.value == 0 &&
navigatorKey != null &&
navigatorKey.currentState != null) {
if (navigatorKey.currentState!.canPop()) {
navigatorKey.currentState!.pop();
return;
}
if (!didPop) {
return;
}
}*/
},
child: Scaffold(
body: IndexedStack(
children: [...controller.pages],
index: currentIndex.value,
sizing: StackFit.expand,
),
extendBody: true,
bottomNavigationBar: BottomNavigation1(
items: [
BottomNavigation1Item(
icon: Assets.vec.filterSvg.path,
label: 'درخواست‌ها',
isSelected: currentIndex.value == 0,
onTap: () => controller.changePage(0),
),
BottomNavigation1Item(
icon: Assets.vec.mapSvg.path,
label: 'نقشه',
isSelected: currentIndex.value == 1,
onTap: () => controller.changePage(1),
),
BottomNavigation1Item(
icon: Assets.vec.profileUserSvg.path,
label: 'پروفایل',
isSelected: currentIndex.value == 2,
onTap: () => controller.changePage(2),
),
],
),
),
);
}, controller.currentIndex);
}
}