feat : action

add supervisons
This commit is contained in:
2025-04-19 16:50:36 +03:30
parent a413aa47ea
commit 3b693c7e60
34 changed files with 797 additions and 65 deletions

View File

@@ -3,6 +3,11 @@ import 'package:rasadyar_core/core.dart';
class AddSupervisionLogic extends GetxController {
RxInt selectedSegment = 0.obs;
RxInt selectedTypeOfOwnership = 0.obs;
RxInt selectedUnitType = 0.obs;
RxInt selectedAccompanyingInspectors = 0.obs;
List<String> tmpLs = ['دولتی', 'غیر دولتی', 'استیجاری', 'شخصی', 'سایر'];
// The data for the segments
final Map<int, Widget> segments = {
@@ -18,8 +23,6 @@ class AddSupervisionLogic extends GetxController {
),
};
@override
void onReady() {
// TODO: implement onReady

View File

@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/presentation/widget/buttons/elevated.dart';
import 'package:rasadyar_core/presentation/widget/inputs/r_input.dart';
import 'package:rasadyar_core/presentation/widget/tabs/new_tab.dart';
import 'package:supervision/supervision.dart';
import 'logic.dart';
@@ -21,42 +23,97 @@ class AddSupervisionPage extends GetView<AddSupervisionLogic> {
height: 16,
),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 16,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(22, 13, 22, 4),
child: Text(
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 16,
children: [
Text(
'نوع پروانه کسب',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
),
),
ObxValue((data) {
return NewCupertinoSegmentedControl<int>(
padding: EdgeInsetsDirectional.symmetric(
horizontal: 20,
vertical: 10,
),
children: controller.segments,
groupValue: data.value,
selectedColor: AppColor.blueNormal,
unselectedColor: Colors.white,
borderColor: Colors.grey.shade300,
onValueChanged: (int value) {
data.value = value;
ObxValue((data) {
return NewCupertinoSegmentedControl<int>(
padding: EdgeInsets.zero,
children: controller.segments,
groupValue: data.value,
selectedColor: AppColor.blueNormal,
unselectedColor: Colors.white,
borderColor: Colors.grey.shade300,
onValueChanged: (int value) {
data.value = value;
},
);
}, controller.selectedSegment),
RTextField(label: 'صادر کننده پروانه'),
RTextField(label: 'شماره مجوز'),
RTextField(label: 'شماره ثبت'),
RTextField(label: 'کد اقتصادی'),
optionWidget(controller.selectedTypeOfOwnership),
optionWidget(controller.selectedAccompanyingInspectors),
optionWidget(controller.selectedUnitType),
SizedBox(height: 25),
RElevated(
text: 'مرحله بعد',
onPressed: () {
Get.toNamed(SupervisionRoutes.supervisionRegistrationOfViolation);
},
);
}, controller.selectedSegment),
RTextField(label: 'صادر کننده پروانه'),
RTextField(label: 'شماره مجوز'),
RTextField(label: 'شماره ثبت'),
RTextField(label: 'کد اقتصادی'),
],
isFullWidth: true,
backgroundColor: AppColor.greenNormal,
textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
),
],
),
),
);
}
Column optionWidget(RxInt selected) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'نوع پروانه کسب',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
),
SizedBox(
height: 75,
child: ListView.separated(
shrinkWrap: true,
padding: EdgeInsets.all(16),
scrollDirection: Axis.horizontal,
itemBuilder:
(context, index) => ObxValue((data) {
return ChoiceChip(
onSelected: (value) {
selected.value = index;
},
selectedColor: AppColor.blueNormal,
labelStyle:
data.value == index
? AppFonts.yekan13.copyWith(
color: AppColor.whiteLight,
)
: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyNormalActive,
),
checkmarkColor: Colors.white,
label: Text(controller.tmpLs[index]),
selected: index == data.value,
);
}, selected),
separatorBuilder: (context, index) => SizedBox(width: 8),
itemCount: controller.tmpLs.length,
),
),
],
);
}
}

View File

@@ -0,0 +1,3 @@
import 'package:rasadyar_core/core.dart';
class DisplayInformationLogic extends GetxController {}

View File

