From d4ebefedba9f182877b34d9409954ed402b1441e Mon Sep 17 00:00:00 2001 From: "mr.mojtaba" Date: Mon, 21 Apr 2025 07:30:14 +0330 Subject: [PATCH] feat : action add supervisons --- .../lib/presentation/actions/logic.dart | 15 ++ .../lib/presentation/actions/view.dart | 209 ++++++++++++++++++ .../lib/presentation/rds/logic.dart | 5 + .../lib/presentation/rds/view.dart | 15 ++ 4 files changed, 244 insertions(+) create mode 100644 features/supervision/lib/presentation/actions/logic.dart create mode 100644 features/supervision/lib/presentation/actions/view.dart create mode 100644 features/supervision/lib/presentation/rds/logic.dart create mode 100644 features/supervision/lib/presentation/rds/view.dart diff --git a/features/supervision/lib/presentation/actions/logic.dart b/features/supervision/lib/presentation/actions/logic.dart new file mode 100644 index 0000000..e79eb8e --- /dev/null +++ b/features/supervision/lib/presentation/actions/logic.dart @@ -0,0 +1,15 @@ +import 'package:rasadyar_core/core.dart'; + +class ActionsLogic extends GetxController with GetTickerProviderStateMixin{ + + RxInt currentIndex = 0.obs; + late Rx slidController; + @override + void onInit() { + + super.onInit(); + slidController = SlidableController(this).obs; + } + +} + diff --git a/features/supervision/lib/presentation/actions/view.dart b/features/supervision/lib/presentation/actions/view.dart new file mode 100644 index 0000000..766b00e --- /dev/null +++ b/features/supervision/lib/presentation/actions/view.dart @@ -0,0 +1,209 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; +import 'package:supervision/presentation/actions/logic.dart'; + +class ActionsPage extends GetView { + const ActionsPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: Column( + children: [ + SizedBox(height: 10), + ObxValue((data) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + cardActionWidget( + title: 'کاربران', + onPressed: () { + controller.currentIndex.value = 0; + }, + icon: Assets.vecProfileUserSvg, + selected: data.value == 0, + ), + cardActionWidget( + title: 'سوابق بازرسی من', + onPressed: () { + controller.currentIndex.value = 1; + }, + icon: Assets.vecCalendarSearchSvg, + selected: data.value == 1, + ), + cardActionWidget( + title: 'آمار', + onPressed: () { + controller.currentIndex.value = 2; + }, + icon: Assets.vecDiagramSvg, + selected: data.value == 2, + ), + cardActionWidget( + title: 'خروج از سامانه', + onPressed: () { + controller.currentIndex.value = 3; + }, + icon: Assets.vecLogoutSvg, + selected: data.value == 3, + ), + ], + ); + }, controller.currentIndex), + SizedBox(height: 20), + Expanded( + child: Column( + spacing: 13, + children: [ + selectedLocationWidget(), + selectedLocationWidget(), + selectedLocationWidget(), + ], + ), + ), + ], + ), + ), + ); + } + + Widget selectedLocationWidget() { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 30), + child: Slidable( + key: Key('selectedLocationWidget'), + controller: controller.slidController.value, + endActionPane: ActionPane( + motion: StretchMotion(), + children: [ + CustomSlidableAction( + onPressed: (context) {}, + backgroundColor: AppColor.redNormal, + foregroundColor: AppColor.whiteLight, + padding: EdgeInsets.all(16), + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(8), + topRight: Radius.circular(8), + ), + child: vecWidget(Assets.vecTrashSvg, width: 24, height: 24), + ), + ], + ), + child: GestureDetector( + onTap: () {}, + child: Container( + height: 58, + alignment: AlignmentDirectional.center, + padding: EdgeInsets.symmetric(horizontal: 20), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + border: Border.all(width: 1, color: AppColor.blackLightHover), + ), + + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + spacing: 4, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'داود خرم مهری پور', + style: AppFonts.yekan10.copyWith( + color: AppColor.blueNormal, + ), + ), + Text( + '03295224154', + style: AppFonts.yekan12.copyWith( + color: AppColor.darkGreyDarkHover, + ), + ), + ], + ), + Column( + spacing: 4, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'باقی مانده', + style: AppFonts.yekan10.copyWith( + color: AppColor.blueNormal, + ), + ), + Text( + '0 کیلوگرم', + style: AppFonts.yekan12.copyWith( + color: AppColor.darkGreyDarkHover, + ), + ), + ], + ), + Column( + spacing: 4, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'باقی مانده', + style: AppFonts.yekan10.copyWith( + color: AppColor.blueNormal, + ), + ), + Text( + '0 کیلوگرم', + style: AppFonts.yekan12.copyWith( + color: AppColor.darkGreyDarkHover, + ), + ), + ], + ), + ], + ), + ), + ), + ), + ); + } +} + +Widget cardActionWidget({ + required String title, + required VoidCallback onPressed, + required String icon, + bool selected = false, +}) { + return GestureDetector( + onTap: onPressed, + child: Column( + children: [ + Container( + width: 48, + height: 48, + padding: EdgeInsets.all(4), + decoration: ShapeDecoration( + color: selected ? AppColor.blueLightActive : AppColor.blueLight, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + child: vecWidget( + icon, + width: 40, + height: 40, + color: selected ? AppColor.blueNormalActive : AppColor.blueNormal, + ), + ), + SizedBox(height: 2), + Text( + title, + style: AppFonts.yekan10.copyWith( + color: selected ? AppColor.blueNormal : AppColor.blueLightActive, + ), + ), + ], + ), + ); +} diff --git a/features/supervision/lib/presentation/rds/logic.dart b/features/supervision/lib/presentation/rds/logic.dart new file mode 100644 index 0000000..939a067 --- /dev/null +++ b/features/supervision/lib/presentation/rds/logic.dart @@ -0,0 +1,5 @@ +import 'package:get/get.dart'; + +class RdsLogic extends GetxController { + +} diff --git a/features/supervision/lib/presentation/rds/view.dart b/features/supervision/lib/presentation/rds/view.dart new file mode 100644 index 0000000..f620eb5 --- /dev/null +++ b/features/supervision/lib/presentation/rds/view.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import 'logic.dart'; + +class RdsPage extends StatelessWidget { + RdsPage({Key? key}) : super(key: key); + + final RdsLogic logic = Get.put(RdsLogic()); + + @override + Widget build(BuildContext context) { + return Container(); + } +}