diff --git a/assets/icons/calendar_search_outline.svg b/assets/icons/calendar_search_outline.svg new file mode 100644 index 0000000..854cf73 --- /dev/null +++ b/assets/icons/calendar_search_outline.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + diff --git a/assets/icons/profile2_outline.svg b/assets/icons/profile2_outline.svg new file mode 100644 index 0000000..87c10f9 --- /dev/null +++ b/assets/icons/profile2_outline.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/vec/calendar_search_outline.svg.vec b/assets/vec/calendar_search_outline.svg.vec new file mode 100644 index 0000000..63a41df Binary files /dev/null and b/assets/vec/calendar_search_outline.svg.vec differ diff --git a/assets/vec/profile2_outline.svg.vec b/assets/vec/profile2_outline.svg.vec new file mode 100644 index 0000000..47e117e Binary files /dev/null and b/assets/vec/profile2_outline.svg.vec differ diff --git a/lib/presentation/pages/splash/logic.dart b/lib/presentation/pages/splash/logic.dart index 1000b9a..60bcc52 100644 --- a/lib/presentation/pages/splash/logic.dart +++ b/lib/presentation/pages/splash/logic.dart @@ -7,6 +7,7 @@ import 'package:rasadyar_app/presentation/routes/app_pages.dart'; import 'package:rasadyar_auth/data/services/token_storage_service.dart'; import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_inspection/inspection.dart'; +import 'package:rasadyar_inspection/presentation/routes/app_routes.dart'; class SplashLogic extends GetxController with GetTickerProviderStateMixin { late final AnimationController scaleController; diff --git a/lib/presentation/routes/app_pages.dart b/lib/presentation/routes/app_pages.dart index 534f0e8..50b39ac 100644 --- a/lib/presentation/routes/app_pages.dart +++ b/lib/presentation/routes/app_pages.dart @@ -8,6 +8,7 @@ import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_inspection/inspection.dart'; import 'package:rasadyar_livestock/presentation/routes/app_pages.dart'; + part 'app_paths.dart'; sealed class AppPages { diff --git a/packages/chicken/lib/presentation/pages/buy_in_province_all/view.dart b/packages/chicken/lib/presentation/pages/buy_in_province_all/view.dart index eba3191..1b8a429 100644 --- a/packages/chicken/lib/presentation/pages/buy_in_province_all/view.dart +++ b/packages/chicken/lib/presentation/pages/buy_in_province_all/view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'; import 'package:rasadyar_chicken/presentation/utils/string_utils.dart'; -import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart'; +import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart' hide ListItem2; import 'package:rasadyar_core/core.dart'; diff --git a/packages/chicken/lib/presentation/pages/buy_in_province_waiting/view.dart b/packages/chicken/lib/presentation/pages/buy_in_province_waiting/view.dart index 6b44fa7..7ecf44e 100644 --- a/packages/chicken/lib/presentation/pages/buy_in_province_waiting/view.dart +++ b/packages/chicken/lib/presentation/pages/buy_in_province_waiting/view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'; import 'package:rasadyar_chicken/presentation/utils/string_utils.dart'; -import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart'; +import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart' hide ListItem2; import 'package:rasadyar_core/core.dart'; diff --git a/packages/chicken/lib/presentation/pages/buy_out_of_province/view.dart b/packages/chicken/lib/presentation/pages/buy_out_of_province/view.dart index f69365d..bc73e58 100644 --- a/packages/chicken/lib/presentation/pages/buy_out_of_province/view.dart +++ b/packages/chicken/lib/presentation/pages/buy_out_of_province/view.dart @@ -8,7 +8,7 @@ import 'package:rasadyar_chicken/data/models/response/roles_products/roles_produ import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart'; import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart'; import 'package:rasadyar_chicken/presentation/widget/inventory_widget.dart'; -import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart'; + import 'package:rasadyar_core/core.dart'; diff --git a/packages/chicken/lib/presentation/pages/sales_in_province/view.dart b/packages/chicken/lib/presentation/pages/sales_in_province/view.dart index 3a00c17..65ee593 100644 --- a/packages/chicken/lib/presentation/pages/sales_in_province/view.dart +++ b/packages/chicken/lib/presentation/pages/sales_in_province/view.dart @@ -6,7 +6,7 @@ import 'package:rasadyar_chicken/data/models/response/roles_products/roles_produ import 'package:rasadyar_chicken/presentation/utils/string_utils.dart'; import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart'; import 'package:rasadyar_chicken/presentation/widget/inventory_widget.dart'; -import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart'; + import 'package:rasadyar_chicken/presentation/widget/page_route.dart'; import 'package:rasadyar_core/core.dart'; diff --git a/packages/chicken/lib/presentation/pages/sales_out_of_province/view.dart b/packages/chicken/lib/presentation/pages/sales_out_of_province/view.dart index 452576e..827b542 100644 --- a/packages/chicken/lib/presentation/pages/sales_out_of_province/view.dart +++ b/packages/chicken/lib/presentation/pages/sales_out_of_province/view.dart @@ -9,7 +9,7 @@ import 'package:rasadyar_chicken/presentation/routes/routes.dart'; import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart'; import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart'; import 'package:rasadyar_chicken/presentation/widget/inventory_widget.dart'; -import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart'; + import 'package:rasadyar_chicken/presentation/widget/page_route.dart'; import 'package:rasadyar_core/core.dart'; diff --git a/packages/chicken/lib/presentation/pages/sales_out_of_province_buyers/view.dart b/packages/chicken/lib/presentation/pages/sales_out_of_province_buyers/view.dart index fad7bc9..fb906d6 100644 --- a/packages/chicken/lib/presentation/pages/sales_out_of_province_buyers/view.dart +++ b/packages/chicken/lib/presentation/pages/sales_out_of_province_buyers/view.dart @@ -3,7 +3,7 @@ import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_pr import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart'; import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart'; import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart'; -import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart'; + import 'package:rasadyar_chicken/presentation/widget/page_route.dart'; import 'package:rasadyar_core/core.dart'; diff --git a/packages/chicken/lib/presentation/pages/sales_out_of_province_sales_list/view.dart b/packages/chicken/lib/presentation/pages/sales_out_of_province_sales_list/view.dart index 018d19a..ab1ce40 100644 --- a/packages/chicken/lib/presentation/pages/sales_out_of_province_sales_list/view.dart +++ b/packages/chicken/lib/presentation/pages/sales_out_of_province_sales_list/view.dart @@ -5,7 +5,7 @@ import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buy import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart'; import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart'; import 'package:rasadyar_chicken/presentation/routes/routes.dart'; -import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart'; +import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart' hide ListItem2; import 'package:rasadyar_core/core.dart'; diff --git a/packages/chicken/lib/presentation/pages/segmentation/view.dart b/packages/chicken/lib/presentation/pages/segmentation/view.dart index 31e3519..87a2d4a 100644 --- a/packages/chicken/lib/presentation/pages/segmentation/view.dart +++ b/packages/chicken/lib/presentation/pages/segmentation/view.dart @@ -5,7 +5,7 @@ import 'package:rasadyar_chicken/data/models/response/roles_products/roles_produ import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart'; import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart'; import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart'; -import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart'; + import 'package:rasadyar_core/core.dart'; diff --git a/packages/core/lib/presentation/common/assets.gen.dart b/packages/core/lib/presentation/common/assets.gen.dart index 9ea23c7..4bbf174 100644 --- a/packages/core/lib/presentation/common/assets.gen.dart +++ b/packages/core/lib/presentation/common/assets.gen.dart @@ -58,6 +58,9 @@ class $AssetsIconsGen { /// File path: assets/icons/calendar_search.svg SvgGenImage get calendarSearch => const SvgGenImage('assets/icons/calendar_search.svg'); + /// File path: assets/icons/calendar_search_outline.svg + SvgGenImage get calendarSearchOutline => const SvgGenImage('assets/icons/calendar_search_outline.svg'); + /// File path: assets/icons/call.svg SvgGenImage get call => const SvgGenImage('assets/icons/call.svg'); @@ -190,6 +193,9 @@ class $AssetsIconsGen { /// File path: assets/icons/profile2.svg SvgGenImage get profile2 => const SvgGenImage('assets/icons/profile2.svg'); + /// File path: assets/icons/profile2_outline.svg + SvgGenImage get profile2Outline => const SvgGenImage('assets/icons/profile2_outline.svg'); + /// File path: assets/icons/profile_circle.svg SvgGenImage get profileCircle => const SvgGenImage('assets/icons/profile_circle.svg'); @@ -273,6 +279,7 @@ class $AssetsIconsGen { buy, calendar, calendarSearch, + calendarSearchOutline, call, check, checkSquare, @@ -317,6 +324,7 @@ class $AssetsIconsGen { pictureFrame, placeHolder, profile2, + profile2Outline, profileCircle, profileUser, receiptDiscount, @@ -403,6 +411,9 @@ class $AssetsVecGen { /// File path: assets/vec/calendar_search.svg.vec SvgGenImage get calendarSearchSvg => const SvgGenImage.vec('assets/vec/calendar_search.svg.vec'); + /// File path: assets/vec/calendar_search_outline.svg.vec + SvgGenImage get calendarSearchOutlineSvg => const SvgGenImage.vec('assets/vec/calendar_search_outline.svg.vec'); + /// File path: assets/vec/call.svg.vec SvgGenImage get callSvg => const SvgGenImage.vec('assets/vec/call.svg.vec'); @@ -535,6 +546,9 @@ class $AssetsVecGen { /// File path: assets/vec/profile2.svg.vec SvgGenImage get profile2Svg => const SvgGenImage.vec('assets/vec/profile2.svg.vec'); + /// File path: assets/vec/profile2_outline.svg.vec + SvgGenImage get profile2OutlineSvg => const SvgGenImage.vec('assets/vec/profile2_outline.svg.vec'); + /// File path: assets/vec/profile_circle.svg.vec SvgGenImage get profileCircleSvg => const SvgGenImage.vec('assets/vec/profile_circle.svg.vec'); @@ -618,6 +632,7 @@ class $AssetsVecGen { buySvg, calendarSvg, calendarSearchSvg, + calendarSearchOutlineSvg, callSvg, checkSvg, checkSquareSvg, @@ -662,6 +677,7 @@ class $AssetsVecGen { pictureFrameSvg, placeHolderSvg, profile2Svg, + profile2OutlineSvg, profileCircleSvg, profileUserSvg, receiptDiscountSvg, diff --git a/packages/core/lib/presentation/widget/buttons/outline_elevated_icon.dart b/packages/core/lib/presentation/widget/buttons/outline_elevated_icon.dart index d4c57a0..7260c6b 100644 --- a/packages/core/lib/presentation/widget/buttons/outline_elevated_icon.dart +++ b/packages/core/lib/presentation/widget/buttons/outline_elevated_icon.dart @@ -40,6 +40,7 @@ class _ROutlinedElevatedIconState extends State { Widget build(BuildContext context) { return OutlinedButton.icon( icon: widget.icon, + label: Text(widget.text), onPressed: widget.onPressed, style: ButtonStyle( diff --git a/packages/core/lib/presentation/widget/list_item/list_item.dart b/packages/core/lib/presentation/widget/list_item/list_item.dart new file mode 100644 index 0000000..01a146d --- /dev/null +++ b/packages/core/lib/presentation/widget/list_item/list_item.dart @@ -0,0 +1,127 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; + +class ListItem extends StatelessWidget { + const ListItem({ + super.key, + required this.index, + required this.child, + required this.secondChild, + required this.labelColor, + required this.labelIcon, + required this.onTap, + required this.selected, + this.labelIconColor = AppColor.mediumGreyDarkHover, + }); + + final int index; + final Widget child; + final Widget secondChild; + final Color labelColor; + final String labelIcon; + final Color? labelIconColor; + final VoidCallback onTap; + final bool selected; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: onTap, + child: Container( + width: Get.width, + margin: const EdgeInsets.fromLTRB(0, 0, 10, 0), + decoration: BoxDecoration( + color: labelColor, + borderRadius: BorderRadius.circular(8), + border: Border.all(width: 1, color: AppColor.lightGreyNormalHover), + ), + child: AnimatedSize( + duration: Duration(milliseconds: 400), + alignment: Alignment.center, + child: Stack( + clipBehavior: Clip.none, + alignment: Alignment.centerRight, + children: [ + AnimatedSize( + duration: Duration(milliseconds: 300), + child: Container( + width: Get.width - 30, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + children: [ + Expanded( + child: AnimatedCrossFade( + alignment: Alignment.center, + firstChild: Container( + height: 75, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + bottomLeft: Radius.zero, + bottomRight: Radius.circular(8), + topLeft: Radius.zero, + topRight: Radius.circular(8), + ), + ), + clipBehavior: Clip.antiAlias, + child: child, + ), + secondChild: Container( + padding: EdgeInsets.fromLTRB(8, 12, 14, 12), + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + child: secondChild, + ), + crossFadeState: selected + ? CrossFadeState.showSecond + : CrossFadeState.showFirst, + duration: Duration(milliseconds: 300), + ), + ), + Container( + width: 20, + child: Center( + child: SvgGenImage.vec(labelIcon).svg( + width: 16.w, + height: 16.h, + colorFilter: ColorFilter.mode(labelColor, BlendMode.srcIn), + ), + ), + ), + ], + ), + ), + ), + + Positioned( + right: -12, + child: Container( + width: index < 999 ? 24 : null, + height: index < 999 ? 24 : null, + padding: EdgeInsets.all(2), + decoration: BoxDecoration( + color: AppColor.greenLightHover, + borderRadius: BorderRadius.circular(4), + border: Border.all(width: 0.50, color: AppColor.greenDarkActive), + ), + alignment: Alignment.center, + child: Text( + (index + 1).toString(), + style: AppFonts.yekan12.copyWith(color: Colors.black), + ), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/packages/core/lib/presentation/widget/list_item/list_item2.dart b/packages/core/lib/presentation/widget/list_item/list_item2.dart new file mode 100644 index 0000000..fb8eb81 --- /dev/null +++ b/packages/core/lib/presentation/widget/list_item/list_item2.dart @@ -0,0 +1,117 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; + +class ListItem2 extends StatelessWidget { + const ListItem2({ + super.key, + required this.index, + required this.child, + required this.secondChild, + required this.labelColor, + required this.labelIcon, + required this.onTap, + required this.selected, + this.labelIconColor = AppColor.mediumGreyDarkHover, + }); + + final int index; + final Widget child; + final Widget secondChild; + final Color labelColor; + final String labelIcon; + final Color? labelIconColor; + final VoidCallback onTap; + final bool selected; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: onTap, + child: Container( + width: Get.width, + margin: const EdgeInsets.fromLTRB(0, 0, 10, 0), + decoration: BoxDecoration( + color: labelColor, + borderRadius: BorderRadius.circular(8), + border: Border.all(width: 1, color: AppColor.lightGreyNormalHover), + ), + child: AnimatedSize( + duration: Duration(milliseconds: 400), + alignment: Alignment.center, + child: Stack( + clipBehavior: Clip.none, + alignment: Alignment.centerRight, + children: [ + AnimatedCrossFade( + firstChild: Row( + children: [ + Expanded( + child: Container( + height: 75, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + bottomLeft: Radius.zero, + bottomRight: Radius.circular(8), + topLeft: Radius.zero, + topRight: Radius.circular(8), + ), + ), + clipBehavior: Clip.antiAlias, + child: child, + ), + ), + Container( + width: 20, + child: Center( + child: SvgGenImage.vec(labelIcon).svg( + width: 16.w, + height: 16.h, + //TODO + colorFilter: ColorFilter.mode( + labelIconColor ?? AppColor.mediumGreyDarkActive, + BlendMode.srcIn, + ), + ), + ), + ), + ], + ), + secondChild: Container( + padding: EdgeInsets.fromLTRB(8, 8, 12, 12), + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + child: secondChild, + ), + crossFadeState: selected ? CrossFadeState.showSecond : CrossFadeState.showFirst, + duration: Duration(milliseconds: 300), + ), + + Positioned( + right: -12, + child: Container( + width: index < 999 ? 24 : null, + height: index < 999 ? 24 : null, + padding: EdgeInsets.all(2), + decoration: BoxDecoration( + color: AppColor.greenLightHover, + borderRadius: BorderRadius.circular(4), + border: Border.all(width: 0.50, color: AppColor.greenDarkActive), + ), + alignment: Alignment.center, + child: Text( + (index + 1).toString(), + style: AppFonts.yekan12.copyWith(color: Colors.black), + ), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/packages/core/lib/presentation/widget/list_item/list_item_with_out_number.dart b/packages/core/lib/presentation/widget/list_item/list_item_with_out_number.dart new file mode 100644 index 0000000..5e392e0 --- /dev/null +++ b/packages/core/lib/presentation/widget/list_item/list_item_with_out_number.dart @@ -0,0 +1,104 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; + +class ListItemWithOutCounter extends StatelessWidget { + const ListItemWithOutCounter({ + super.key, + required this.child, + required this.secondChild, + required this.labelColor, + required this.labelIcon, + required this.onTap, + required this.selected, + this.labelIconColor = AppColor.mediumGreyDarkHover, + }); + + final Widget child; + final Widget secondChild; + final Color labelColor; + final String labelIcon; + final Color? labelIconColor; + final VoidCallback onTap; + final bool selected; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: onTap, + child: Container( + width: Get.width, + margin: const EdgeInsets.fromLTRB(0, 0, 10, 0), + decoration: BoxDecoration( + color: labelColor, + borderRadius: BorderRadius.circular(8), + border: Border.all(width: 1, color: AppColor.lightGreyNormalHover), + ), + child: AnimatedSize( + duration: Duration(milliseconds: 400), + alignment: Alignment.center, + child: AnimatedSize( + duration: Duration(milliseconds: 300), + child: Container( + width: Get.width - 30, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + children: [ + Expanded( + child: AnimatedCrossFade( + alignment: Alignment.center, + firstChild: Container( + height: 75, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + bottomLeft: Radius.zero, + bottomRight: Radius.circular(8), + topLeft: Radius.zero, + topRight: Radius.circular(8), + ), + ), + clipBehavior: Clip.antiAlias, + child: child, + ), + secondChild: Container( + padding: EdgeInsets.all(8), + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + child: secondChild, + ), + crossFadeState: selected + ? CrossFadeState.showSecond + : CrossFadeState.showFirst, + duration: Duration(milliseconds: 300), + ), + ), + Visibility( + visible: selected==false, + child: Container( + width: 20, + child: Center( + child: SvgGenImage.vec(labelIcon).svg( + width: 16.w, + height: 16.h, + colorFilter: ColorFilter.mode(labelColor, BlendMode.srcIn), + ), + ), + ), + ), + ], + ), + ), + ), + ), + ), + ); + } +} + diff --git a/packages/core/lib/presentation/widget/overlay_dropdown_widget/view.dart b/packages/core/lib/presentation/widget/overlay_dropdown_widget/view.dart index 80394cc..86a7ba1 100644 --- a/packages/core/lib/presentation/widget/overlay_dropdown_widget/view.dart +++ b/packages/core/lib/presentation/widget/overlay_dropdown_widget/view.dart @@ -46,6 +46,17 @@ class _OverlayDropdownState extends State> { selectedItem = widget.selectedItem ?? widget.initialValue; } + + @override + void didUpdateWidget(covariant OverlayDropdownWidget oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.selectedItem != oldWidget.selectedItem) { + setState(() { + selectedItem = widget.selectedItem; + }); + } + } + void _showOverlay() { final renderBox = _key.currentContext!.findRenderObject() as RenderBox; final size = renderBox.size; diff --git a/packages/core/lib/presentation/widget/widget.dart b/packages/core/lib/presentation/widget/widget.dart index dd55bb0..42bb4a4 100644 --- a/packages/core/lib/presentation/widget/widget.dart +++ b/packages/core/lib/presentation/widget/widget.dart @@ -24,3 +24,8 @@ export 'vec_widget.dart'; export 'list_row_item.dart'; //inputs export 'inputs/inputs.dart'; +//list_item +export 'list_item/list_item.dart'; +export 'list_item/list_item2.dart'; +export 'list_item/list_item_with_out_number.dart'; + diff --git a/packages/inspection/lib/inspection.dart b/packages/inspection/lib/inspection.dart index 66fd106..cfd321b 100644 --- a/packages/inspection/lib/inspection.dart +++ b/packages/inspection/lib/inspection.dart @@ -1,7 +1,5 @@ library; -export 'presentation/filter/logic.dart'; -export 'presentation/filter/view.dart'; -export 'presentation/routes/app_pages.dart'; +export 'presentation/pages/pages.dart'; export 'presentation/routes/app_routes.dart'; - +export 'presentation/routes/app_pages.dart'; diff --git a/packages/inspection/lib/presentation/action/view.dart b/packages/inspection/lib/presentation/action/view.dart deleted file mode 100644 index a0d2ac5..0000000 --- a/packages/inspection/lib/presentation/action/view.dart +++ /dev/null @@ -1,726 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:rasadyar_core/core.dart'; - -import 'logic.dart'; - -class ActionPage extends GetView { - const ActionPage({super.key}); - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: AppColor.bgLight, - body: SafeArea( - child: Column( - children: [ - SizedBox(height: 20), - ObxValue((data) { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: List.generate(4, (index) { - return headerWidget( - icon: controller.headersIcons[index], - title: controller.headersTitle[index], - onTap: () { - controller.updateSelectedIndex(index); - }, - isSelected: controller.selectedIndex.value == index, - ); - }), - ); - }, controller.selectedIndex), - Expanded( - child: ObxValue((index) { - if (index.value == 3) { - WidgetsBinding.instance.addPostFrameCallback((_) { - showCupertinoDialog( - context: context, - barrierDismissible: true, - builder: (context) { - return CupertinoAlertDialog( - title: Text( - 'از سامانه خارج می شوید؟', - style: AppFonts.yekan18.copyWith( - color: AppColor.lightGreyDarkActive, - ), - ), - actions: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - spacing: 16, - children: [ - Expanded( - child: RElevated( - text: 'بله', - onPressed: () { - exit(0); - }, - ), - ), - Expanded( - child: ROutlinedElevated( - text: 'خیر', - onPressed: () { - controller.updateSelectedIndex( - controller.previousIndex.value, - ); - - Get.back(); - }, - ), - ), - ], - ), - ), - ], - ); - }, - ); - }); - } - - return switch (index.value) { - 0 => profileWidget(), - 1 => supervisionHistoryWidget(), - 2 => statisticsWidget(), - - int() => Container(), - }; - }, controller.selectedIndex), - ), - ], - ), - ), - ); - } - - Container statisticsWidget() => Container( - margin: EdgeInsets.only(top: 50), - padding: EdgeInsets.symmetric(vertical: 50), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(30), - topRight: Radius.circular(30), - ), - ), - child: Column( - children: [ - Container( - height: 32, - margin: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - spacing: 10, - children: [ - Expanded( - child: ROutlinedElevatedIcon( - icon: FaIcon(FontAwesomeIcons.calendar), - onPressed: () {}, - text: 'از تاریخ', - textStyle: AppFonts.yekan16.copyWith( - color: AppColor.blueNormal, - ), - ), - ), - Expanded( - child: ROutlinedElevatedIcon( - icon: FaIcon(FontAwesomeIcons.calendar), - onPressed: () {}, - text: 'تا تاریخ', - textStyle: AppFonts.yekan16.copyWith( - color: AppColor.blueNormal, - ), - ), - ), - ], - ), - ), - - optionWidget( - selected: controller.filter1Index, - title: 'فیلترتراکنش ها', - options: controller.tmpLs, - ), - optionWidget( - selected: controller.filter2Index, - title: 'فیلتر شهرستان', - options: controller.hamadanCities, - ), - - SizedBox(height: 10), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - vecWidgetWithOnTap( - child: Assets.vec.pdfDownloadSvg.svg(), - onTap: () {}, - width: 64, - height: 64, - ), - vecWidgetWithOnTap( - child: Assets.vec.excelDownloadSvg.svg(), - onTap: () {}, - width: 64, - height: 64, - ), - ], - ), - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.center, - spacing: 20, - children: [ - headerInfo(title: 'تعداد تراکنش ها', description: '183 '), - headerInfo( - title: 'جمع تراکنش ها', - description: '183 ریال', - background: AppColor.green1Light, - ), - ], - ), - ], - ), - ); - - Widget supervisionHistoryWidget() { - return ObxValue((data) { - return ListView.builder( - itemBuilder: (context, index) { - return historyItem(data[index], () { - data[index] = !data[index]; - }); - }, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemCount: data.length, - ); - }, controller.supervisionHistoryList); - } - - Column profileWidget() { - return Column( - children: [ - slidableWidgetOne(), - slidableWidgetOne(), - slidableWidgetOne(), - slidableWidgetOne(), - slidableWidgetOne(), - ], - ); - } - - Widget headerWidget({ - required Widget icon, - required String title, - required VoidCallback onTap, - bool isSelected = false, - }) { - return GestureDetector( - onTap: onTap, - child: Column( - spacing: 8, - children: [ - Container( - width: 48, - height: 48, - padding: EdgeInsets.all(8), - decoration: ShapeDecoration( - color: isSelected ? AppColor.blueLightActive : AppColor.blueLight, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), - ), - child: icon, - ), - Text( - title, - style: AppFonts.yekan12.copyWith( - 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: Assets.vec.trashSvg.svg( - 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({required VoidCallback onTap}) { - return 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: Assets.vec.trashSvg.svg( - 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: Assets.vec.trashSvg.svg( - width: 24, - height: 24, - ), - ), - ], - ), - child: GestureDetector( - onTap: 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 historyItem(bool isExpanded, VoidCallback onTap) { - return AnimatedContainer( - margin: EdgeInsets.symmetric(horizontal: 30, vertical: 10), - curve: Curves.easeInOut, - duration: Duration(seconds: 1), - height: isExpanded ? 364 : 62, - child: - isExpanded - ? markerDetailsWidget(ontap: onTap) - : slidableWidgetTwo(onTap: onTap), - ); - } - - Widget markerDetailsWidget({required VoidCallback ontap}) { - return GestureDetector( - onTap: ontap, - behavior: HitTestBehavior.opaque, - child: Container( - clipBehavior: Clip.antiAlias, - - 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.spaceBetween, - spacing: 12, - children: [ - vecWidgetWithOnTap( - child: Assets.vec.editSvg.svg(), - onTap: () {}, - width: 24, - height: 24, - color: AppColor.blueNormal, - ), - Text( - 'سوابق بازرسی من', - textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), - ), - vecWidgetWithOnTap( - child: Assets.vec.trashSvg.svg(), - width: 24, - height: 24, - color: AppColor.redNormal, - onTap: () {}, - ), - ], - ), - 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, - ), - ), - ], - ), - ), - ], - ), - ), - ); - } - - Column optionWidget({ - required RxInt selected, - required String title, - required List options, - }) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row(), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 22, vertical: 10), - child: Text( - title, - textAlign: TextAlign.center, - style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal), - ), - ), - - Padding( - padding: const EdgeInsets.symmetric(horizontal: 30), - child: Wrap( - runSpacing: 8, - spacing: 8, - children: - options - .map( - (e) => ObxValue((data) { - return ChoiceChip( - onSelected: (value) { - selected.value = options.indexOf(e); - }, - selectedColor: AppColor.blueNormal, - labelStyle: - data.value == options.indexOf(e) - ? AppFonts.yekan13.copyWith( - color: AppColor.whiteLight, - ) - : AppFonts.yekan12.copyWith( - color: AppColor.darkGreyNormalActive, - ), - checkmarkColor: Colors.white, - label: Text(e), - selected: options.indexOf(e) == data.value, - ); - }, selected), - ) - .toList(), - ), - ), - ], - ); - } - - Container headerInfo({ - required String title, - required String description, - Color? background, - }) { - return Container( - clipBehavior: Clip.antiAlias, - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12), - decoration: ShapeDecoration( - color: background ?? AppColor.blueLight, - shape: RoundedRectangleBorder( - side: BorderSide(width: 1, color: AppColor.blackLightHover), - borderRadius: BorderRadius.circular(8), - ), - ), - alignment: AlignmentDirectional.center, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - spacing: 10, - children: [ - Text(title, style: AppFonts.yekan10), - - Text(description, style: AppFonts.yekan12), - ], - ), - ); - } -} diff --git a/packages/inspection/lib/presentation/action/logic.dart b/packages/inspection/lib/presentation/pages/action/logic.dart similarity index 86% rename from packages/inspection/lib/presentation/action/logic.dart rename to packages/inspection/lib/presentation/pages/action/logic.dart index 6692de2..3d2a504 100644 --- a/packages/inspection/lib/presentation/action/logic.dart +++ b/packages/inspection/lib/presentation/pages/action/logic.dart @@ -10,16 +10,14 @@ class ActionLogic extends GetxController with GetTickerProviderStateMixin { List headersTitle = [ 'کاربران', - 'سوابق بازرسی من', + 'سوابق', 'آمار', - 'خروج از سامانه', ]; - List headersIcons = [ - Assets.vec.profileUserSvg.svg(), - Assets.vec.calendarSearchSvg.svg(), - Assets.vec.diagramSvg.svg(), - Assets.vec.logoutSvg.svg(), + List headersIcons = [ + Assets.vec.profileUserSvg.path, + Assets.vec.calendarSearchSvg.path, + Assets.vec.diagramSvg.path, ]; RxList supervisionHistoryList = [false, false, false, false].obs; diff --git a/packages/inspection/lib/presentation/pages/action/view.dart b/packages/inspection/lib/presentation/pages/action/view.dart new file mode 100644 index 0000000..062a66b --- /dev/null +++ b/packages/inspection/lib/presentation/pages/action/view.dart @@ -0,0 +1,443 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; +import 'package:rasadyar_inspection/presentation/pages/records/view.dart'; +import 'package:rasadyar_inspection/presentation/pages/statistics/view.dart'; +import 'package:rasadyar_inspection/presentation/pages/users/view.dart'; +import 'package:rasadyar_inspection/presentation/widget/base_page/view.dart'; + +import 'logic.dart'; + +class ActionPage extends GetView { + const ActionPage({super.key}); + + @override + Widget build(BuildContext context) { + return BasePage( + hasBack: false, + hasFilter: true, + hasSearch: true, + widgets: [ + SizedBox(height: 20), + ObxValue((data) { + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: List.generate(controller.headersIcons.length, (index) { + return headerWidget( + iconPath: controller.headersIcons[index], + title: controller.headersTitle[index], + onTap: () { + controller.updateSelectedIndex(index); + }, + isSelected: controller.selectedIndex.value == index, + ); + }), + ); + }, controller.selectedIndex), + Expanded( + child: Container( + color: Colors.white, + child: ObxValue((index) { + return switch (index.value) { + 0 => UsersPage(), + 1 => RecordsPage(), + 2 => StatisticsPage(), + int() => throw UnimplementedError(), + }; + }, controller.selectedIndex), + ), + ), + ], + ); + } + + + + Widget supervisionHistoryWidget() { + return ObxValue((data) { + return ListView.builder( + itemBuilder: (context, index) { + return historyItem(data[index], () { + data[index] = !data[index]; + }); + }, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemCount: data.length, + ); + }, controller.supervisionHistoryList); + } + + + + Widget headerWidget({ + required String iconPath, + required String title, + required VoidCallback onTap, + bool isSelected = false, + }) { + return GestureDetector( + onTap: onTap, + child: Container( + width: 93.w, + height: 104.h, + margin: EdgeInsets.symmetric(horizontal: 8.w), + padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 8.h), + decoration: BoxDecoration( + color: isSelected ? Colors.white : Colors.transparent, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(20), + topRight: Radius.circular(20), + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + spacing: 8, + children: [ + Container( + width: 48.w, + height: 48.h, + padding: EdgeInsets.all(8), + decoration: ShapeDecoration( + color: isSelected ? AppColor.blueLightActive : Colors.transparent, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + ), + child: SvgGenImage.vec(iconPath).svg( + width: 24.w, + height: 24.h, + colorFilter: ColorFilter.mode( + isSelected ? AppColor.blueNormalActive : AppColor.blueNormal, + BlendMode.srcIn, + ), + ), + ), + + Text( + title, + style: AppFonts.yekan12.copyWith( + + color: isSelected ? AppColor.blueNormalActive : AppColor.blueNormal, + ), + ), + ], + ), + ), + ); + } + + + Widget slidableWidgetTwo({required VoidCallback onTap}) { + return 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: Assets.vec.trashSvg.svg(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: Assets.vec.trashSvg.svg(width: 24, height: 24), + ), + ], + ), + child: GestureDetector( + onTap: 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 historyItem(bool isExpanded, VoidCallback onTap) { + return AnimatedContainer( + margin: EdgeInsets.symmetric(horizontal: 30, vertical: 10), + curve: Curves.easeInOut, + duration: Duration(seconds: 1), + height: isExpanded ? 364 : 62, + child: isExpanded ? markerDetailsWidget(ontap: onTap) : slidableWidgetTwo(onTap: onTap), + ); + } + + Widget markerDetailsWidget({required VoidCallback ontap}) { + return GestureDetector( + onTap: ontap, + behavior: HitTestBehavior.opaque, + child: Container( + clipBehavior: Clip.antiAlias, + + 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.spaceBetween, + spacing: 12, + children: [ + vecWidgetWithOnTap( + child: Assets.vec.editSvg.svg(), + onTap: () {}, + width: 24, + height: 24, + color: AppColor.blueNormal, + ), + Text( + 'سوابق بازرسی من', + textAlign: TextAlign.center, + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), + ), + vecWidgetWithOnTap( + child: Assets.vec.trashSvg.svg(), + width: 24, + height: 24, + color: AppColor.redNormal, + onTap: () {}, + ), + ], + ), + 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), + ), + ], + ), + ), + ], + ), + ), + ); + } + + Column optionWidget({ + required RxInt selected, + required String title, + required List options, + }) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row(), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 22, vertical: 10), + child: Text( + title, + textAlign: TextAlign.center, + style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal), + ), + ), + + Padding( + padding: const EdgeInsets.symmetric(horizontal: 30), + child: Wrap( + runSpacing: 8, + spacing: 8, + children: options + .map( + (e) => ObxValue((data) { + return ChoiceChip( + onSelected: (value) { + selected.value = options.indexOf(e); + }, + selectedColor: AppColor.blueNormal, + labelStyle: data.value == options.indexOf(e) + ? AppFonts.yekan13.copyWith(color: AppColor.whiteLight) + : AppFonts.yekan12.copyWith(color: AppColor.darkGreyNormalActive), + checkmarkColor: Colors.white, + label: Text(e), + selected: options.indexOf(e) == data.value, + ); + }, selected), + ) + .toList(), + ), + ), + ], + ); + } + + Container headerInfo({required String title, required String description, Color? background}) { + return Container( + clipBehavior: Clip.antiAlias, + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12), + decoration: ShapeDecoration( + color: background ?? AppColor.blueLight, + shape: RoundedRectangleBorder( + side: BorderSide(width: 1, color: AppColor.blackLightHover), + borderRadius: BorderRadius.circular(8), + ), + ), + alignment: AlignmentDirectional.center, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + spacing: 10, + children: [ + Text(title, style: AppFonts.yekan10), + + Text(description, style: AppFonts.yekan12), + ], + ), + ); + } +} diff --git a/packages/inspection/lib/presentation/add_mobile_inspector/logic.dart b/packages/inspection/lib/presentation/pages/add_mobile_inspector/logic.dart similarity index 100% rename from packages/inspection/lib/presentation/add_mobile_inspector/logic.dart rename to packages/inspection/lib/presentation/pages/add_mobile_inspector/logic.dart diff --git a/packages/inspection/lib/presentation/add_mobile_inspector/view.dart b/packages/inspection/lib/presentation/pages/add_mobile_inspector/view.dart similarity index 100% rename from packages/inspection/lib/presentation/add_mobile_inspector/view.dart rename to packages/inspection/lib/presentation/pages/add_mobile_inspector/view.dart diff --git a/packages/inspection/lib/presentation/add_supervision/logic.dart b/packages/inspection/lib/presentation/pages/add_supervision/logic.dart similarity index 100% rename from packages/inspection/lib/presentation/add_supervision/logic.dart rename to packages/inspection/lib/presentation/pages/add_supervision/logic.dart diff --git a/packages/inspection/lib/presentation/add_supervision/view.dart b/packages/inspection/lib/presentation/pages/add_supervision/view.dart similarity index 100% rename from packages/inspection/lib/presentation/add_supervision/view.dart rename to packages/inspection/lib/presentation/pages/add_supervision/view.dart diff --git a/packages/inspection/lib/presentation/display_information/logic.dart b/packages/inspection/lib/presentation/pages/display_information/logic.dart similarity index 100% rename from packages/inspection/lib/presentation/display_information/logic.dart rename to packages/inspection/lib/presentation/pages/display_information/logic.dart diff --git a/packages/inspection/lib/presentation/display_information/view.dart b/packages/inspection/lib/presentation/pages/display_information/view.dart similarity index 100% rename from packages/inspection/lib/presentation/display_information/view.dart rename to packages/inspection/lib/presentation/pages/display_information/view.dart diff --git a/packages/inspection/lib/presentation/filter/logic.dart b/packages/inspection/lib/presentation/pages/filter/logic.dart similarity index 98% rename from packages/inspection/lib/presentation/filter/logic.dart rename to packages/inspection/lib/presentation/pages/filter/logic.dart index 5caf8ed..1cd48a2 100644 --- a/packages/inspection/lib/presentation/filter/logic.dart +++ b/packages/inspection/lib/presentation/pages/filter/logic.dart @@ -1,9 +1,9 @@ import 'dart:async'; - import 'package:flutter/material.dart'; import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_inspection/data/utils/marker_generator.dart'; -import 'package:rasadyar_inspection/presentation/filter/view.dart'; +import 'package:rasadyar_inspection/presentation/pages/filter/view.dart'; + class InspectorFilterLogic extends GetxController with GetTickerProviderStateMixin { diff --git a/packages/inspection/lib/presentation/filter/view.dart b/packages/inspection/lib/presentation/pages/filter/view.dart similarity index 95% rename from packages/inspection/lib/presentation/filter/view.dart rename to packages/inspection/lib/presentation/pages/filter/view.dart index 6dad128..a523041 100644 --- a/packages/inspection/lib/presentation/filter/view.dart +++ b/packages/inspection/lib/presentation/pages/filter/view.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/presentation/widget/buttons/fab.dart'; import 'package:rasadyar_inspection/presentation/routes/app_routes.dart'; +import 'package:rasadyar_inspection/presentation/widget/custom_chips.dart'; import 'logic.dart'; @@ -440,31 +441,6 @@ Widget markerDetailsWidget() { ), ); } - -Widget customChip({bool isSelected = false, required String title, required int index, required Function(int) onTap}) { - return GestureDetector( - onTap: () { - onTap.call(index); - }, - child: Container( - padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10), - clipBehavior: Clip.antiAlias, - decoration: BoxDecoration( - color: isSelected ? AppColor.blueNormal : AppColor.whiteGreyNormal, - borderRadius: BorderRadius.circular(8), - border: isSelected - ? Border.fromBorderSide(BorderSide.none) - : Border.all(width: 0.25, color: const Color(0xFFB0B0B0)), - ), - child: Text( - title, - textAlign: TextAlign.center, - style: isSelected ? AppFonts.yekan10.copyWith(color: AppColor.whiteLight) : AppFonts.yekan10, - ), - ), - ); -} - Widget selectedLocationWidget({ required bool showHint, required SlidableController sliderController, diff --git a/packages/inspection/lib/presentation/inspection_map/logic.dart b/packages/inspection/lib/presentation/pages/inspection_map/logic.dart similarity index 100% rename from packages/inspection/lib/presentation/inspection_map/logic.dart rename to packages/inspection/lib/presentation/pages/inspection_map/logic.dart diff --git a/packages/inspection/lib/presentation/inspection_map/view.dart b/packages/inspection/lib/presentation/pages/inspection_map/view.dart similarity index 74% rename from packages/inspection/lib/presentation/inspection_map/view.dart rename to packages/inspection/lib/presentation/pages/inspection_map/view.dart index 72d174c..9932fe0 100644 --- a/packages/inspection/lib/presentation/inspection_map/view.dart +++ b/packages/inspection/lib/presentation/pages/inspection_map/view.dart @@ -1,8 +1,9 @@ import 'package:flutter/material.dart'; import 'package:rasadyar_core/core.dart'; +import 'package:rasadyar_inspection/presentation/pages/filter/view.dart'; import 'package:rasadyar_inspection/presentation/routes/app_routes.dart'; import 'package:rasadyar_inspection/presentation/widget/base_page/view.dart'; -import 'package:rasadyar_inspection/presentation/widget/list_item/list_item.dart'; +import 'package:rasadyar_inspection/presentation/widget/custom_chips.dart'; import 'package:rasadyar_inspection/presentation/widget/search.dart'; import 'logic.dart'; @@ -118,35 +119,6 @@ class InspectionMapPage extends GetView { return BaseBottomSheet( height: data.value ? 450.h : 150.h, child: ListItemWithOutCounter( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'داود خرم مهری پور', - style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal), - ), - Text( - 'گوشت و مرغ', - style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover), - ), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text('باقی مانده', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)), - Text( - '0 کیلوگرم', - style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover), - ), - ], - ), - Assets.vec.scanBarcodeSvg.svg(), - ], - ), secondChild: Column( spacing: 8, children: [ @@ -256,13 +228,7 @@ class InspectionMapPage extends GetView { width: 150.w, height: 40.h, onPressed: () { - buildDeleteDialog( - onConfirm: () async { - // controller.denyAllocation(item.key ?? ''); - //await controller.deleteAllocation(item); - }, - onRefresh: () async {}, - ); + buildDeleteDialog(onConfirm: () async {}, onRefresh: () async {}); }, borderColor: AppColor.bgIcon, child: Row( @@ -293,6 +259,35 @@ class InspectionMapPage extends GetView { labelIconColor: AppColor.bgIcon, onTap: () => data.value = !data.value, selected: data.value, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'داود خرم مهری پور', + style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal), + ), + Text( + 'گوشت و مرغ', + style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover), + ), + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('باقی مانده', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)), + Text( + '0 کیلوگرم', + style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover), + ), + ], + ), + Assets.vec.scanBarcodeSvg.svg(), + ], + ), ), ); }, controller.isSelectedDetailsLocation); @@ -428,6 +423,7 @@ Widget filterWidget({required RxInt filterIndex, required RxInt showIndex}) { }, index: 1, ), + customChip( isSelected: data.value == 2, title: 'بازرسی شده ها', @@ -524,225 +520,6 @@ Widget cardWithLabel({ ); } -Widget markerDetailsWidget() { - return Container( - clipBehavior: Clip.antiAlias, - margin: EdgeInsets.all(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.start, - spacing: 12, - children: [ - Text( - 'داود خرم پور', - textAlign: TextAlign.center, - style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkHover), - ), - Spacer(), - vecWidgetWithOnTap( - child: Assets.vec.mapSvg.svg(), - onTap: () { - Get.toNamed(InspectionRoutes.inspectionLocationDetails); - }, - width: 24, - height: 24, - color: AppColor.blueNormal, - ), - vecWidgetWithOnTap( - child: Assets.vec.messageAddSvg.svg(), - width: 24, - height: 24, - color: AppColor.greenNormal, - onTap: () { - Get.toNamed(InspectionRoutes.inspectionAddSupervision); - }, - ), - - vecWidgetWithOnTap( - child: Assets.vec.securityTimeSvg.svg(), - color: AppColor.warning, - height: 24, - width: 24, - onTap: () {}, - ), - ], - ), - 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( - '0 کیلوگرم', - 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 customChip({ - bool isSelected = false, - required String title, - required int index, - required Function(int) onTap, -}) { - return GestureDetector( - onTap: () { - onTap.call(index); - }, - child: Container( - height: 32.h, - padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 8.h), - clipBehavior: Clip.antiAlias, - decoration: BoxDecoration( - color: AppColor.whiteGreyNormal, - borderRadius: BorderRadius.circular(8), - border: Border.all( - width: 1, - color: isSelected ? AppColor.blueNormal : AppColor.blackLightActive, - ), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - - children: [ - SizedBox( - width: 12.w, - height: 12.h, - child: Transform.scale( - scale: 0.70, - child: Checkbox( - value: isSelected, - side: BorderSide(color: AppColor.whiteDarkHover, width: 1), - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - visualDensity: VisualDensity.compact, - overlayColor: WidgetStateProperty.all(AppColor.blueNormal), - fillColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.selected)) { - return AppColor.blueNormal; - } else { - return AppColor.whiteGreyNormal; - } - }), - - onChanged: (value) { - onTap.call(index); - }, - ), - ), - ), - SizedBox(width: 8.w), - Text( - title, - textAlign: TextAlign.center, - style: AppFonts.yekan12.copyWith( - color: isSelected ? AppColor.blueNormal : AppColor.whiteDarkHover, - ), - ), - ], - ), - ), - ); -} Widget selectedLocationWidget({ required bool showHint, diff --git a/packages/inspection/lib/presentation/location_details/logic.dart b/packages/inspection/lib/presentation/pages/location_details/logic.dart similarity index 100% rename from packages/inspection/lib/presentation/location_details/logic.dart rename to packages/inspection/lib/presentation/pages/location_details/logic.dart diff --git a/packages/inspection/lib/presentation/location_details/view.dart b/packages/inspection/lib/presentation/pages/location_details/view.dart similarity index 100% rename from packages/inspection/lib/presentation/location_details/view.dart rename to packages/inspection/lib/presentation/pages/location_details/view.dart diff --git a/packages/inspection/lib/presentation/pages/pages.dart b/packages/inspection/lib/presentation/pages/pages.dart new file mode 100644 index 0000000..35043b5 --- /dev/null +++ b/packages/inspection/lib/presentation/pages/pages.dart @@ -0,0 +1,22 @@ +export 'action/logic.dart'; +export 'action/view.dart'; +export 'add_mobile_inspector/logic.dart'; +export 'add_mobile_inspector/view.dart'; +export 'add_supervision/logic.dart'; +export 'add_supervision/view.dart'; +export 'display_information/logic.dart'; +export 'display_information/view.dart'; +export 'inspection_map/logic.dart'; +export 'inspection_map/view.dart'; +export 'location_details/logic.dart'; +export 'location_details/view.dart'; +export 'profile/logic.dart'; +export 'profile/view.dart'; +export 'records/logic.dart'; +export 'records/view.dart'; +export 'registration_of_violation/logic.dart'; +export 'registration_of_violation/view.dart'; +export 'root/logic.dart'; +export 'root/view.dart'; +export 'statistics/logic.dart'; +export 'statistics/view.dart'; diff --git a/packages/inspection/lib/presentation/profile/logic.dart b/packages/inspection/lib/presentation/pages/profile/logic.dart similarity index 100% rename from packages/inspection/lib/presentation/profile/logic.dart rename to packages/inspection/lib/presentation/pages/profile/logic.dart diff --git a/packages/inspection/lib/presentation/profile/view.dart b/packages/inspection/lib/presentation/pages/profile/view.dart similarity index 100% rename from packages/inspection/lib/presentation/profile/view.dart rename to packages/inspection/lib/presentation/pages/profile/view.dart diff --git a/packages/inspection/lib/presentation/pages/records/logic.dart b/packages/inspection/lib/presentation/pages/records/logic.dart new file mode 100644 index 0000000..a4c1fce --- /dev/null +++ b/packages/inspection/lib/presentation/pages/records/logic.dart @@ -0,0 +1,32 @@ +import 'package:rasadyar_core/core.dart'; + +class RecordsLogic extends GetxController { + Rx>> countList = Resource>.success( + PaginationModel(results: [1, 2, 3, 4, 5, 6], count: 1, next: null, previous: null), + ).obs; + + RxBool isLoadingMore = false.obs; + RxInt currentPage = 1.obs; + RxInt indexExpanded = (-1).obs; + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + } + + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + } + + void toggleExpandedList(int index) { + if (indexExpanded.value == index) { + indexExpanded.value = -1; + } else { + indexExpanded.value = index; + } + } + +} diff --git a/packages/inspection/lib/presentation/pages/records/view.dart b/packages/inspection/lib/presentation/pages/records/view.dart new file mode 100644 index 0000000..24c34cf --- /dev/null +++ b/packages/inspection/lib/presentation/pages/records/view.dart @@ -0,0 +1,184 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; + +import 'logic.dart'; + +class RecordsPage extends GetView { + const RecordsPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + body: ObxValue((data) { + return RPaginatedListView( + listType: ListType.separated, + resource: data.value, + hasMore: data.value.data?.next != null, + isPaginating: controller.isLoadingMore.value, + onRefresh: () async { + controller.currentPage.value = 1; + //await controller.getAllocatedMade(); + }, + onLoadMore: () async { + controller.currentPage.value++; + iLog(controller.currentPage.value); + // await controller.getAllocatedMade(true); + }, + padding: EdgeInsets.fromLTRB(8, 12, 8, 80), + itemBuilder: (context, index) { + var item = data.value.data!.results![index]; + return ObxValue((val) { + return ListItem2( + selected: val.value == index, + onTap: () => controller.toggleExpandedList(index), + index: index, + labelColor: AppColor.blueLight, + labelIcon: Assets.vec.calendarSearchOutlineSvg.path, + labelIconColor: AppColor.bgIcon, + secondChild: itemListExpandedWidget(item, index), + child: itemListWidget(item), + ); + }, controller.indexExpanded); + }, + itemCount: data.value.data?.results?.length ?? 0, + separatorBuilder: (context, index) => SizedBox(height: 8.h), + ); + }, controller.countList), + floatingActionButton: RFab.add(onPressed: () {}), + floatingActionButtonLocation: FloatingActionButtonLocation.startFloat, + ); + } + + Widget itemListWidget(int item) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + spacing: 3, + children: [ + Text('داود خرم مهری پور', style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal)), + Text( + '09302545455', + style: AppFonts.yekan10.copyWith(color: AppColor.darkGreyDarkHover), + ), + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('باقی مانده', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)), + Text('0 کیلوگرم', style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover)), + ], + ), + Assets.vec.scanBarcodeSvg.svg(), + ], + ); + } + + Widget itemListExpandedWidget(int item, int index) { + return Column( + spacing: 8, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 12.w), + child: Column( + spacing: 8, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'داوود خرم پور', + textAlign: TextAlign.center, + style: AppFonts.yekan16.copyWith(color: AppColor.greenDark), + ), + ], + ), + Container( + height: 32.h, + padding: EdgeInsets.symmetric(horizontal: 8), + decoration: ShapeDecoration( + color: AppColor.blueLight, + shape: RoundedRectangleBorder( + side: BorderSide(width: 1.w, color: AppColor.blueLightHover), + borderRadius: BorderRadius.circular(8), + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + spacing: 3, + children: [ + Text( + 'تاریخ بازرسی', + style: AppFonts.yekan14.copyWith(color: AppColor.textColor), + ), + + Text( + '1403/12/12', + style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), + ), + ], + ), + ), + + buildRow( + title: 'تلفن خریدار', + value: '0326598653', + valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), + ), + buildRow(title: 'آخرین فعالیت', value: '1409/12/12'), + buildRow(title: 'موجودی', value: '5KG'), + buildRow(title: 'فروش رفته', value: '5KG'), + ], + ), + ), + Visibility( + visible: true, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + spacing: 16.w, + children: [ + RElevated( + text: 'ویرایش', + width: 150.w, + height: 40.h, + + onPressed: () { + /* controller.setEditData(item); + Get.bottomSheet( + addOrEditBottomSheet(true), + isScrollControlled: true, + backgroundColor: Colors.transparent, + ).whenComplete(() { + controller.clearForm(); + });*/ + }, + textStyle: AppFonts.yekan20.copyWith(color: Colors.white), + backgroundColor: AppColor.blueDark, + ), + ROutlinedElevated( + text: 'حذف', + textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal), + width: 150.w, + height: 40.h, + onPressed: () { + buildDeleteDialog( + onConfirm: () async { + // controller.isExpandedList.remove(index); + // controller.denyAllocation(item.key ?? ''); + //await controller.deleteAllocation(item); + }, + onRefresh: () async {}, + ); + }, + borderColor: AppColor.redNormal, + ), + ], + ), + ), + ], + ); + } +} diff --git a/packages/inspection/lib/presentation/registration_of_violation/logic.dart b/packages/inspection/lib/presentation/pages/registration_of_violation/logic.dart similarity index 100% rename from packages/inspection/lib/presentation/registration_of_violation/logic.dart rename to packages/inspection/lib/presentation/pages/registration_of_violation/logic.dart diff --git a/packages/inspection/lib/presentation/registration_of_violation/view.dart b/packages/inspection/lib/presentation/pages/registration_of_violation/view.dart similarity index 82% rename from packages/inspection/lib/presentation/registration_of_violation/view.dart rename to packages/inspection/lib/presentation/pages/registration_of_violation/view.dart index 2efa87f..371d368 100644 --- a/packages/inspection/lib/presentation/registration_of_violation/view.dart +++ b/packages/inspection/lib/presentation/pages/registration_of_violation/view.dart @@ -1,12 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:rasadyar_inspection/presentation/routes/app_routes.dart'; import 'package:rasadyar_core/core.dart'; -import 'package:rasadyar_core/presentation/widget/buttons/fab.dart'; +import 'package:rasadyar_inspection/presentation/routes/app_routes.dart'; import 'logic.dart'; -class RegistrationOfViolationPage - extends GetView { +class RegistrationOfViolationPage extends GetView { const RegistrationOfViolationPage({super.key}); @override @@ -15,17 +13,12 @@ class RegistrationOfViolationPage backgroundColor: AppColor.bgLight, appBar: RAppBar( title: 'ثبت تخلف', - leading: Assets.vec.messageAddSvg.svg( + leading: Assets.vec.messageAddSvg.svg( width: 16, height: 16, - colorFilter: ColorFilter.mode( - Colors.white, - BlendMode.srcIn, - ), + colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn), ), - additionalActions: [ - RFab.smallAdd(onPressed: () => controller.countViolation.value++), - ], + additionalActions: [RFab.smallAdd(onPressed: () => controller.countViolation.value++)], ), body: Padding( padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), @@ -34,7 +27,7 @@ class RegistrationOfViolationPage Expanded( child: ObxValue((data) { return ListView.separated( - itemBuilder: (context, index) => violationWidget(), + itemBuilder: (context, index) => violationWidget22(), separatorBuilder: (context, index) => SizedBox(height: 15), itemCount: data.value, ); @@ -61,7 +54,7 @@ class RegistrationOfViolationPage } } -Container violationWidget() { +Container violationWidget22() { return Container( padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12), decoration: BoxDecoration( @@ -71,13 +64,13 @@ Container violationWidget() { child: Column( spacing: 16, children: [ - RTextField( + RTextField( controller: TextEditingController(), label: 'عنوان تخلف', filled: true, filledColor: AppColor.whiteLight, ), - RTextField( + RTextField( controller: TextEditingController(), label: 'توضیحات تخلف', filled: true, @@ -85,19 +78,19 @@ Container violationWidget() { maxLines: 3, minLines: 3, ), - RTextField( + RTextField( controller: TextEditingController(), label: 'عنوان تخلف', filled: true, filledColor: AppColor.whiteLight, ), - RTextField( + RTextField( controller: TextEditingController(), label: 'عنوان تخلف', filled: true, filledColor: AppColor.whiteLight, ), - RTextField( + RTextField( controller: TextEditingController(), label: 'توضیحات تخلف', filled: true, @@ -111,7 +104,9 @@ Container violationWidget() { child: Row( spacing: 16, children: [ - Expanded(child: RElevated(text: 'ثبت', onPressed: () {})), + Expanded( + child: RElevated(text: 'ثبت', onPressed: () {}), + ), Expanded( child: ROutlinedElevated(text: 'انصراف', onPressed: () {}), ), diff --git a/packages/inspection/lib/presentation/root/logic.dart b/packages/inspection/lib/presentation/pages/root/logic.dart similarity index 87% rename from packages/inspection/lib/presentation/root/logic.dart rename to packages/inspection/lib/presentation/pages/root/logic.dart index 26c3d93..3e2df1e 100644 --- a/packages/inspection/lib/presentation/root/logic.dart +++ b/packages/inspection/lib/presentation/pages/root/logic.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:rasadyar_core/core.dart' ; -import 'package:rasadyar_inspection/presentation/action/view.dart'; -import 'package:rasadyar_inspection/presentation/filter/view.dart'; -import 'package:rasadyar_inspection/presentation/inspection_map/view.dart'; -import 'package:rasadyar_inspection/presentation/profile/view.dart'; +import 'package:rasadyar_core/core.dart'; +import 'package:rasadyar_inspection/presentation/pages/action/view.dart'; +import 'package:rasadyar_inspection/presentation/pages/inspection_map/view.dart'; +import 'package:rasadyar_inspection/presentation/pages/profile/view.dart'; + enum ErrorLocationType { serviceDisabled, permissionDenied, none } @@ -37,19 +37,16 @@ class RootLogic extends GetxController { requestResult != LocationPermission.deniedForever; case LocationPermission.deniedForever: - return request ? await Geolocator.openAppSettings() : false; case LocationPermission.always: case LocationPermission.whileInUse: - return true; default: return false; } } catch (e) { - eLog(e); return await Geolocator.openLocationSettings(); } diff --git a/packages/inspection/lib/presentation/root/view.dart b/packages/inspection/lib/presentation/pages/root/view.dart similarity index 100% rename from packages/inspection/lib/presentation/root/view.dart rename to packages/inspection/lib/presentation/pages/root/view.dart diff --git a/packages/inspection/lib/presentation/pages/statistics/logic.dart b/packages/inspection/lib/presentation/pages/statistics/logic.dart new file mode 100644 index 0000000..256523a --- /dev/null +++ b/packages/inspection/lib/presentation/pages/statistics/logic.dart @@ -0,0 +1,63 @@ +import 'package:rasadyar_core/core.dart'; + +class StatisticsLogic extends GetxController { + List transactionFilters = ['همه', 'دارای تراکنش', 'بدون تراکنش']; + RxList transactionFiltersSelected = RxList(); + RxList iranProvinces = [ + 'آذربایجان شرقی', + 'آذربایجان غربی', + 'اردبیل', + 'اصفهان', + 'البرز', + 'ایلام', + 'بوشهر', + 'تهران', + 'چهارمحال و بختیاری', + 'خراسان جنوبی', + 'خراسان رضوی', + 'خراسان شمالی', + 'خوزستان', + 'زنجان', + 'سمنان', + 'سیستان و بلوچستان', + 'فارس', + 'قزوین', + 'قم', + 'کردستان', + 'کرمان', + 'کرمانشاه', + 'کهگیلویه و بویراحمد', + 'گلستان', + 'گیلان', + 'لرستان', + 'مازندران', + 'مرکزی', + 'هرمزگان', + 'همدان', + 'یزد', + ].obs; + RxnString iranProvincesSelected = RxnString(); + RxInt s1 =2536524448.obs; + RxInt s2 =2536524448.obs; + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + } + + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + } + + void onTransactionFilterSelected(int index) { + if (transactionFiltersSelected.contains(index)) { + transactionFiltersSelected.remove(index); + } else { + transactionFiltersSelected.add(index); + } + update(); + } +} diff --git a/packages/inspection/lib/presentation/pages/statistics/view.dart b/packages/inspection/lib/presentation/pages/statistics/view.dart new file mode 100644 index 0000000..e369e6f --- /dev/null +++ b/packages/inspection/lib/presentation/pages/statistics/view.dart @@ -0,0 +1,324 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; +import 'package:rasadyar_inspection/presentation/widget/custom_chips.dart'; + +import 'logic.dart'; + +class StatisticsPage extends GetView { + const StatisticsPage({super.key}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 12, vertical: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + spacing: 10, + children: [ + Expanded( + child: Container( + height: 32.h, + decoration: BoxDecoration( + border: Border.all(color: AppColor.blueNormal, width: 1), + borderRadius: BorderRadius.circular(8), + ), + padding: EdgeInsets.symmetric(horizontal: 11.w, vertical: 4.h), + child: Row( + children: [ + Assets.vec.calendarSvg.svg( + colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn), + ), + SizedBox(width: 4.w), + Text('از', style: AppFonts.yekan16.copyWith(color: AppColor.blueNormal)), + SizedBox(width: 22.w), + + Text( + '1404/12/12', + textAlign: TextAlign.center, + style: AppFonts.yekan16.copyWith(color: AppColor.lightGreyNormalActive), + ), + ], + ), + ), + ), + Expanded( + child: Container( + height: 32.h, + decoration: BoxDecoration( + border: Border.all(color: AppColor.blueNormal, width: 1), + borderRadius: BorderRadius.circular(8), + ), + padding: EdgeInsets.symmetric(horizontal: 11.w, vertical: 4.h), + child: Row( + children: [ + Assets.vec.calendarSvg.svg( + colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn), + ), + SizedBox(width: 4.w), + Text('تا', style: AppFonts.yekan16.copyWith(color: AppColor.blueNormal)), + SizedBox(width: 22.w), + + Text( + '1404/12/12', + textAlign: TextAlign.center, + style: AppFonts.yekan16.copyWith(color: AppColor.lightGreyNormalActive), + ), + ], + ), + ), + ), + ], + ), + ), + + SizedBox(height: 16.h), + + Container( + height: 80.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + border: Border.all(color: AppColor.lightGreyNormalHover, width: 1), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 8, + children: [ + Row( + children: [ + Text( + 'فیلتر تراکنش ها', + textAlign: TextAlign.right, + style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), + ), + ], + ), + Expanded( + child: ListView.separated( + shrinkWrap: true, + physics: const BouncingScrollPhysics(), + scrollDirection: Axis.horizontal, + itemBuilder: (context, index) => ObxValue((selectedIndex) { + return customChip( + title: controller.transactionFilters[index], + isSelected: selectedIndex.contains(index), + index: index, + onTap: (data) => controller.onTransactionFilterSelected(data), + ); + }, controller.transactionFiltersSelected), + separatorBuilder: (context, index) => SizedBox(width: 8), + itemCount: controller.transactionFilters.length, + ), + ), + ], + ), + ), + ), + SizedBox(height: 8.h), + Container( + height: 80.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + border: Border.all(color: AppColor.lightGreyNormalHover, width: 1), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 8, + children: [ + Row( + children: [ + Text( + 'فیلتر شهرستان', + textAlign: TextAlign.right, + style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), + ), + ], + ), + Expanded(child: _provinceDropdownWidget()), + ], + ), + ), + ), + SizedBox(height: 8.h), + Container( + height: 152.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + border: Border.all(color: AppColor.lightGreyNormalHover, width: 1), + ), + child: Padding( + padding: const EdgeInsets.fromLTRB(0, 10, 0, 13), + child: Row( + spacing: 8, + children: [ + Expanded( + child: ObxValue( + (data) => _informationLabelCard( + title: 'تعداد تراکنش ها', + titleColor: AppColor.blueNormal, + isLoading: data.value == null, + description: 25369654.separatedByComma, + iconPath: Assets.vec.cubeSearchSvg.path, + iconColor: AppColor.blueNormal, + bgDescriptionColor: Colors.white, + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [AppColor.blueLight, Colors.white], + ), + ), + controller.s1, + ), + ), + + Expanded( + child: ObxValue((data) { + return _informationLabelCard( + title: 'جمع تراکنش ها', + isLoading: data.value == null, + description: data.value.separatedByComma ?? '0', + unit: 'ريال', + iconPath: Assets.vec.cubeWattingSvg.path, + bgDescriptionColor: Colors.white, + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [const Color(0xFFFFE7BB), Colors.white], + ), + ); + }, controller.s2), + ), + ], + ), + ), + ), + ], + ), + ); + } + + Widget _provinceDropdownWidget() { + return ObxValue((data) { + return OverlayDropdownWidget( + items: data, + onChanged: (value) { + controller.iranProvincesSelected.value = value; + controller.iranProvincesSelected.refresh(); + }, + selectedItem: controller.iranProvincesSelected.value, + itemBuilder: (item) => Text( + item ?? 'بدون نام', + style: AppFonts.yekan14.copyWith(color: AppColor.lightGreyDarker), + ), + labelBuilder: (item) => + Text('انتخاب استان', style: AppFonts.yekan14.copyWith(color: AppColor.textColorLight)), + ); + }, controller.iranProvinces); + } + + Container _informationLabelCard({ + required String title, + required String description, + required String iconPath, + required Color bgDescriptionColor, + String? unit, + bool isLoading = false, + Color? iconColor, + Color? titleColor, + Color? bgLabelColor, + LinearGradient? gradient, + }) { + return Container( + height: 82.h, + margin: EdgeInsets.symmetric(horizontal: 12.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + border: Border.all(color: AppColor.lightGreyNormalHover, width: 1), + ), + clipBehavior: Clip.hardEdge, + child: Row( + children: [ + // Left side with icon and title + Expanded( + flex: 2, + child: Container( + height: 82.h, + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + color: gradient == null ? bgLabelColor : null, + borderRadius: BorderRadius.only( + topRight: Radius.circular(8), + bottomRight: Radius.circular(8), + ), + gradient: gradient, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + spacing: 4, + children: [ + SvgGenImage.vec(iconPath).svg( + width: 24, + height: 24, + colorFilter: iconColor != null + ? ColorFilter.mode(iconColor, BlendMode.srcIn) + : null, + ), + Text( + title, + textAlign: TextAlign.right, + style: AppFonts.yekan10.copyWith( + color: titleColor ?? AppColor.mediumGreyDarkActive, + ), + ), + ], + ), + ), + ), + // Right side with description and unit + Expanded( + flex: 3, + child: Container( + decoration: BoxDecoration( + color: bgDescriptionColor, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + bottomLeft: Radius.circular(8), + ), + ), + child: isLoading + ? Center(child: CupertinoActivityIndicator()) + : Column( + mainAxisAlignment: MainAxisAlignment.center, + spacing: 4, + children: [ + Text( + description, + textAlign: TextAlign.right, + style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive), + ), + Visibility( + visible: unit != null, + child: Text( + unit, + textAlign: TextAlign.center, + style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive), + ), + ), + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/packages/inspection/lib/presentation/pages/users/logic.dart b/packages/inspection/lib/presentation/pages/users/logic.dart new file mode 100644 index 0000000..d7490ba --- /dev/null +++ b/packages/inspection/lib/presentation/pages/users/logic.dart @@ -0,0 +1,33 @@ +import 'package:rasadyar_core/core.dart'; + +class UsersLogic extends GetxController { + Rx>> countList = Resource>.success( + PaginationModel(results: [1, 2, 3, 4, 5, 6], count: 1, next: null, previous: null), + ).obs; + + RxBool isLoadingMore = false.obs; + RxInt currentPage = 1.obs; + RxInt indexExpanded = (-1).obs; + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + } + + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + } + + + + void toggleExpandedList(int index) { + if (indexExpanded.value == index) { + indexExpanded.value = -1; + } else { + indexExpanded.value = index; + } + } +} diff --git a/packages/inspection/lib/presentation/pages/users/view.dart b/packages/inspection/lib/presentation/pages/users/view.dart new file mode 100644 index 0000000..3ac9419 --- /dev/null +++ b/packages/inspection/lib/presentation/pages/users/view.dart @@ -0,0 +1,190 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; + +import 'logic.dart'; + +class UsersPage extends GetView { + const UsersPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + body: ObxValue((data) { + return RPaginatedListView( + listType: ListType.separated, + resource: data.value, + hasMore: data.value.data?.next != null, + isPaginating: controller.isLoadingMore.value, + onRefresh: () async { + controller.currentPage.value = 1; + //await controller.getAllocatedMade(); + }, + onLoadMore: () async { + controller.currentPage.value++; + iLog(controller.currentPage.value); + // await controller.getAllocatedMade(true); + }, + padding: EdgeInsets.fromLTRB(8, 12, 8, 80), + itemBuilder: (context, index) { + var item = data.value.data!.results![index]; + return ObxValue((val) { + return ListItem2( + selected: val.value == index, + onTap: () => controller.toggleExpandedList(index), + index: index, + labelColor: AppColor.blueLight, + labelIcon: Assets.vec.profile2OutlineSvg.path, + labelIconColor: AppColor.bgIcon, + secondChild: itemListExpandedWidget(item, index), + child: itemListWidget(item), + ); + }, controller.indexExpanded); + }, + itemCount: data.value.data?.results?.length ?? 0, + separatorBuilder: (context, index) => SizedBox(height: 8.h), + ); + }, controller.countList), + floatingActionButton: RFab.add(onPressed: () {}), + floatingActionButtonLocation: FloatingActionButtonLocation.startFloat, + ); + } + + Widget itemListWidget(int item) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + spacing: 3, + children: [ + Text( + 'داود خرم مهری پور', + style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal), + ), + Text( + '09302545455', + style: AppFonts.yekan10.copyWith(color: AppColor.darkGreyDarkHover), + ), + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('باقی مانده', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)), + Text( + '0 کیلوگرم', + style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover), + ), + ], + ), + Assets.vec.scanBarcodeSvg.svg(), + ], + ); + } + + Widget itemListExpandedWidget(int item, int index) { + return Column( + spacing: 8, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 12.w), + child: Column( + spacing: 8, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'داوود خرم پور', + textAlign: TextAlign.center, + style: AppFonts.yekan16.copyWith(color: AppColor.greenDark), + ), + ], + ), + Container( + height: 32.h, + padding: EdgeInsets.symmetric(horizontal: 8), + decoration: ShapeDecoration( + color: AppColor.blueLight, + shape: RoundedRectangleBorder( + side: BorderSide(width: 1.w, color: AppColor.blueLightHover), + borderRadius: BorderRadius.circular(8), + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + spacing: 3, + children: [ + Text( + 'تاریخ بازرسی', + style: AppFonts.yekan14.copyWith(color: AppColor.textColor), + ), + + Text( + '1403/12/12', + style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), + ), + ], + ), + ), + + buildRow( + title: 'تلفن خریدار', + value: '0326598653', + valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), + ), + buildRow(title: 'آخرین فعالیت', value: '1409/12/12'), + buildRow(title: 'موجودی', value: '5KG'), + buildRow(title: 'فروش رفته', value: '5KG'), + ], + ), + ), + Visibility( + visible:true, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + spacing: 16.w, + children: [ + RElevated( + text: 'ویرایش', + width: 150.w, + height: 40.h, + + onPressed: () { + /* controller.setEditData(item); + Get.bottomSheet( + addOrEditBottomSheet(true), + isScrollControlled: true, + backgroundColor: Colors.transparent, + ).whenComplete(() { + controller.clearForm(); + });*/ + }, + textStyle: AppFonts.yekan20.copyWith(color: Colors.white), + backgroundColor: AppColor.blueDark, + ), + ROutlinedElevated( + text: 'حذف', + textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal), + width: 150.w, + height: 40.h, + onPressed: () { + buildDeleteDialog( + onConfirm: () async { + // controller.isExpandedList.remove(index); + // controller.denyAllocation(item.key ?? ''); + //await controller.deleteAllocation(item); + }, + onRefresh: () async{} + ); + }, + borderColor: AppColor.redNormal, + ), + ], + ), + ), + ], + ); + } +} diff --git a/packages/inspection/lib/presentation/routes/app_pages.dart b/packages/inspection/lib/presentation/routes/app_pages.dart index 816ae56..5492bfe 100644 --- a/packages/inspection/lib/presentation/routes/app_pages.dart +++ b/packages/inspection/lib/presentation/routes/app_pages.dart @@ -1,22 +1,7 @@ -import 'package:rasadyar_auth/auth.dart'; import 'package:rasadyar_core/core.dart'; -import 'package:rasadyar_inspection/presentation/action/logic.dart'; -import 'package:rasadyar_inspection/presentation/add_mobile_inspector/logic.dart'; -import 'package:rasadyar_inspection/presentation/add_mobile_inspector/view.dart'; -import 'package:rasadyar_inspection/presentation/add_supervision/logic.dart'; -import 'package:rasadyar_inspection/presentation/add_supervision/view.dart'; -import 'package:rasadyar_inspection/presentation/display_information/logic.dart'; -import 'package:rasadyar_inspection/presentation/display_information/view.dart'; -import 'package:rasadyar_inspection/presentation/filter/logic.dart'; -import 'package:rasadyar_inspection/presentation/inspection_map/logic.dart'; -import 'package:rasadyar_inspection/presentation/location_details/logic.dart'; -import 'package:rasadyar_inspection/presentation/location_details/view.dart'; -import 'package:rasadyar_inspection/presentation/profile/logic.dart'; -import 'package:rasadyar_inspection/presentation/profile/view.dart'; -import 'package:rasadyar_inspection/presentation/registration_of_violation/logic.dart'; -import 'package:rasadyar_inspection/presentation/registration_of_violation/view.dart'; -import 'package:rasadyar_inspection/presentation/root/logic.dart'; -import 'package:rasadyar_inspection/presentation/root/view.dart'; +import 'package:rasadyar_inspection/presentation/pages/filter/logic.dart'; +import 'package:rasadyar_inspection/presentation/pages/pages.dart'; +import 'package:rasadyar_inspection/presentation/pages/users/logic.dart'; import 'package:rasadyar_inspection/presentation/routes/app_routes.dart'; import 'package:rasadyar_inspection/presentation/widget/base_page/logic.dart'; @@ -29,10 +14,13 @@ sealed class InspectionPages { page: () => RootPage(), binding: BindingsBuilder(() { - Get.put(RootLogic()); - Get.put(InspectorFilterLogic()); - Get.lazyPut(()=>InspectionMapLogic()); - Get.lazyPut(()=>BaseLogic()); + Get.lazyPut(() =>RootLogic()); + Get.lazyPut(() =>InspectorFilterLogic()); + Get.lazyPut(() => InspectionMapLogic()); + Get.lazyPut(() => BaseLogic()); + Get.lazyPut(() => UsersLogic()); + Get.lazyPut(() => RecordsLogic()); + Get.lazyPut(() => StatisticsLogic()); Get.lazyPut(() => LocationDetailsLogic(), fenix: true); Get.lazyPut(() => ActionLogic(), fenix: true); Get.lazyPut(() => ProfileLogic(), fenix: true); diff --git a/packages/inspection/lib/presentation/widget/custom_chips.dart b/packages/inspection/lib/presentation/widget/custom_chips.dart new file mode 100644 index 0000000..07e4a4b --- /dev/null +++ b/packages/inspection/lib/presentation/widget/custom_chips.dart @@ -0,0 +1,68 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; + +Widget customChip({ + bool isSelected = false, + required String title, + required int index, + required Function(int) onTap, +}) { + return GestureDetector( + onTap: () { + onTap.call(index); + }, + child: Container( + height: 32.h, + padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 8.h), + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + color: AppColor.whiteGreyNormal, + borderRadius: BorderRadius.circular(8), + border: Border.all( + width: 1, + color: isSelected ? AppColor.blueNormal : AppColor.blackLightActive, + ), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + + children: [ + SizedBox( + width: 12.w, + height: 12.h, + child: Transform.scale( + scale: 0.70, + child: Checkbox( + value: isSelected, + side: BorderSide(color: AppColor.whiteDarkHover, width: 1), + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + visualDensity: VisualDensity.compact, + overlayColor: WidgetStateProperty.all(AppColor.blueNormal), + fillColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.selected)) { + return AppColor.blueNormal; + } else { + return AppColor.whiteGreyNormal; + } + }), + + onChanged: (value) { + onTap.call(index); + }, + ), + ), + ), + SizedBox(width: 8.w), + Text( + title, + textAlign: TextAlign.center, + style: AppFonts.yekan12.copyWith( + color: isSelected ? AppColor.blueNormal : AppColor.whiteDarkHover, + ), + ), + ], + ), + ), + ); +} diff --git a/packages/inspection/lib/presentation/widget/list_item/list_item.dart b/packages/inspection/lib/presentation/widget/list_item/list_item.dart deleted file mode 100644 index 3b48ae2..0000000 --- a/packages/inspection/lib/presentation/widget/list_item/list_item.dart +++ /dev/null @@ -1,343 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:rasadyar_core/core.dart'; - -class ListItem extends StatelessWidget { - const ListItem({ - super.key, - required this.index, - required this.child, - required this.secondChild, - required this.labelColor, - required this.labelIcon, - required this.onTap, - required this.selected, - this.labelIconColor = AppColor.mediumGreyDarkHover, - }); - - final int index; - final Widget child; - final Widget secondChild; - final Color labelColor; - final String labelIcon; - final Color? labelIconColor; - final VoidCallback onTap; - final bool selected; - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: onTap, - child: Container( - width: Get.width, - margin: const EdgeInsets.fromLTRB(0, 0, 10, 0), - decoration: BoxDecoration( - color: labelColor, - borderRadius: BorderRadius.circular(8), - border: Border.all(width: 1, color: AppColor.lightGreyNormalHover), - ), - child: AnimatedSize( - duration: Duration(milliseconds: 400), - alignment: Alignment.center, - child: Stack( - clipBehavior: Clip.none, - alignment: Alignment.centerRight, - children: [ - AnimatedSize( - duration: Duration(milliseconds: 300), - child: Container( - width: Get.width - 30, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Colors.transparent, - borderRadius: BorderRadius.circular(8), - ), - child: Row( - children: [ - Expanded( - child: AnimatedCrossFade( - alignment: Alignment.center, - firstChild: Container( - height: 75, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - bottomLeft: Radius.zero, - bottomRight: Radius.circular(8), - topLeft: Radius.zero, - topRight: Radius.circular(8), - ), - ), - clipBehavior: Clip.antiAlias, - child: child, - ), - secondChild: Container( - padding: EdgeInsets.fromLTRB(8, 12, 14, 12), - clipBehavior: Clip.antiAlias, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - ), - child: secondChild, - ), - crossFadeState: selected - ? CrossFadeState.showSecond - : CrossFadeState.showFirst, - duration: Duration(milliseconds: 300), - ), - ), - Container( - width: 20, - child: Center( - child: SvgGenImage.vec(labelIcon).svg( - width: 16.w, - height: 16.h, - colorFilter: ColorFilter.mode(labelColor, BlendMode.srcIn), - ), - ), - ), - ], - ), - ), - ), - - Positioned( - right: -12, - child: Container( - width: index < 999 ? 24 : null, - height: index < 999 ? 24 : null, - padding: EdgeInsets.all(2), - decoration: BoxDecoration( - color: AppColor.greenLightHover, - borderRadius: BorderRadius.circular(4), - border: Border.all(width: 0.50, color: AppColor.greenDarkActive), - ), - alignment: Alignment.center, - child: Text( - (index + 1).toString(), - style: AppFonts.yekan12.copyWith(color: Colors.black), - ), - ), - ), - ], - ), - ), - ), - ); - } -} - -class ListItemWithOutCounter extends StatelessWidget { - const ListItemWithOutCounter({ - super.key, - required this.child, - required this.secondChild, - required this.labelColor, - required this.labelIcon, - required this.onTap, - required this.selected, - this.labelIconColor = AppColor.mediumGreyDarkHover, - }); - - final Widget child; - final Widget secondChild; - final Color labelColor; - final String labelIcon; - final Color? labelIconColor; - final VoidCallback onTap; - final bool selected; - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: onTap, - child: Container( - width: Get.width, - margin: const EdgeInsets.fromLTRB(0, 0, 10, 0), - decoration: BoxDecoration( - color: labelColor, - borderRadius: BorderRadius.circular(8), - border: Border.all(width: 1, color: AppColor.lightGreyNormalHover), - ), - child: AnimatedSize( - duration: Duration(milliseconds: 400), - alignment: Alignment.center, - child: AnimatedSize( - duration: Duration(milliseconds: 300), - child: Container( - width: Get.width - 30, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Colors.transparent, - borderRadius: BorderRadius.circular(8), - ), - child: Row( - children: [ - Expanded( - child: AnimatedCrossFade( - alignment: Alignment.center, - firstChild: Container( - height: 75, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - bottomLeft: Radius.zero, - bottomRight: Radius.circular(8), - topLeft: Radius.zero, - topRight: Radius.circular(8), - ), - ), - clipBehavior: Clip.antiAlias, - child: child, - ), - secondChild: Container( - padding: EdgeInsets.all(8), - clipBehavior: Clip.antiAlias, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - ), - child: secondChild, - ), - crossFadeState: selected - ? CrossFadeState.showSecond - : CrossFadeState.showFirst, - duration: Duration(milliseconds: 300), - ), - ), - Visibility( - visible: selected==false, - child: Container( - width: 20, - child: Center( - child: SvgGenImage.vec(labelIcon).svg( - width: 16.w, - height: 16.h, - colorFilter: ColorFilter.mode(labelColor, BlendMode.srcIn), - ), - ), - ), - ), - ], - ), - ), - ), - ), - ), - ); - } -} - -class ListItem2 extends StatelessWidget { - const ListItem2({ - super.key, - required this.index, - required this.child, - required this.secondChild, - required this.labelColor, - required this.labelIcon, - required this.onTap, - required this.selected, - this.labelIconColor = AppColor.mediumGreyDarkHover, - }); - - final int index; - final Widget child; - final Widget secondChild; - final Color labelColor; - final String labelIcon; - final Color? labelIconColor; - final VoidCallback onTap; - final bool selected; - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: onTap, - child: Container( - width: Get.width, - margin: const EdgeInsets.fromLTRB(0, 0, 10, 0), - decoration: BoxDecoration( - color: labelColor, - borderRadius: BorderRadius.circular(8), - border: Border.all(width: 1, color: AppColor.lightGreyNormalHover), - ), - child: AnimatedSize( - duration: Duration(milliseconds: 400), - alignment: Alignment.center, - child: Stack( - clipBehavior: Clip.none, - alignment: Alignment.centerRight, - children: [ - AnimatedCrossFade( - firstChild: Row( - children: [ - Expanded( - child: Container( - height: 75, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - bottomLeft: Radius.zero, - bottomRight: Radius.circular(8), - topLeft: Radius.zero, - topRight: Radius.circular(8), - ), - ), - clipBehavior: Clip.antiAlias, - child: child, - ), - ), - Container( - width: 20, - child: Center( - child: SvgGenImage.vec(labelIcon).svg( - width: 16.w, - height: 16.h, - //TODO - colorFilter: ColorFilter.mode( - labelIconColor ?? AppColor.mediumGreyDarkActive, - BlendMode.srcIn, - ), - ), - ), - ), - ], - ), - secondChild: Container( - padding: EdgeInsets.fromLTRB(8, 8, 12, 12), - clipBehavior: Clip.antiAlias, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - ), - child: secondChild, - ), - crossFadeState: selected ? CrossFadeState.showSecond : CrossFadeState.showFirst, - duration: Duration(milliseconds: 300), - ), - - Positioned( - right: -12, - child: Container( - width: index < 999 ? 24 : null, - height: index < 999 ? 24 : null, - padding: EdgeInsets.all(2), - decoration: BoxDecoration( - color: AppColor.greenLightHover, - borderRadius: BorderRadius.circular(4), - border: Border.all(width: 0.50, color: AppColor.greenDarkActive), - ), - alignment: Alignment.center, - child: Text( - (index + 1).toString(), - style: AppFonts.yekan12.copyWith(color: Colors.black), - ), - ), - ), - ], - ), - ), - ), - ); - } -} diff --git a/tools/vecGeneratoe.sh b/tools/vecGeneratoe.sh index 178436a..0240a5d 100644 --- a/tools/vecGeneratoe.sh +++ b/tools/vecGeneratoe.sh @@ -74,3 +74,7 @@ find "$sourcePath" -type f | xargs -P 10 -I {} bash -c ' ' git add . + +cd ../ + +dart run build_runner build --delete-conflicting-outputs