feat: enhance CreateInspectionBottomSheetLogic by resetting critical values during initialization and improving UI responsiveness with updated height adjustments and location visibility

This commit is contained in:
2025-12-17 09:22:21 +03:30
parent 3b07dca52e
commit efd6a9bf9f
2 changed files with 29 additions and 6 deletions

View File

@@ -210,10 +210,6 @@ class CreateInspectionBottomSheetLogic extends GetxController
void onReady() {
super.onReady();
activeStepperIndex.listen((value) {
iLog("==========>$value");
if (value == 1) {
setUpPultryImagesListener();
}
pageController.animateToPage(
value,
duration: Duration(milliseconds: 300),
@@ -374,6 +370,13 @@ class CreateInspectionBottomSheetLogic extends GetxController
}
void initData() {
// Reset critical values before initializing
currentLocation.value = null;
nextStepButtonEnabled.value = false;
activeStepperIndex.value = 0;
selectedTabIndex.value = 0;
isLoadingLocation.value = false;
submitInspectionResponse = SubmitInspectionResponse(
generalConditionHall: GeneralConditionHall(),
casualties: Casualties(),
@@ -440,7 +443,10 @@ class CreateInspectionBottomSheetLogic extends GetxController
}
void setHatchingModel(HatchingModel hatchingModel) {
// Reset all data before setting new hatching model
resetAllData();
this.hatchingModel = hatchingModel;
initData();
}
void changeSegmentIndex(int index) {

View File

@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:rasadyar_chicken/features/poultry_science/presentation/widgets/submit_inspection_bottom_sheet/card_info.dart';
@@ -13,8 +14,8 @@ Widget step1Page(CreateInspectionBottomSheetLogic controller) {
Container(
height: controller.tenantStatusController.text == 'دارد'
? 600.h
: 460.h,
? 605.h
: 470.h,
clipBehavior: Clip.none,
width: Get.width,
child: farmInfoWidget(
@@ -163,6 +164,22 @@ Column basicUnitInformation(CreateInspectionBottomSheetLogic controller) {
),
),
),
ObxValue((data) {
return Visibility(
visible: data.value != null,
child: Row(
spacing: 8,
children: [
Icon(Icons.gps_fixed, color: AppColor.greenNormal, size: 24),
Text(
'موقعیت جغرافیایی دریافت شد',
style: AppFonts.yekan12.copyWith(color: AppColor.greenNormal),
),
],
),
);
}, controller.currentLocation),
],
);
}