feat : new main page inspection
This commit is contained in:
@@ -8,168 +8,49 @@ class RootPage extends GetView<RootLogic> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
ObxValue((errorType) {
|
||||
if (errorType.isNotEmpty) {
|
||||
if (errorType.contains(ErrorLocationType.serviceDisabled)) {
|
||||
Future.microtask(() {
|
||||
Get.defaultDialog(
|
||||
title: 'خطا',
|
||||
content: const Text('سرویس مکانیابی غیرفعال است'),
|
||||
cancel: ROutlinedElevated(
|
||||
text: 'بررسی مجدد',
|
||||
width: 120,
|
||||
textStyle: AppFonts.yekan16,
|
||||
onPressed: () async {
|
||||
var service = await controller.locationServiceEnabled();
|
||||
eLog(service);
|
||||
if (service) {
|
||||
controller.errorLocationType.remove(
|
||||
ErrorLocationType.serviceDisabled,
|
||||
);
|
||||
Get.back();
|
||||
}
|
||||
// Don't call Get.back() if service is still disabled
|
||||
},
|
||||
),
|
||||
confirm: RElevated(
|
||||
text: 'روشن کردن',
|
||||
textStyle: AppFonts.yekan16,
|
||||
width: 120,
|
||||
onPressed: () async {
|
||||
var res = await Geolocator.openLocationSettings();
|
||||
if (res) {
|
||||
var service =
|
||||
await controller.locationServiceEnabled();
|
||||
if (service) {
|
||||
controller.errorLocationType.remove(
|
||||
ErrorLocationType.serviceDisabled,
|
||||
);
|
||||
Get.back();
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
return ObxValue((currentIndex) {
|
||||
return Scaffold(
|
||||
body: ObxValue(
|
||||
(currentIndex) => IndexedStack(index: currentIndex.value, children: controller.pages),
|
||||
controller.currentIndex,
|
||||
),
|
||||
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);
|
||||
|
||||
contentPadding: EdgeInsets.all(8),
|
||||
onWillPop: () async {
|
||||
return controller.errorLocationType.isEmpty;
|
||||
},
|
||||
barrierDismissible: false,
|
||||
);
|
||||
});
|
||||
} else {
|
||||
Future.microtask(() {
|
||||
Get.defaultDialog(
|
||||
title: 'خطا',
|
||||
content: const Text(
|
||||
' دسترسی به سرویس مکانیابی غیرفعال است',
|
||||
),
|
||||
cancel: ROutlinedElevated(
|
||||
text: 'بررسی مجدد',
|
||||
width: 120,
|
||||
textStyle: AppFonts.yekan16,
|
||||
onPressed: () async {
|
||||
await controller.checkPermission();
|
||||
},
|
||||
),
|
||||
confirm: RElevated(
|
||||
text: 'اجازه دادن',
|
||||
textStyle: AppFonts.yekan16,
|
||||
width: 120,
|
||||
onPressed: () async {
|
||||
var res = await controller.checkPermission(
|
||||
request: true,
|
||||
);
|
||||
if (res) {
|
||||
controller.errorLocationType.remove(
|
||||
ErrorLocationType.permissionDenied,
|
||||
);
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
),
|
||||
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);
|
||||
},
|
||||
),
|
||||
|
||||
contentPadding: EdgeInsets.all(8),
|
||||
onWillPop: () async {
|
||||
return controller.errorLocationType.isEmpty;
|
||||
},
|
||||
barrierDismissible: false,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
}, controller.errorLocationType),
|
||||
RBottomNavigationItem(
|
||||
label: 'پروفایل',
|
||||
icon: Assets.vec.profileCircleSvg.path,
|
||||
isSelected: currentIndex.value == 4,
|
||||
onTap: () {
|
||||
Get.nestedKey(1)?.currentState?.popUntil((route) => route.isFirst);
|
||||
Get.nestedKey(0)?.currentState?.popUntil((route) => route.isFirst);
|
||||
|
||||
ObxValue(
|
||||
(currentIndex) => IndexedStack(
|
||||
index: currentIndex.value,
|
||||
children: controller.pages,
|
||||
controller.changePage(4);
|
||||
},
|
||||
),
|
||||
controller.currentIndex,
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: WaveBottomNavigation(
|
||||
items: [
|
||||
WaveBottomNavigationItem(title: 'خانه', icon: Assets.vec.mapSvg.svg(
|
||||
width: 32,
|
||||
height: 32,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
)),
|
||||
WaveBottomNavigationItem(
|
||||
title: 'عملیات',
|
||||
icon: Assets.vec.userSvg.svg(
|
||||
width: 32,
|
||||
height: 32,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
WaveBottomNavigationItem(
|
||||
title: 'افزودن',
|
||||
icon: Assets.vec.addSvg.svg(
|
||||
width: 32,
|
||||
height: 32,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
WaveBottomNavigationItem(
|
||||
title: 'آمار',
|
||||
icon: Assets.vec.diagramSvg.svg(width: 32,height: 32,colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),),
|
||||
),
|
||||
WaveBottomNavigationItem(
|
||||
title: 'تماس',
|
||||
icon: Assets.vec.callSvg.svg(
|
||||
width: 32,
|
||||
height: 32,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
WaveBottomNavigationItem(
|
||||
title: 'مکان ',
|
||||
icon: Assets.vec.gpsSvg.svg(
|
||||
width: 32,
|
||||
height: 32,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
WaveBottomNavigationItem(
|
||||
title: 'تاریخ',
|
||||
icon: Assets.vec.calendarSvg.svg(
|
||||
width: 32,
|
||||
height: 32,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
],
|
||||
onPageChanged: (index) {
|
||||
controller.changePage(index);
|
||||
},
|
||||
),
|
||||
);
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user