feat : profile and history action supervision

This commit is contained in:
2025-04-20 11:48:06 +03:30
parent e643a4844e
commit a7c3fa4c98
4 changed files with 283 additions and 35 deletions

View File

@@ -1,27 +1,31 @@
import 'package:get/get.dart'; import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/presentation/common/assets.dart';
class ActionLogic extends GetxController { class ActionLogic extends GetxController with GetTickerProviderStateMixin {
late Rx<SlidableController> slidController;
bool showSlideHint = true;
RxBool isExpanded = false.obs;
RxInt selectedIndex = 0.obs; RxInt selectedIndex = 0.obs;
List<String> headersTitle = [ List<String> headersTitle = [
'کاربران', 'کاربران',
'سوابق بازرسی من', 'سوابق بازرسی من',
'آمار', 'آمار',
'خروج از سامانه' 'خروج از سامانه',
]; ];
List<String> headersIcons = [ List<String> headersIcons = [
Assets.vecProfileUserSvg, Assets.vecProfileUserSvg,
Assets.vecCalendarSearchSvg, Assets.vecCalendarSearchSvg,
Assets.vecDiagramSvg, Assets.vecDiagramSvg,
Assets.vecLogoutSvg, Assets.vecLogoutSvg,
]; ];
@override
void onInit() {
super.onInit();
slidController = SlidableController(this).obs;
}
@override @override
void onReady() { void onReady() {
// TODO: implement onReady // TODO: implement onReady
@@ -33,4 +37,14 @@ class ActionLogic extends GetxController {
// TODO: implement onClose // TODO: implement onClose
super.onClose(); super.onClose();
} }
Future<void> triggerSlidableAnimation() async {
await Future.delayed(Duration(milliseconds: 200));
await slidController.value.openEndActionPane();
await Future.delayed(Duration(milliseconds: 200));
await slidController.value.close();
showSlideHint = !showSlideHint;
}
} }

View File

@@ -29,12 +29,36 @@ class ActionPage extends GetView<ActionLogic> {
}), }),
); );
}, controller.selectedIndex), }, controller.selectedIndex),
Expanded(
child: ObxValue(
(index) => switch (index.value) {
0 => profileWidget(),
1 => slidableWidgetTwo(),
2 => slidableWidgetOne(),
3 => slidableWidgetOne(),
int() => Placeholder(),
},
controller.selectedIndex,
),
),
], ],
), ),
), ),
); );
} }
Column profileWidget() {
return Column(
children: [
slidableWidgetOne(),
slidableWidgetOne(),
slidableWidgetOne(),
slidableWidgetOne(),
slidableWidgetOne(),
],
);
}
Widget headerWidget({ Widget headerWidget({
required String icon, required String icon,
required String title, required String title,
@@ -66,11 +90,243 @@ class ActionPage extends GetView<ActionLogic> {
Text( Text(
title, title,
style: AppFonts.yekan12.copyWith( style: AppFonts.yekan12.copyWith(
color: isSelected ? AppColor.blueNormalActive : AppColor.blueNormal, color:
isSelected ? AppColor.blueNormalActive : AppColor.blueNormal,
), ),
), ),
], ],
), ),
); );
} }
Widget slidableWidgetOne() {
if (controller.showSlideHint) {
controller.triggerSlidableAnimation();
}
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
child: Slidable(
key: Key('selectedLocationWidget'),
controller: controller.slidController.value,
endActionPane: ActionPane(
motion: StretchMotion(),
children: [
CustomSlidableAction(
onPressed: (context) {},
backgroundColor: AppColor.redNormal,
foregroundColor: Colors.white,
padding: EdgeInsets.all(16),
borderRadius: BorderRadius.circular(8),
autoClose: true,
child: vecWidget(Assets.vecTrashSvg, width: 24, height: 24),
),
],
),
child: GestureDetector(
onTap: () {},
child: Container(
height: 62,
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.blackLightHover),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
spacing: 4,
children: [
Text(
'داود خرم مهری پور',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'03295224154',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Column(
spacing: 4,
children: [
Text(
'افزودن کاربر',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'ثبت بازرسی',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Column(
spacing: 4,
children: [
Text(
'همدان',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'همدان',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
],
),
),
),
),
);
}
Widget slidableWidgetTwo() {
return ObxValue((data) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
child: GestureDetector(
onTap: (){
controller.isExpanded.value = !controller.isExpanded.value;
},
child: AnimatedContainer(
duration: Duration(milliseconds: 2000),
height: data.value ? 370 : 62,
child:
data.value
? Container(color: Colors.yellow,height: 80,width: 180,)
: Slidable(
key: Key('selectedLocationWidget'),
controller: controller.slidController.value,
endActionPane: ActionPane(
motion: StretchMotion(),
children: [
CustomSlidableAction(
onPressed: (context) {},
backgroundColor: AppColor.blueNormal,
foregroundColor: Colors.white,
padding: EdgeInsets.all(16),
borderRadius: BorderRadius.only(
topRight: Radius.circular(8),
bottomRight: Radius.circular(8),
),
autoClose: true,
child: vecWidget(
Assets.vecEditSvg,
width: 24,
height: 24,
),
),
CustomSlidableAction(
onPressed: (context) {},
backgroundColor: AppColor.redNormal,
foregroundColor: Colors.white,
padding: EdgeInsets.all(16),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8),
),
autoClose: true,
child: vecWidget(
Assets.vecTrashSvg,
width: 24,
height: 24,
),
),
],
),
child: GestureDetector(
onTap: () {},
child: Container(
height: 62,
padding: EdgeInsets.symmetric(
horizontal: 20,
vertical: 15,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(
width: 1,
color: AppColor.blackLightHover,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
spacing: 4,
children: [
Text(
'داود خرم مهری پور',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'03295224154',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Column(
spacing: 4,
children: [
Text(
'افزودن کاربر',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'ثبت بازرسی',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Column(
spacing: 4,
children: [
Text(
'همدان',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'همدان',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
],
),
),
),
),
),
),
);
}, controller.isExpanded);
}
} }

View File

@@ -1,6 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map_animations/flutter_map_animations.dart'; import 'package:flutter_map_animations/flutter_map_animations.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
@@ -22,6 +23,7 @@ class SupervisionFilterLogic extends GetxController
RxInt showIndex = 0.obs; RxInt showIndex = 0.obs;
bool showSlideHint = true; bool showSlideHint = true;
Rx<BottomSheetStep> bottomSheetStep = BottomSheetStep.filter.obs; Rx<BottomSheetStep> bottomSheetStep = BottomSheetStep.filter.obs;
late Rx<SlidableController> slidController; late Rx<SlidableController> slidController;

View File

@@ -2,9 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/data/utils.dart';
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart'; import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
import 'package:supervision/presentation/location_details/view.dart';
import 'package:supervision/presentation/routes/app_routes.dart'; import 'package:supervision/presentation/routes/app_routes.dart';
import 'logic.dart'; import 'logic.dart';
@@ -105,27 +103,6 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
.toList(), .toList(),
), ),
), ),
/* ObxValue((data) {
return DraggableBottomSheet(
controller: data.value,
backgroundColor:
controller.bottomSheetStep.value == BottomSheetStep.filter
? Colors.white
: AppColor.lightGreyLight,
child: ObxValue((data) {
if (data.value == BottomSheetStep.filter) {
return filterWidget();
} else if (data.value == BottomSheetStep.markerSelected) {
return selectedLocationWidget();
} else if (data.value == BottomSheetStep.markerDetails) {
return markerDetailsWidget();
} else {
return Container(height: 300, color: AppColor.blueNormal);
}
}, controller.bottomSheetStep),
);
}, controller.sheetController),*/
], ],
), ),
); );
@@ -182,7 +159,7 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
), ),
CustomSlidableAction( CustomSlidableAction(
onPressed: (context) { onPressed: (context) {
Get.toNamed(SupervisionRoutes.supervisionAddSupervision); Get.toNamed(SupervisionRoutes.supervisionAddSupervision);
}, },
backgroundColor: AppColor.greenNormal, backgroundColor: AppColor.greenNormal,
padding: EdgeInsets.all(16), padding: EdgeInsets.all(16),
@@ -468,7 +445,6 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
vecWidgetWithOnTap( vecWidgetWithOnTap(
assets: Assets.vecMapSvg, assets: Assets.vecMapSvg,
onTap: () { onTap: () {
Get.toNamed(SupervisionRoutes.supervisionLocationDetails); Get.toNamed(SupervisionRoutes.supervisionLocationDetails);
}, },
width: 24, width: 24,
@@ -481,7 +457,6 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
height: 24, height: 24,
color: AppColor.greenNormal, color: AppColor.greenNormal,
onTap: () { onTap: () {
Get.toNamed(SupervisionRoutes.supervisionAddSupervision); Get.toNamed(SupervisionRoutes.supervisionAddSupervision);
}, },
), ),
@@ -651,4 +626,5 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
), ),
); );
} }
} }