Fixed building home and land home errors enclosed expanded with column, added errorstate try again button

dev
cyzoox 2023-09-06 08:59:07 +08:00
parent eaabcda3d7
commit ed41815966
9 changed files with 143 additions and 79 deletions

View File

@ -10,6 +10,8 @@ import 'package:unit2/model/passo/additional_items.dart';
import 'package:unit2/model/passo/class_components.dart';
import 'package:unit2/model/passo/unit_construct.dart';
import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
class AddExtraItems extends StatefulWidget {
final List<UnitConstruct> unit;
@ -573,6 +575,14 @@ class _AddExtraItems extends State<AddExtraItems> {
),
)));
}
if (state is AdditionalItemsErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<AdditionalItemBloc>().add(LoadAdditionalItems());
},
);
}
return Container();
});
}

View File

@ -52,13 +52,6 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
if (state is LocationErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
}
},
builder: (context, state) {
@ -77,13 +70,6 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
if (state is LandrefErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
}
},
builder: (context, state) {
@ -102,13 +88,6 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
if (state is MunicipalityErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
}
}, builder: (context, state) {
if (state is MunicipalityLoaded) {
@ -132,13 +111,6 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
if (state is BarangayErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
}
}, builder: (context, state) {
if (state is BarangayLoaded) {
@ -150,17 +122,15 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
return FormBuilder(
key: keys,
initialValue: {
'street': bldgloc.street,
// 'brgy': bldgloc.barangay,
// 'municipality': bldgloc.municipality,
'province': bldgloc.province,
'street': bldgloc.street ?? "",
'province': bldgloc.province ?? "",
'l_owner': landRef.owner,
'oct_tct_cloa': landRef.cloaNo,
'survey_no': landRef.surveyNo,
'lot_no': landRef.lotNo,
'blk_no': landRef.blkNo,
'l_td_arp': landRef.tdn,
'area': landRef.area
'oct_tct_cloa': landRef.cloaNo ?? "",
'survey_no': landRef.surveyNo ?? "",
'lot_no': landRef.lotNo ?? "",
'blk_no': landRef.blkNo ?? "",
'l_td_arp': landRef.tdn ?? "",
'area': landRef.area ?? ""
},
enabled: true,
onChanged: () {
@ -250,8 +220,8 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customDropDownField(
bldgloc.barangay,
"",
bldgloc.barangay ?? "",
"Barangay",
'brgy',
brgyNAmes))
]),

View File

@ -43,13 +43,13 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
listener: (context, state) {
if (state is StructuralMaterialsLoaded) {
setState(() {
foundation = state.structure.foundation!.split(',');
column = state.structure.columns!.split(',');
beam = state.structure.beams!.split(',');
truss_framing = state.structure.trussFraming!.split(',');
roof = state.structure.roof!.split(',');
flooring = state.structure.flooring!.split(',');
walls = state.structure.walls!.split(',');
foundation = state.structure.foundation!.split(',') ?? [];
column = state.structure.columns!.split(',') ?? [];
beam = state.structure.beams!.split(',') ?? [];
truss_framing = state.structure.trussFraming!.split(',') ?? [];
roof = state.structure.roof!.split(',') ?? [];
flooring = state.structure.flooring!.split(',') ?? [];
walls = state.structure.walls!.split(',') ?? [];
// Update other local state variables here if needed
});
}

View File

@ -0,0 +1,13 @@
import 'package:flutter/material.dart';
class PropertyOwnerPage extends StatefulWidget {
@override
_PropertyOwnerPage createState() => _PropertyOwnerPage();
}
class _PropertyOwnerPage extends State<PropertyOwnerPage> {
@override
Widget build(BuildContext context) {
return Scaffold(body: Container());
}
}

View File

@ -19,6 +19,8 @@ import 'package:unit2/model/passo/land_subclassification.dart';
import 'package:unit2/model/passo/unit_construct.dart';
import 'package:unit2/screens/passo/Land/add_land.dart';
import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
class AddLandAppraisalModal extends StatefulWidget {
@ -392,22 +394,54 @@ class _AddLandAppraisalModal extends State<AddLandAppraisalModal> {
)));
}
if (state is MunicipalityErrorState) {
return Text(state.error);
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<MunicipalityBloc>()
.add(LoadMunicipality());
},
);
}
return Container();
},
);
}
if (state is LandSubClassificationErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandSubClassificationBloc>().add(
const LoadLandSubClassification(
cityCode: '1', classCode: 1));
},
);
}
return Container();
},
);
}
if (state is LandClassificationErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandClassificationBloc>()
.add(LoadLandClassification());
},
);
}
return Container();
},
);
}
if (state is LandAppraisalErrorState) {
return Text(state.error);
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandAppraisalBloc>().add(LoadLandAppraisal());
},
);
}
return Container();
});

View File

@ -9,6 +9,8 @@ import 'package:unit2/bloc/passo/land/other_improvements/other_improvements_bloc
import 'package:unit2/model/passo/other_improvements.dart';
import 'package:unit2/model/passo/trees_improvements.dart';
import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
class AddOtherImprovementModal extends StatefulWidget {
// final List<UnitConstruct> unit;
@ -329,16 +331,28 @@ class _AddOtherImprovementModal extends State<AddOtherImprovementModal> {
),
));
}
if (state is LandTreesImprovementsErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandTreesImprovementsBloc>()
.add(LoadLandTreesImprovements());
},
);
}
return Container();
});
}
if (state is OtherImprovementErrorState) {
return Text(state.error);
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<OtherImprovementsBloc>().add(LoadOtherImprovement());
},
);
}
return Container(
child: Text("Other Improvement"),
);
return Container();
});
}
}

View File

@ -8,6 +8,8 @@ import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustme
import 'package:unit2/model/passo/land_property_assessment.dart';
import 'package:unit2/model/passo/land_value_adjustment.dart';
import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
class AddPropertyAssessmentModal extends StatefulWidget {
// final List<UnitConstruct> unit;
@ -327,16 +329,30 @@ class _AddPropertyAssessmentModal extends State<AddPropertyAssessmentModal> {
),
));
}
if (state is LandValueAdjustmentsErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandValueAdjustmentsBloc>()
.add(LoadLandValueAdjustments());
},
);
}
return Container();
});
}
if (state is LandPropertyAssessmentErrorState) {
return Text(state.error);
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandPropertyAssessmentBloc>()
.add(LoadLandPropertyAssessment());
},
);
}
return Container(
child: Text("Property Assessment"),
);
return Container();
});
}
}

View File

@ -68,7 +68,6 @@ class BuildingHome extends StatelessWidget {
Profile profile;
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.only(left: 24, right: 24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocBuilder<UserBloc, UserState>(builder: (context, state) {
@ -96,15 +95,19 @@ class BuildingHome extends StatelessWidget {
List<PropertyInfo> propertyList = state.property_info;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: propertyList.length,
itemBuilder: (BuildContext context, int index) {
return _listCard(
propertyList[index], context, index);
},
),
child: Column(
children: [
Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: propertyList.length,
itemBuilder: (BuildContext context, int index) {
return _listCard(
propertyList[index], context, index);
},
),
),
],
),
);
}

View File

@ -96,15 +96,19 @@ class LandHome extends StatelessWidget {
List<LandPropertyOwner> propertyList = state.land;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: propertyList.length,
itemBuilder: (BuildContext context, int index) {
return _listCard(
propertyList[index], context, index);
},
),
child: Column(
children: [
Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: propertyList.length,
itemBuilder: (BuildContext context, int index) {
return _listCard(
propertyList[index], context, index);
},
),
),
],
),
);
}
@ -114,7 +118,7 @@ class LandHome extends StatelessWidget {
onpressed: () {
context
.read<LandPropertyOwnerInfoBloc>()
.add(LoadLand());
.add(const LoadLand());
},
);
}