feat : profile and history action supervision
This commit is contained in:
@@ -1,27 +1,31 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rasadyar_core/presentation/common/assets.dart';
|
||||
import 'package:rasadyar_core/core.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;
|
||||
|
||||
List<String> headersTitle = [
|
||||
'کاربران',
|
||||
'سوابق بازرسی من',
|
||||
'آمار',
|
||||
'خروج از سامانه'
|
||||
|
||||
'خروج از سامانه',
|
||||
];
|
||||
|
||||
|
||||
List<String> headersIcons = [
|
||||
Assets.vecProfileUserSvg,
|
||||
Assets.vecCalendarSearchSvg,
|
||||
Assets.vecDiagramSvg,
|
||||
Assets.vecLogoutSvg,
|
||||
|
||||
|
||||
];
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
slidController = SlidableController(this).obs;
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
@@ -33,4 +37,14 @@ class ActionLogic extends GetxController {
|
||||
// TODO: implement 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,12 +29,36 @@ class ActionPage extends GetView<ActionLogic> {
|
||||
}),
|
||||
);
|
||||
}, 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({
|
||||
required String icon,
|
||||
required String title,
|
||||
@@ -66,11 +90,243 @@ class ActionPage extends GetView<ActionLogic> {
|
||||
Text(
|
||||
title,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/animation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:flutter_map_animations/flutter_map_animations.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
@@ -22,6 +23,7 @@ class SupervisionFilterLogic extends GetxController
|
||||
RxInt showIndex = 0.obs;
|
||||
bool showSlideHint = true;
|
||||
|
||||
|
||||
Rx<BottomSheetStep> bottomSheetStep = BottomSheetStep.filter.obs;
|
||||
late Rx<SlidableController> slidController;
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:latlong2/latlong.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:supervision/presentation/location_details/view.dart';
|
||||
import 'package:supervision/presentation/routes/app_routes.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
@@ -105,27 +103,6 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
||||
.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),*/
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -468,7 +445,6 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
||||
vecWidgetWithOnTap(
|
||||
assets: Assets.vecMapSvg,
|
||||
onTap: () {
|
||||
|
||||
Get.toNamed(SupervisionRoutes.supervisionLocationDetails);
|
||||
},
|
||||
width: 24,
|
||||
@@ -481,7 +457,6 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
||||
height: 24,
|
||||
color: AppColor.greenNormal,
|
||||
onTap: () {
|
||||
|
||||
Get.toNamed(SupervisionRoutes.supervisionAddSupervision);
|
||||
},
|
||||
),
|
||||
@@ -651,4 +626,5 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user