diff --git a/android/local.properties b/android/local.properties index a2b3710..f0fbc5c 100644 --- a/android/local.properties +++ b/android/local.properties @@ -1,5 +1,5 @@ sdk.dir=C:\\Users\\Housh11\\AppData\\Local\\Android\\sdk flutter.sdk=C:\\src\\flutter flutter.buildMode=debug -flutter.versionName=1.3.41 -flutter.versionCode=37 \ No newline at end of file +flutter.versionName=1.3.42 +flutter.versionCode=38 \ No newline at end of file diff --git a/packages/chicken/lib/features/poultry_science/presentation/widgets/submit_inspection_bottom_sheet/step2_page.dart b/packages/chicken/lib/features/poultry_science/presentation/widgets/submit_inspection_bottom_sheet/step2_page.dart index d4b1e73..3edc579 100644 --- a/packages/chicken/lib/features/poultry_science/presentation/widgets/submit_inspection_bottom_sheet/step2_page.dart +++ b/packages/chicken/lib/features/poultry_science/presentation/widgets/submit_inspection_bottom_sheet/step2_page.dart @@ -619,6 +619,7 @@ GestureDetector containerChips({ onTap: () => onTap(index), child: Container( height: 24.h, + padding: EdgeInsets.symmetric(horizontal: 12.w), decoration: BoxDecoration( color: index == selectedIndex ? AppColor.green1Normal diff --git a/packages/chicken/lib/presentation/widget/sdui/form/sdui_form_widget.dart b/packages/chicken/lib/presentation/widget/sdui/form/sdui_form_widget.dart index b6da26c..1e125e9 100644 --- a/packages/chicken/lib/presentation/widget/sdui/form/sdui_form_widget.dart +++ b/packages/chicken/lib/presentation/widget/sdui/form/sdui_form_widget.dart @@ -1548,7 +1548,27 @@ class SDUIFormWidget extends StatelessWidget { child: Row( spacing: 10.w, children: [ + Expanded( + child: ROutlinedElevated( + height: 40.h, + enabled: canGoPrevious, + onPressed: canGoPrevious + ? () { + formController.previousStep(state); + if (onStateChanged != null) { + onStateChanged!( + stepperKey, + formController.currentStep.value, + ); + } + } + : null, + child: Text('قبلی'), + borderColor: AppColor.blueNormal, + ), + ), + Expanded( flex: 2, child: RElevated( height: 40.h, @@ -1570,25 +1590,7 @@ class SDUIFormWidget extends StatelessWidget { backgroundColor: AppColor.blueNormal, ), ), - Expanded( - child: ROutlinedElevated( - height: 40.h, - enabled: canGoPrevious, - onPressed: canGoPrevious - ? () { - formController.previousStep(state); - if (onStateChanged != null) { - onStateChanged!( - stepperKey, - formController.currentStep.value, - ); - } - } - : null, - child: Text('قبلی'), - borderColor: AppColor.blueNormal, - ), - ), + ], ), ); diff --git a/packages/chicken/lib/presentation/widget/sdui/form/ts_with_stepper copy.json b/packages/chicken/lib/presentation/widget/sdui/form/ts_with_stepper copy.json deleted file mode 100644 index a76a847..0000000 --- a/packages/chicken/lib/presentation/widget/sdui/form/ts_with_stepper copy.json +++ /dev/null @@ -1,640 +0,0 @@ -{ - "info": { - "type": "column", - "visible": true, - "visible_condition": null, - "spacing": 30.0, - "children": [ - { - "type": "stepper", - "visible": true, - "visible_condition": null, - "data": { - "key": "activeStepperIndex", - "total_steps": 2, - "active_step": 0 - } - }, - { - "type": "card_label_item", - "visible": true, - "visible_condition": "activeStepperIndex == 0", - "data": { - "title": "اطلاعات پایه واحد", - "padding_horizontal": 12.0, - "padding_vertical": 11.0 - }, - "child": { - "type": "column", - "visible": true, - "visible_condition": null, - "spacing": 10.0, - "children": [ - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "unit_name", - "label": "نام واحد مرغداری", - "keyboard_type": "text", - "readonly": true - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "breeding_unique_id", - "label": "کد یکتا / شناسه واحد", - "keyboard_type": "text", - "readonly": true - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "health_license", - "label": "پروانه بهداشتی", - "keyboard_type": "text" - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "tenant_status", - "label": "وضعیت مستاجر", - "keyboard_type": "text" - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": "tenant_status == 'دارد'", - "data": { - "key": "tenant_name", - "label": "نام مستاجر", - "keyboard_type": "text" - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": "tenant_status == 'دارد'", - "data": { - "key": "tenant_national_id", - "label": "کد ملی مستاجر", - "keyboard_type": "text" - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": "tenant_status == 'دارد'", - "data": { - "key": "tenant_phone_number", - "label": "شماره تماس مستاجر", - "keyboard_type": "text" - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "owner_national_code", - "label": "کد ملی بهره‌بردار", - "keyboard_type": "text", - "readonly": true - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "owner_phone_number", - "label": "شماره تماس بهره‌بردار", - "keyboard_type": "text", - "readonly": true - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "total_capacity", - "label": "ظرفیت اسمی سالن‌ها", - "keyboard_type": "number", - "comma_separator": true - } - } - ] - } - }, - { - "type": "card_label_item", - "visible": true, - "visible_condition": "activeStepperIndex == 0", - "data": { - "title": "اطلاعات جوجه ریزی", - "padding_horizontal": 12.0, - "padding_vertical": 11.0 - }, - "child": { - "type": "column", - "visible": true, - "visible_condition": null, - "spacing": 10.0, - "children": [ - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "hatching_date", - "label": "تاریخ جوجه ریزی", - "keyboard_type": "text", - "readonly": true - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "visit_date", - "label": "تاریخ بازدید", - "keyboard_type": "text", - "readonly": true - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "hatching_count", - "label": "تعداد جوجه‌ریزی اولیه", - "keyboard_type": "number", - "readonly": true, - "comma_separator": true - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "hatching_breed", - "label": "نوع نژاد", - "keyboard_type": "text" - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "hatching_average_weight", - "label": "میانگین وزن جوجه", - "keyboard_type": "number", - "comma_separator": true - } - }, - { - "type": "image_picker", - "visible": true, - "visible_condition": null, - "data": { - "key": "pultry_images", - "label": "تعداد موجود فعلی" - } - }, - { - "type": "chip_selection", - "visible": true, - "visible_condition": null, - "data": { - "key": "sanitary_condition_of_the_hall", - "label": "وضعیت بهداشتی سالن", - "selectedIndex": -1, - "options": [ - { - "index": 0, - "label": "عالی", - "value": "عالی" - }, - { - "index": 1, - "label": "خوب", - "value": "خوب" - }, - { - "index": 2, - "label": "متوسط", - "value": "متوسط" - }, - { - "index": 3, - "label": "ضعیف", - "value": "ضعیف" - } - ] - } - }, - { - "type": "chip_selection", - "visible": true, - "visible_condition": null, - "data": { - "key": "ventilation_status", - "label": "وضعیت تهویه", - "selectedIndex": -1, - "options": [ - { - "index": 0, - "label": "عالی", - "value": "عالی" - }, - { - "index": 1, - "label": "خوب", - "value": "خوب" - }, - { - "index": 2, - "label": "متوسط", - "value": "متوسط" - }, - { - "index": 3, - "label": "ضعیف", - "value": "ضعیف" - } - ] - } - }, - { - "type": "chip_selection", - "visible": true, - "visible_condition": null, - "data": { - "key": "bedding_status", - "label": "وضعیت بستر", - "selectedIndex": -1, - "options": [ - { - "index": 0, - "label": "خشک", - "value": "خشک" - }, - { - "index": 1, - "label": "نیمه‌مرطوب", - "value": "نیمه‌مرطوب" - }, - { - "index": 2, - "label": "مرطوب", - "value": "مرطوب" - } - ] - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "hatching_temperature", - "label": "دمای سالن", - "keyboard_type": "number" - } - } - ] - } - }, - { - "type": "card_label_item", - "visible": true, - "visible_condition": "activeStepperIndex == 1", - "data": { - "title": "وضعیت عمومی سالن", - "padding_horizontal": 12.0, - "padding_vertical": 11.0 - }, - "child": { - "type": "column", - "visible": true, - "visible_condition": null, - "spacing": 10.0, - "children": [ - { - "type": "image_picker", - "visible": true, - "visible_condition": null, - "data": { - "key": "pultry_images", - "label": "تعداد موجود فعلی" - } - }, - { - "type": "chip_selection", - "visible": true, - "visible_condition": null, - "data": { - "key": "sanitary_condition_of_the_hall", - "label": "وضعیت بهداشتی سالن", - "selectedIndex": -1, - "options": [ - { - "index": 0, - "label": "عالی", - "value": "عالی" - }, - { - "index": 1, - "label": "خوب", - "value": "خوب" - }, - { - "index": 2, - "label": "متوسط", - "value": "متوسط" - }, - { - "index": 3, - "label": "ضعیف", - "value": "ضعیف" - } - ] - } - }, - { - "type": "chip_selection", - "visible": true, - "visible_condition": null, - "data": { - "key": "ventilation_status", - "label": "وضعیت تهویه", - "selectedIndex": -1, - "options": [ - { - "index": 0, - "label": "عالی", - "value": "عالی" - }, - { - "index": 1, - "label": "خوب", - "value": "خوب" - }, - { - "index": 2, - "label": "متوسط", - "value": "متوسط" - }, - { - "index": 3, - "label": "ضعیف", - "value": "ضعیف" - } - ] - } - }, - { - "type": "chip_selection", - "visible": true, - "visible_condition": null, - "data": { - "key": "bedding_status", - "label": "وضعیت بستر", - "selectedIndex": -1, - "options": [ - { - "index": 0, - "label": "خشک", - "value": "خشک" - }, - { - "index": 1, - "label": "نیمه‌مرطوب", - "value": "نیمه‌مرطوب" - }, - { - "index": 2, - "label": "مرطوب", - "value": "مرطوب" - } - ] - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "hatching_temperature", - "label": "دمای سالن", - "keyboard_type": "number" - } - }, - { - "type": "chip_selection", - "visible": true, - "visible_condition": null, - "data": { - "key": "water_quality", - "label": "آب مصرفی", - "selectedIndex": -1, - "options": [ - { - "index": 0, - "label": "چاه", - "value": "چاه" - }, - { - "index": 1, - "label": "شهری", - "value": "شهری" - }, - { - "index": 2, - "label": "تصفیه‌شده", - "value": "تصفیه‌شده" - }, - { - "index": 3, - "label": "حمل تانکر", - "value": "حمل تانکر" - } - ] - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "water_hardness", - "label": "درصد سختی آب (PPM)", - "keyboard_type": "number", - "decimal": true - } - } - ] - } - }, - { - "type": "card_label_item", - "visible": true, - "visible_condition": "activeStepperIndex == 1", - "data": { - "title": "تلفات", - "padding_horizontal": 12.0, - "padding_vertical": 11.0 - }, - "child": { - "type": "column", - "visible": true, - "visible_condition": null, - "spacing": 10.0, - "children": [ - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "normal_losses", - "label": "تعداد تلفات عادی دوره", - "keyboard_type": "number", - "comma_separator": true - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": null, - "data": { - "key": "abnormal_losses", - "label": "تلفات غیرعادی", - "keyboard_type": "number", - "comma_separator": true - } - }, - { - "type": "dropdown", - "visible": true, - "visible_condition": null, - "data": { - "key": "cause_of_unusual_casualties", - "label": "علت تلفات غیرعادی", - "placeholder": "علت تلفات غیرعادی", - "items": [ - "بیماری", - "قطعی برق", - "استرس گرمایی", - "مشکلات دان", - "کیفیت جوجه", - "سایر (شرح…)" - ], - "selectedValue": null, - "enabled": true - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": "cause_of_unusual_casualties == 'سایر (شرح…)'", - "data": { - "key": "other_cause_of_unusual_casualties", - "label": "علت تلفات غیرعادی", - "keyboard_type": "text" - } - }, - { - "type": "dropdown", - "visible": true, - "visible_condition": null, - "data": { - "key": "type_of_disease", - "label": "نوع بیماری تشخیص داده‌شده / مشکوک", - "placeholder": "نوع بیماری تشخیص داده‌شده / مشکوک", - "items": [ - "آنفلوانزا", - "نیوکاسل", - "IB", - "عفونت‌های باکتریایی", - "مشکلات گوارشی", - "سایر (شرح)" - ], - "selectedValue": null, - "enabled": true - } - }, - { - "type": "text_form_field", - "visible": true, - "visible_condition": "type_of_disease == 'سایر (شرح)'", - "data": { - "key": "other_type_of_disease", - "label": "نوع بیماری", - "keyboard_type": "text" - } - }, - { - "type": "dropdown", - "visible": true, - "visible_condition": null, - "data": { - "key": "sampling_done", - "label": "نمونه‌برداری انجام‌شده", - "placeholder": "نمونه‌برداری انجام‌شده", - "items": [ - "انجام شد", - "انجام نشد" - ], - "selectedValue": null, - "enabled": true - } - }, - { - "type": "chip_selection", - "visible": true, - "visible_condition": "sampling_done == 'انجام شد'", - "data": { - "key": "sample_type", - "label": "نوع نمونه", - "selectedIndex": -1, - "options": [ - { - "index": 0, - "label": "لاشه", - "value": "لاشه" - }, - { - "index": 1, - "label": "آب", - "value": "آب" - }, - { - "index": 2, - "label": "دانه", - "value": "دانه" - } - ] - } - } - ] - } - } - ] - } -} \ No newline at end of file diff --git a/packages/chicken/lib/presentation/widget/sdui/widgets/chip_selection/chip_selection_sdui.dart b/packages/chicken/lib/presentation/widget/sdui/widgets/chip_selection/chip_selection_sdui.dart index 373fb44..145cd57 100644 --- a/packages/chicken/lib/presentation/widget/sdui/widgets/chip_selection/chip_selection_sdui.dart +++ b/packages/chicken/lib/presentation/widget/sdui/widgets/chip_selection/chip_selection_sdui.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:rasadyar_chicken/features/poultry_science/presentation/widgets/submit_inspection_bottom_sheet/step2_page.dart'; import 'package:rasadyar_chicken/presentation/widget/sdui/widgets/chip_selection/model/chip_selection_sdui_model.dart'; import 'package:rasadyar_core/core.dart'; @@ -32,20 +31,27 @@ class ChipSelectionSDUI extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ if (model.label != null && model.label!.isNotEmpty) ...[ - Text( - model.label!, - style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor2), + Row( + children: [ + Text( + model.label!, + style: AppFonts.yekan14Bold.copyWith( + color: AppColor.textColor2, + ), + ), + ], ), SizedBox(height: 9.h), ], - Row( - mainAxisAlignment: MainAxisAlignment.center, - spacing: spacing, - children: options.asMap().entries.map((entry) { - final option = entry.value; - final optionIndex = option.index ?? entry.key; - return Expanded( - child: containerChips( + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + spacing: spacing, + children: options.asMap().entries.map((entry) { + final option = entry.value; + final optionIndex = option.index ?? entry.key; + return containerChips( selectedIndex: selectedIndex, index: optionIndex, label: option.label ?? '', @@ -54,12 +60,50 @@ class ChipSelectionSDUI extends StatelessWidget { onChanged!(model.key!, index, option.value); } }, - ), - ); - }).toList(), + ); + }).toList(), + ), ), ], ); }); } } + +GestureDetector containerChips({ + required int selectedIndex, + required int index, + required String label, + required Function(int) onTap, +}) { + return GestureDetector( + onTap: () => onTap(index), + child: Container( + height: 24.h, + padding: EdgeInsets.symmetric(horizontal: 20.w), + decoration: BoxDecoration( + color: index == selectedIndex + ? AppColor.green1Normal + : AppColor.whiteGreyNormal, + borderRadius: BorderRadius.circular(8), + border: index == selectedIndex + ? Border.fromBorderSide(BorderSide.none) + : Border.all(width: 1, color: AppColor.blackLightHover), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + spacing: 5, + children: [ + if (index == selectedIndex) + Icon(Icons.check, color: Colors.white, size: 16), + Text( + label, + style: index == selectedIndex + ? AppFonts.yekan14Bold.copyWith(color: Colors.white) + : AppFonts.yekan14.copyWith(color: AppColor.textColor), + ), + ], + ), + ), + ); +}