87 lines
2.7 KiB
Dart
87 lines
2.7 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,
|
|
),
|
|
|
|
bottomNavigationBar: RBottomNavigation(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
items: [
|
|
RBottomNavigationItem(
|
|
label: 'نقشه',
|
|
icon: Assets.vec.mapSvg.path,
|
|
isSelected: currentIndex.value == 0,
|
|
onTap: () {
|
|
Get.nestedKey(1)?.currentState?.popUntil((route) => route.isFirst);
|
|
controller.changePage(0);
|
|
},
|
|
),
|
|
RBottomNavigationItem(
|
|
label: 'درخواستها',
|
|
icon: Assets.vec.settingSvg.path,
|
|
isSelected: currentIndex.value == 1,
|
|
onTap: () {
|
|
Get.nestedKey(0)?.currentState?.popUntil((route) => route.isFirst);
|
|
controller.changePage(1);
|
|
},
|
|
),
|
|
|
|
RBottomNavigationItem(
|
|
label: 'پروفایل',
|
|
icon: Assets.vec.profileCircleSvg.path,
|
|
isSelected: currentIndex.value == 2,
|
|
onTap: () {
|
|
Get.nestedKey(1)?.currentState?.popUntil((route) => route.isFirst);
|
|
Get.nestedKey(0)?.currentState?.popUntil((route) => route.isFirst);
|
|
|
|
controller.changePage(2);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}, controller.currentIndex);
|
|
}
|
|
}
|