@@ -0,0 +1,421 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/presentation/widget/buttons/elevated.dart';
import 'package:rasadyar_core/presentation/widget/inputs/r_input.dart';
import 'package:supervision/supervision.dart';
import 'logic.dart';
class DisplayInformationPage extends GetView<DisplayInformationLogic> {
const DisplayInformationPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: RAppBar(
title: 'نمایش اطلاعات',
leading: vecWidget(
Assets.vecMessageAddSvg,
color: AppColor.blueNormal,
width: 16,
height: 16,
),
),
body: SingleChildScrollView(
child: Column(
spacing: 20,
children: [
markerDetailsWidget(),
accompanyingInspectorsWidget(),
accompanyingInspectorsWidget(),
violationWidget(),
violationWidget(),
ratingbarWidget()
],
),
),);
}
Widget ratingbarWidget() {
return Padding(
padding: const EdgeInsets.fromLTRB(35, 5, 35, 35),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [ Text('به این صنف امتیاز دهید',style: AppFonts.yekan12,),],
),
SizedBox(height: 12,),
RatingBar.builder(
initialRating: 3,
minRating: 1,
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
wrapAlignment: WrapAlignment.center,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
itemBuilder: (context, _) =>
Icon(
Icons.star,
color: Colors.amber,
),
onRatingUpdate: (rating) {
},
),
Row(
children: [
Expanded(
child: RElevated(
height: 40,
text: 'ثبت', onPressed: (){})),
SizedBox(width: 8,),
Expanded(child: ROutlinedElevated(
height: 40,
text: 'انصراف', onPressed: (){
Get.offAllNamed(SupervisionRoutes.supervision);
}))
],
)
],
),
);
}
}
Widget violationWidget() {
return Container(
margin: EdgeInsets.symmetric(horizontal: 35),
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.bgDark),
),
child: Column(
spacing: 16,
children: [
RTextField(
label: 'عنوان تخلف',
filled: true,
filledColor: AppColor.whiteLight,
),
RTextField(
label: 'توضیحات تخلف',
filled: true,
filledColor: AppColor.whiteLight,
maxLines: 5,
minLines: 5,
),
RTextField(
label: 'عنوان تخلف',
filled: true,
filledColor: AppColor.whiteLight,
),
RTextField(
label: 'عنوان تخلف',
filled: true,
filledColor: AppColor.whiteLight,
),
RTextField(
label: 'توضیحات تخلف',
filled: true,
filledColor: AppColor.whiteLight,
maxLines: 5,
minLines: 5,
),
],
),
);
}
Widget markerDetailsWidget() {
return Container(
clipBehavior: Clip.antiAlias,
margin: EdgeInsets.symmetric(horizontal: 35, vertical: 10),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
decoration: ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: Column(
spacing: 15,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 12,
children: [
Text(
'ایجاد بازرسی',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.bgDark),
),
],
),
Container(
height: 32,
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: AppColor.blueLightHover),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'تاریخ بازرسی',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'1403/12/12',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'شماره همراه',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'0326598653',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'آخرین فعالیت',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'1409/12/12',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'موجودی',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'5کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
...List.generate(
5,
(index) =>
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'فروش رفته',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'0 کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
),
],
),
);
}
Widget accompanyingInspectorsWidget() {
return Container(
clipBehavior: Clip.antiAlias,
margin: EdgeInsets.symmetric(horizontal: 35),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
decoration: ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: Column(
spacing: 15,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 12,
children: [
Text(
'بازرس همراه',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.bgDark),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'نام و نام خانوادگی',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'آیدا گل محمدی',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'تاریخ بازرسی',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'1403/12/12',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'شماره همراه',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'0326598653',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'آخرین فعالیت',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'1409/12/12',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'موجودی',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
Text(
'5کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
],
),
);
}

View File

@@ -169,7 +169,7 @@ class SupervisionFilterLogic extends GetxController
@override
void onClose() {
// TODO: implement onClose
super.onClose();
}
}

View File

