From a7c3fa4c989437ed4ab9554ceaf599983f1402aa Mon Sep 17 00:00:00 2001 From: "mr.mojtaba" Date: Sun, 20 Apr 2025 11:48:06 +0330 Subject: [PATCH] feat : profile and history action supervision --- .../lib/presentation/action/logic.dart | 30 +- .../lib/presentation/action/view.dart | 258 +++++++++++++++++- .../lib/presentation/filter/logic.dart | 2 + .../lib/presentation/filter/view.dart | 28 +- 4 files changed, 283 insertions(+), 35 deletions(-) diff --git a/features/supervision/lib/presentation/action/logic.dart b/features/supervision/lib/presentation/action/logic.dart index 33d2701..f9cdbce 100644 --- a/features/supervision/lib/presentation/action/logic.dart +++ b/features/supervision/lib/presentation/action/logic.dart @@ -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 slidController; + bool showSlideHint = true; + RxBool isExpanded = false.obs; RxInt selectedIndex = 0.obs; List headersTitle = [ 'کاربران', 'سوابق بازرسی من', 'آمار', - 'خروج از سامانه' - + 'خروج از سامانه', ]; - List 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 triggerSlidableAnimation() async { + await Future.delayed(Duration(milliseconds: 200)); + await slidController.value.openEndActionPane(); + await Future.delayed(Duration(milliseconds: 200)); + await slidController.value.close(); + showSlideHint = !showSlideHint; + } + } diff --git a/features/supervision/lib/presentation/action/view.dart b/features/supervision/lib/presentation/action/view.dart index 239ba02..9f58b3f 100644 --- a/features/supervision/lib/presentation/action/view.dart +++ b/features/supervision/lib/presentation/action/view.dart @@ -29,12 +29,36 @@ class ActionPage extends GetView { }), ); }, 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 { 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); + } } diff --git a/features/supervision/lib/presentation/filter/logic.dart b/features/supervision/lib/presentation/filter/logic.dart index 2eaec13..4818aaa 100644 --- a/features/supervision/lib/presentation/filter/logic.dart +++ b/features/supervision/lib/presentation/filter/logic.dart @@ -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.filter.obs; late Rx slidController; diff --git a/features/supervision/lib/presentation/filter/view.dart b/features/supervision/lib/presentation/filter/view.dart index 16fefd7..0c6147a 100644 --- a/features/supervision/lib/presentation/filter/view.dart +++ b/features/supervision/lib/presentation/filter/view.dart @@ -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 { .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 { ), CustomSlidableAction( onPressed: (context) { - Get.toNamed(SupervisionRoutes.supervisionAddSupervision); + Get.toNamed(SupervisionRoutes.supervisionAddSupervision); }, backgroundColor: AppColor.greenNormal, padding: EdgeInsets.all(16), @@ -468,7 +445,6 @@ class SupervisionFilterPage extends GetView { vecWidgetWithOnTap( assets: Assets.vecMapSvg, onTap: () { - Get.toNamed(SupervisionRoutes.supervisionLocationDetails); }, width: 24, @@ -481,7 +457,6 @@ class SupervisionFilterPage extends GetView { height: 24, color: AppColor.greenNormal, onTap: () { - Get.toNamed(SupervisionRoutes.supervisionAddSupervision); }, ), @@ -651,4 +626,5 @@ class SupervisionFilterPage extends GetView { ), ); } + }