From 74c56d1c10910a72bbb2453ff765aa4710d6a458 Mon Sep 17 00:00:00 2001 From: "mr.mojtaba" Date: Sun, 27 Apr 2025 12:01:32 +0330 Subject: [PATCH] feat : persian calendar and date picker --- .../add_mobile_inspector/view.dart | 147 ++++++++-------- .../presentation/add_supervision/view.dart | 6 +- .../display_information/view.dart | 164 +++++++++--------- .../registration_of_violation/view.dart | 149 ++++++++-------- .../widget/app_bar/r_app_bar.dart | 10 +- 5 files changed, 233 insertions(+), 243 deletions(-) diff --git a/features/inspection/lib/presentation/add_mobile_inspector/view.dart b/features/inspection/lib/presentation/add_mobile_inspector/view.dart index 89260e3..d6b1a0d 100644 --- a/features/inspection/lib/presentation/add_mobile_inspector/view.dart +++ b/features/inspection/lib/presentation/add_mobile_inspector/view.dart @@ -1,9 +1,7 @@ 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:inspection/presentation/routes/app_routes.dart'; +import 'package:rasadyar_core/core.dart'; +import 'package:rasadyar_core/presentation/widget/buttons/fab.dart'; import 'logic.dart'; @@ -18,7 +16,7 @@ class AddMobileInspectorPage extends GetView { title: 'افزودن بازرس همراه', leading: vecWidget( Assets.vecMessageAddSvg, - color: AppColor.blueNormal, + color: Colors.white, width: 16, height: 16, ), @@ -32,88 +30,21 @@ class AddMobileInspectorPage extends GetView { child: ObxValue((data) { return ListView.separated( padding: const EdgeInsets.fromLTRB(25, 10, 25, 0), - itemBuilder: - (context, index) => - Container( - padding: EdgeInsets.symmetric( - horizontal: 12, - vertical: 16, - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - border: Border.all(width: 0.7, color: AppColor.bgDark), - ), - child: Column( - spacing: 16, - children: [ - RTextField( - label: 'نام و نام خانوادگی', - filled: true, - filledColor: AppColor.whiteLight, - padding: EdgeInsets.zero, - ), - RTextField( - label: 'شماره مجوز', - filled: true, - filledColor: AppColor.whiteLight, - padding: EdgeInsets.zero, - ), - RTextField( - label: 'شماره ثبت', - filled: true, - filledColor: AppColor.whiteLight, - padding: EdgeInsets.zero, - ), - RTextField( - label: 'کد اقتصادی', - filled: true, - filledColor: AppColor.whiteLight, - padding: EdgeInsets.zero, - ), - - Padding( - padding: const EdgeInsets.symmetric(vertical: 12), - child: SizedBox( - height: 40, - child: Row( - spacing: 16, - children: [ - Expanded( - child: RElevated( - text: 'ثبت', - textStyle:AppFonts.yekan16.copyWith(color: Colors.white), - onPressed: () {}, - ), - ), - Expanded( - child: ROutlinedElevated( - text: 'انصراف', - textStyle:AppFonts.yekan16, - onPressed: () {}, - ), - ), - ], - ), - ), - ), - ], - ), - ), + itemBuilder: (context, index) => mobileInspectorWidget(), separatorBuilder: (context, index) => SizedBox(height: 15), itemCount: data.value, ); }, controller.countInspector), ), - Padding( - padding: const EdgeInsets.fromLTRB(20, 4, 20, 20), + padding: const EdgeInsets.fromLTRB(20, 4, 20, 25), child: RElevated( text: 'مرحله بعد', onPressed: () { Get.toNamed(InspectionRoutes.inspectionRegistrationOfViolation); }, - height: 50, + height: 40, isFullWidth: true, backgroundColor: AppColor.greenNormal, textStyle: AppFonts.yekan16.copyWith(color: Colors.white), @@ -123,4 +54,70 @@ class AddMobileInspectorPage extends GetView { ), ); } + + } +Container mobileInspectorWidget() { + return Container( + padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + border: Border.all(width: 0.7, color: AppColor.bgDark), + ), + child: Column( + spacing: 16, + children: [ + RTextField( + label: 'نام و نام خانوادگی', + filled: true, + filledColor: AppColor.whiteLight, + padding: EdgeInsets.zero, + ), + RTextField( + label: 'شماره مجوز', + filled: true, + filledColor: AppColor.whiteLight, + padding: EdgeInsets.zero, + ), + RTextField( + label: 'شماره ثبت', + filled: true, + filledColor: AppColor.whiteLight, + padding: EdgeInsets.zero, + ), + RTextField( + label: 'کد اقتصادی', + filled: true, + filledColor: AppColor.whiteLight, + padding: EdgeInsets.zero, + ), + + Padding( + padding: const EdgeInsets.symmetric(vertical: 12), + child: SizedBox( + height: 40, + child: Row( + spacing: 16, + children: [ + Expanded( + child: RElevated( + text: 'ثبت', + textStyle: AppFonts.yekan16.copyWith(color: Colors.white), + onPressed: () {}, + ), + ), + Expanded( + child: ROutlinedElevated( + text: 'انصراف', + textStyle: AppFonts.yekan16, + onPressed: () {}, + ), + ), + ], + ), + ), + ), + ], + ), + ); +} \ No newline at end of file diff --git a/features/inspection/lib/presentation/add_supervision/view.dart b/features/inspection/lib/presentation/add_supervision/view.dart index 01e7cb5..eb989cb 100644 --- a/features/inspection/lib/presentation/add_supervision/view.dart +++ b/features/inspection/lib/presentation/add_supervision/view.dart @@ -15,7 +15,7 @@ class AddSupervisionPage extends GetView { title: 'ایجاد بازرسی', leading: vecWidget( Assets.vecMessageAddSvg, - color: AppColor.blueNormal, + color: Colors.white, width: 16, height: 16, ), @@ -136,14 +136,14 @@ class AddSupervisionPage extends GetView { ), Padding( - padding: const EdgeInsets.fromLTRB(20, 0, 20, 20), + padding: const EdgeInsets.fromLTRB(20, 0, 20, 25), child: RElevated( text: 'مرحله بعد', onPressed: () { Get.toNamed(controller.routes.first); }, - height: 50, + height: 40, isFullWidth: true, backgroundColor: AppColor.greenNormal, textStyle: AppFonts.yekan16.copyWith(color: Colors.white), diff --git a/features/inspection/lib/presentation/display_information/view.dart b/features/inspection/lib/presentation/display_information/view.dart index f2abc78..55b52d9 100644 --- a/features/inspection/lib/presentation/display_information/view.dart +++ b/features/inspection/lib/presentation/display_information/view.dart @@ -1,8 +1,5 @@ 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:inspection/inspection.dart'; import 'logic.dart'; @@ -12,6 +9,7 @@ class DisplayInformationPage extends GetView { @override Widget build(BuildContext context) { return Scaffold( + backgroundColor: AppColor.bgLight, appBar: RAppBar( title: 'نمایش اطلاعات', leading: vecWidget( @@ -22,66 +20,77 @@ class DisplayInformationPage extends GetView { ), ), - body: SingleChildScrollView( - child: Column( - spacing: 20, - children: [ - markerDetailsWidget(), - accompanyingInspectorsWidget(), - accompanyingInspectorsWidget(), - violationWidget(), - violationWidget(), - ratingbarWidget() + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + spacing: 20, + children: [ + ratingbarWidget(), + markerDetailsWidget(), + accompanyingInspectorsWidget(), + accompanyingInspectorsWidget(), + violationWidget(), + violationWidget(), + SizedBox(height: 30,) + ], + ), + + + ), + ), + + + Padding( + padding: const EdgeInsets.fromLTRB(20, 4, 20, 25), + child: Row( + children: [ + Expanded( + child: RElevated(height: 40, text: 'ثبت', onPressed: () {}), + ), + SizedBox(width: 8), + Expanded( + child: ROutlinedElevated( + height: 40, + text: 'انصراف', + onPressed: () { + Get.until((route) => route.isFirst); + }, + ), + ), + ], + ), + ), ], ), - ),); + ); } Widget ratingbarWidget() { return Padding( - padding: const EdgeInsets.fromLTRB(35, 5, 35, 35), + padding: const EdgeInsets.fromLTRB(35, 35, 35,0), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( - children: [ Text('به این صنف امتیاز دهید',style: AppFonts.yekan12,),], + children: [Text('به این صنف امتیاز دهید', style: AppFonts.yekan12)], ), - SizedBox(height: 12,), + 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.until((route) => route.isFirst); - })) - ], - ) + 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) {}, + ), ], ), ); @@ -94,48 +103,40 @@ Widget violationWidget() { padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - border: Border.all(width: 1, color: AppColor.bgDark), - + border: Border.all(width: 0.7, 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, - + maxLines: 3, + minLines: 3, ), 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, - + maxLines: 3, + minLines: 3, ), - ], ), ); @@ -261,28 +262,27 @@ Widget markerDetailsWidget() { ...List.generate( 5, - (index) => - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, + (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, - ), - ), - ], + children: [ + Text( + 'فروش رفته', + textAlign: TextAlign.center, + style: AppFonts.yekan14.copyWith( + color: AppColor.darkGreyDarkHover, + ), ), + Text( + '0 کیلوگرم', + textAlign: TextAlign.center, + style: AppFonts.yekan14.copyWith( + color: AppColor.darkGreyDarkHover, + ), + ), + ], + ), ), ], ), diff --git a/features/inspection/lib/presentation/registration_of_violation/view.dart b/features/inspection/lib/presentation/registration_of_violation/view.dart index dba41de..d823a60 100644 --- a/features/inspection/lib/presentation/registration_of_violation/view.dart +++ b/features/inspection/lib/presentation/registration_of_violation/view.dart @@ -16,7 +16,7 @@ class RegistrationOfViolationPage title: 'ثبت تخلف', leading: vecWidget( Assets.vecMessageAddSvg, - color: AppColor.blueNormal, + color: Colors.white, width: 16, height: 16, ), @@ -31,93 +31,86 @@ class RegistrationOfViolationPage 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: 0.75, color: AppColor.bgDark), - ), - child: Column( - spacing: 16, - children: [ - RTextField( - label: 'عنوان تخلف', - filled: true, - filledColor: AppColor.whiteLight, - ), - RTextField( - label: 'توضیحات تخلف', - filled: true, - filledColor: AppColor.whiteLight, - maxLines: 3, - minLines: 3, - - ), - RTextField( - label: 'عنوان تخلف', - filled: true, - filledColor: AppColor.whiteLight, - ), - RTextField( - label: 'عنوان تخلف', - filled: true, - filledColor: AppColor.whiteLight, - ), - RTextField( - label: 'توضیحات تخلف', - filled: true, - filledColor: AppColor.whiteLight, - maxLines: 3, - minLines: 3, - ), - - SizedBox( - height: 40, - child: Row( - spacing: 16, - children: [ - Expanded( - child: RElevated( - text: 'ثبت', - onPressed: () {}, - ), - ), - Expanded( - child: ROutlinedElevated( - text: 'انصراف', - onPressed: () {}, - ), - ), - ], - ), - ), - ], - ), - ), + itemBuilder: (context, index) => violationWidget(), separatorBuilder: (context, index) => SizedBox(height: 15), itemCount: data.value, ); }, controller.countViolation), ), - RElevated( - text: 'مرحله بعد', - onPressed: () { - Get.toNamed(InspectionRoutes.inspectionDisplayInformation); - }, - isFullWidth: true, - height: 40, - backgroundColor: AppColor.greenNormal, - textStyle: AppFonts.yekan16.copyWith(color: Colors.white), + Padding( + padding: const EdgeInsets.fromLTRB(0, 4, 0, 25), + child: RElevated( + text: 'مرحله بعد', + onPressed: () { + Get.toNamed(InspectionRoutes.inspectionDisplayInformation); + }, + isFullWidth: true, + height: 40, + backgroundColor: AppColor.greenNormal, + textStyle: AppFonts.yekan16.copyWith(color: Colors.white), + ), ), - SizedBox(height: 25), ], ), ), ); } } + +Container violationWidget() { + return Container( + padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + border: Border.all(width: 0.7, color: AppColor.bgDark), + ), + child: Column( + spacing: 16, + children: [ + RTextField( + label: 'عنوان تخلف', + filled: true, + filledColor: AppColor.whiteLight, + ), + RTextField( + label: 'توضیحات تخلف', + filled: true, + filledColor: AppColor.whiteLight, + maxLines: 3, + minLines: 3, + ), + RTextField( + label: 'عنوان تخلف', + filled: true, + filledColor: AppColor.whiteLight, + ), + RTextField( + label: 'عنوان تخلف', + filled: true, + filledColor: AppColor.whiteLight, + ), + RTextField( + label: 'توضیحات تخلف', + filled: true, + filledColor: AppColor.whiteLight, + maxLines: 3, + minLines: 3, + ), + + SizedBox( + height: 40, + child: Row( + spacing: 16, + children: [ + Expanded(child: RElevated(text: 'ثبت', onPressed: () {})), + Expanded( + child: ROutlinedElevated(text: 'انصراف', onPressed: () {}), + ), + ], + ), + ), + ], + ), + ); +} diff --git a/packages/core/lib/presentation/widget/app_bar/r_app_bar.dart b/packages/core/lib/presentation/widget/app_bar/r_app_bar.dart index 6fdecfb..47f7da9 100644 --- a/packages/core/lib/presentation/widget/app_bar/r_app_bar.dart +++ b/packages/core/lib/presentation/widget/app_bar/r_app_bar.dart @@ -16,8 +16,8 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget { const RAppBar({ super.key, required this.title, - this.backgroundColor = AppColor.lightGreyLight, - this.iconColor = AppColor.blueNormal, + this.backgroundColor = AppColor.blueNormal, + this.iconColor = Colors.white, this.titleTextStyle, this.onBackPressed, this.additionalActions, @@ -34,13 +34,13 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget { scrolledUnderElevation: 0, titleTextStyle: titleTextStyle ?? - AppFonts.yekan16.copyWith(color: AppColor.blueNormal), + AppFonts.yekan16.copyWith(color:Colors.white), title: Text(title), - leading:Padding( + leading:leading!=null ? Padding( padding: const EdgeInsets.only(right: 16), child: leading, - ), + ) : null, actions: [ if (additionalActions != null) ...additionalActions!, Padding(