@@ -182,12 +182,7 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
),
CustomSlidableAction(
onPressed: (context) {
controller.sheetController.value.addBottomSheet(
child: LocationDetailsPage(),
initHeight: 500,
maxHeight: Get.height * 2,
minHeight: 0,
);
Get.toNamed(SupervisionRoutes.supervisionAddSupervision);
},
backgroundColor: AppColor.greenNormal,
padding: EdgeInsets.all(16),
@@ -473,6 +468,7 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
vecWidgetWithOnTap(
assets: Assets.vecMapSvg,
onTap: () {
Get.toNamed(SupervisionRoutes.supervisionLocationDetails);
},
width: 24,
@@ -485,6 +481,7 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
height: 24,
color: AppColor.greenNormal,
onTap: () {
Get.toNamed(SupervisionRoutes.supervisionAddSupervision);
},
),

View File

@@ -0,0 +1,5 @@
import 'package:rasadyar_core/core.dart';
class RegistrationOfViolationLogic extends GetxController {
RxInt countViolation = 1.obs;
}

View File

@@ -0,0 +1,105 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/presentation/widget/buttons/elevated.dart';
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
import 'package:rasadyar_core/presentation/widget/inputs/r_input.dart';
import 'package:supervision/presentation/registration_of_violation/logic.dart';
import 'package:supervision/presentation/routes/app_routes.dart';
class RegistrationOfViolationPage
extends GetView<RegistrationOfViolationLogic> {
const RegistrationOfViolationPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor:AppColor.bgLight,
appBar: RAppBar(
title: 'ثبت تخلف',
leading: vecWidget(
Assets.vecMessageAddSvg,
color: AppColor.blueNormal,
width: 16,
height: 16,
),
additionalActions: [
RFab.smallAdd(onPressed: () => controller.countViolation.value++),
],
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20,vertical: 10),
child: Column(
children: [
Expanded(
child: ObxValue((data) {
return ListView.separated(
itemBuilder: (context, index) =>Container(
padding:EdgeInsets.symmetric(horizontal: 8,vertical: 12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1,color: AppColor.bgDark),
),
child: Column(
spacing:16 ,
children: [
RTextField(
label: 'عنوان تخلف',
filled: true,
filledColor: AppColor.whiteLight,
),
RTextField(
label: 'توضیحات تخلف',
filled: true,
filledColor: AppColor.whiteLight,
maxLines: 5,
minLines: 5,
),
RTextField(
label: 'عنوان تخلف',
filled: true,
filledColor: AppColor.whiteLight,
),
RTextField(
label: 'عنوان تخلف',
filled: true,
filledColor: AppColor.whiteLight,
),
RTextField(
label: 'توضیحات تخلف',
filled: true,
filledColor: AppColor.whiteLight,
maxLines: 5,
minLines: 5,
),
],
),
) ,
separatorBuilder: (context, index) => SizedBox(height: 15,),
itemCount: data.value,
);
},controller.countViolation),
),
RElevated(
text: 'مرحله بعد',
onPressed: () {
Get.toNamed(SupervisionRoutes.supervisionDisplayInformation);
},
isFullWidth: true,
backgroundColor: AppColor.greenNormal,
textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
),
],
),
),
);
}
}

View File

@@ -1,12 +1,13 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:supervision/presentation/actions/view.dart';
import 'package:supervision/presentation/filter/view.dart';
class RootLogic extends GetxController {
RxInt currentIndex = 0.obs;
List<Widget> pages = [
SupervisionFilterPage(),
Placeholder(color: Colors.red),
ActionsPage(),
Placeholder(color: Colors.amber),
];

View File

@@ -1,9 +1,14 @@
import 'package:rasadyar_core/core.dart';
import 'package:supervision/presentation/actions/logic.dart';
import 'package:supervision/presentation/add_supervision/logic.dart';
import 'package:supervision/presentation/add_supervision/view.dart';
import 'package:supervision/presentation/display_information/logic.dart';
import 'package:supervision/presentation/display_information/view.dart';
import 'package:supervision/presentation/filter/logic.dart';
import 'package:supervision/presentation/location_details/logic.dart';
import 'package:supervision/presentation/location_details/view.dart';
import 'package:supervision/presentation/registration_of_violation/logic.dart';
import 'package:supervision/presentation/registration_of_violation/view.dart';
import 'package:supervision/presentation/root/logic.dart';
import 'package:supervision/presentation/root/view.dart';
import 'package:supervision/presentation/routes/app_routes.dart';
@@ -19,6 +24,7 @@ sealed class SupervisionPages {
Get.put(RootLogic());
Get.put(SupervisionFilterLogic());
Get.lazyPut(() => LocationDetailsLogic(), fenix: true);
Get.lazyPut(() => ActionsLogic(), fenix: true);
}),
),
@@ -33,5 +39,14 @@ sealed class SupervisionPages {
page: () => AddSupervisionPage(),
binding: BindingsBuilder.put(() => AddSupervisionLogic()),
),
GetPage(
name: SupervisionRoutes.supervisionRegistrationOfViolation,
page: () => RegistrationOfViolationPage(),
binding: BindingsBuilder.put(() => RegistrationOfViolationLogic()),
), GetPage(
name: SupervisionRoutes.supervisionDisplayInformation,
page: () => DisplayInformationPage(),
binding: BindingsBuilder.put(() => DisplayInformationLogic()),
),
];
}

View File

@@ -5,6 +5,8 @@ sealed class SupervisionRoutes {
static const supervisionAction = '$supervision/action';
static const supervisionUserSetting = '$supervision/userSettings';
static const supervisionLocationDetails = '$supervision/locationDetails';
static const supervisionAddSupervision =
'$supervisionLocationDetails/addSupervision';
static const supervisionAddSupervision = '$supervisionLocationDetails/addSupervision';
static const supervisionRegistrationOfViolation = '$supervisionAddSupervision/RegistrationOfViolation';
static const supervisionDisplayInformation = '$supervisionRegistrationOfViolation/DisplayInformation';
}

View File

@@ -110,6 +110,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.9.0"
flutter_rating_bar:
dependency: transitive
description:
name: flutter_rating_bar
sha256: d2af03469eac832c591a1eba47c91ecc871fe5708e69967073c043b2d775ed93
url: "https://pub.dev"
source: hosted
version: "4.0.1"
flutter_slidable:
dependency: transitive
description: