2023-02-23 00:53:14 +00:00
|
|
|
import 'package:date_time_picker/date_time_picker.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
|
|
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
2023-02-27 06:26:27 +00:00
|
|
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
2023-02-23 05:51:53 +00:00
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
2023-02-23 00:53:14 +00:00
|
|
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
|
|
|
import 'package:unit2/bloc/user/user_bloc.dart';
|
2023-02-27 06:26:27 +00:00
|
|
|
import 'package:unit2/model/profile/eligibility.dart';
|
2023-02-23 00:53:14 +00:00
|
|
|
|
2023-03-07 02:31:28 +00:00
|
|
|
import '../../../../bloc/profile/eligibility/eligibility_bloc.dart';
|
2023-02-23 00:53:14 +00:00
|
|
|
import '../../../../model/location/city.dart';
|
|
|
|
import '../../../../model/location/country.dart';
|
|
|
|
import '../../../../model/location/provinces.dart';
|
|
|
|
import '../../../../model/location/region.dart';
|
|
|
|
import '../../../../model/utils/eligibility.dart';
|
|
|
|
import '../../../../theme-data.dart/btn-style.dart';
|
|
|
|
import '../../../../theme-data.dart/colors.dart';
|
|
|
|
import '../../../../theme-data.dart/form-style.dart';
|
|
|
|
import '../../../../utils/global.dart';
|
2023-02-23 05:51:53 +00:00
|
|
|
import '../../../../utils/location_utilities.dart';
|
2023-02-23 00:53:14 +00:00
|
|
|
import '../../../../utils/text_container.dart';
|
|
|
|
|
|
|
|
class AddEligibilityScreen extends StatefulWidget {
|
|
|
|
const AddEligibilityScreen({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<AddEligibilityScreen> createState() => _AddEligibilityScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
2023-02-27 06:26:27 +00:00
|
|
|
final formKey = GlobalKey<FormBuilderState>();
|
2023-02-23 05:51:53 +00:00
|
|
|
bool? overseas;
|
|
|
|
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
|
|
|
|
Region? selectedRegion;
|
|
|
|
Province? selectedProvince;
|
|
|
|
CityMunicipality? selectedMunicipality;
|
|
|
|
Country? selectedCountry;
|
|
|
|
Eligibility? selectedEligibility;
|
|
|
|
List<Province>? provinces;
|
|
|
|
List<CityMunicipality>? citymuns;
|
|
|
|
bool provinceCall = false;
|
|
|
|
bool cityCall = false;
|
2023-02-27 06:26:27 +00:00
|
|
|
final examDateController = TextEditingController();
|
|
|
|
final validityDateController = TextEditingController();
|
|
|
|
String? token;
|
|
|
|
String? profileId;
|
|
|
|
String? rating;
|
|
|
|
String? license;
|
2023-02-23 00:53:14 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-03-24 06:46:17 +00:00
|
|
|
////USERBLOC
|
2023-02-23 00:53:14 +00:00
|
|
|
return BlocBuilder<UserBloc, UserState>(
|
|
|
|
builder: (context, state) {
|
2023-03-24 06:46:17 +00:00
|
|
|
////LOGGED IN USER STATE
|
2023-02-23 00:53:14 +00:00
|
|
|
if (state is UserLoggedIn) {
|
2023-03-24 06:46:17 +00:00
|
|
|
////PROFIILE BLOC
|
2023-02-27 06:26:27 +00:00
|
|
|
token = state.userData!.user!.login!.token;
|
|
|
|
profileId = state.userData!.user!.login!.user!.profileId.toString();
|
2023-02-23 00:53:14 +00:00
|
|
|
return BlocBuilder<ProfileBloc, ProfileState>(
|
2023-02-23 05:51:53 +00:00
|
|
|
builder: (context, state) {
|
2023-03-16 07:53:42 +00:00
|
|
|
if (state is ProfileLoaded) {
|
|
|
|
return BlocBuilder<EligibilityBloc, EligibilityState>(
|
|
|
|
buildWhen: (previous, current) {
|
|
|
|
if (state is EditEligibilityState) {}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
builder: (context, state) {
|
2023-03-24 06:46:17 +00:00
|
|
|
////ADD ELIGIBILITY STATE
|
2023-03-16 07:53:42 +00:00
|
|
|
if (state is AddEligibilityState) {
|
|
|
|
return ProgressHUD(
|
|
|
|
child: Center(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
vertical: 25, horizontal: 18),
|
|
|
|
child: FormBuilder(
|
|
|
|
key: formKey,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
2023-03-24 06:46:17 +00:00
|
|
|
////ELIGIBILITIES DROPDOWN
|
2023-03-16 07:53:42 +00:00
|
|
|
FormBuilderDropdown<Eligibility>(
|
|
|
|
onChanged: (Eligibility? eligibility) {
|
|
|
|
selectedEligibility = eligibility;
|
|
|
|
},
|
|
|
|
autovalidateMode:
|
|
|
|
AutovalidateMode.onUserInteraction,
|
|
|
|
validator: (value) =>
|
|
|
|
value == null ? 'required' : null,
|
|
|
|
items: state.eligibilities
|
|
|
|
.map<DropdownMenuItem<Eligibility>>(
|
|
|
|
(Eligibility eligibility) {
|
|
|
|
return DropdownMenuItem<Eligibility>(
|
|
|
|
value: eligibility,
|
|
|
|
child: Text(eligibility.title));
|
|
|
|
}).toList(),
|
|
|
|
name: "eligibility",
|
|
|
|
decoration: normalTextFieldStyle(
|
|
|
|
"Eligibility", "Eligibility")),
|
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
2023-02-23 05:51:53 +00:00
|
|
|
|
2023-03-16 07:53:42 +00:00
|
|
|
SizedBox(
|
|
|
|
width: screenWidth,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
2023-03-24 06:46:17 +00:00
|
|
|
////LICENSE NUMBER
|
2023-03-16 07:53:42 +00:00
|
|
|
Flexible(
|
|
|
|
flex: 1,
|
|
|
|
child: FormBuilderTextField(
|
|
|
|
onChanged: (value) {
|
|
|
|
license = value;
|
|
|
|
},
|
|
|
|
name: 'license_number',
|
|
|
|
decoration: normalTextFieldStyle(
|
|
|
|
"license number",
|
|
|
|
"license number"),
|
|
|
|
),
|
2023-03-02 05:28:33 +00:00
|
|
|
),
|
2023-03-16 07:53:42 +00:00
|
|
|
const SizedBox(
|
|
|
|
width: 12,
|
2023-03-02 05:28:33 +00:00
|
|
|
),
|
2023-03-24 06:46:17 +00:00
|
|
|
////RATING
|
2023-03-16 07:53:42 +00:00
|
|
|
Flexible(
|
|
|
|
flex: 1,
|
|
|
|
child: FormBuilderTextField(
|
|
|
|
keyboardType: const TextInputType
|
|
|
|
.numberWithOptions(),
|
|
|
|
onChanged: (value) {
|
|
|
|
rating = value;
|
|
|
|
},
|
|
|
|
name: 'rating',
|
|
|
|
decoration: normalTextFieldStyle(
|
|
|
|
'rating %', 'rating'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2023-02-23 05:51:53 +00:00
|
|
|
),
|
2023-03-16 07:53:42 +00:00
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: screenWidth,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
2023-03-24 06:46:17 +00:00
|
|
|
////EXAM DATE
|
2023-03-16 07:53:42 +00:00
|
|
|
Flexible(
|
|
|
|
flex: 1,
|
|
|
|
child: DateTimePicker(
|
|
|
|
use24HourFormat: false,
|
|
|
|
icon: const Icon(
|
|
|
|
Icons.date_range),
|
|
|
|
controller: examDateController,
|
|
|
|
firstDate: DateTime(1970),
|
|
|
|
lastDate: DateTime(2100),
|
|
|
|
timeHintText:
|
|
|
|
"Date of Examination/Conferment",
|
|
|
|
decoration:
|
|
|
|
normalTextFieldStyle(
|
|
|
|
"Exam date", "")
|
|
|
|
.copyWith(
|
|
|
|
prefixIcon:
|
|
|
|
const Icon(
|
|
|
|
Icons.date_range,
|
|
|
|
color: Colors.black87,
|
|
|
|
)),
|
|
|
|
initialValue: null,
|
|
|
|
)),
|
|
|
|
const SizedBox(
|
|
|
|
width: 12,
|
|
|
|
),
|
2023-03-24 06:46:17 +00:00
|
|
|
////VALIDITY DATE
|
2023-03-16 07:53:42 +00:00
|
|
|
Flexible(
|
2023-03-02 05:28:33 +00:00
|
|
|
flex: 1,
|
|
|
|
child: DateTimePicker(
|
2023-03-16 07:53:42 +00:00
|
|
|
controller:
|
|
|
|
validityDateController,
|
2023-03-02 05:28:33 +00:00
|
|
|
firstDate: DateTime(1970),
|
|
|
|
lastDate: DateTime(2100),
|
2023-02-23 05:51:53 +00:00
|
|
|
decoration: normalTextFieldStyle(
|
2023-03-16 07:53:42 +00:00
|
|
|
"Validity date",
|
|
|
|
"Validity date")
|
2023-03-02 05:28:33 +00:00
|
|
|
.copyWith(
|
|
|
|
prefixIcon: const Icon(
|
|
|
|
Icons.date_range,
|
|
|
|
color: Colors.black87,
|
|
|
|
)),
|
|
|
|
initialValue: null,
|
2023-03-16 07:53:42 +00:00
|
|
|
),
|
2023-03-02 05:28:33 +00:00
|
|
|
),
|
2023-03-16 07:53:42 +00:00
|
|
|
],
|
2023-03-02 05:28:33 +00:00
|
|
|
),
|
2023-03-16 07:53:42 +00:00
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"Placement of Examination/Conferment",
|
|
|
|
style: Theme.of(context)
|
|
|
|
.textTheme
|
|
|
|
.displaySmall!
|
|
|
|
.copyWith(
|
|
|
|
fontSize: blockSizeVertical * 2),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 12,
|
|
|
|
),
|
2023-03-24 06:46:17 +00:00
|
|
|
////OVERSEAS ADDRESS SWITCH
|
2023-03-16 07:53:42 +00:00
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
FormBuilderSwitch(
|
|
|
|
initialValue: overseas,
|
|
|
|
activeColor: second,
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
overseas = value;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
decoration:
|
|
|
|
normalTextFieldStyle("", ''),
|
|
|
|
name: 'overseas',
|
|
|
|
title:
|
|
|
|
const Text("Overseas Address?"),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
2023-03-24 06:46:17 +00:00
|
|
|
////COUNTRY DROPDOWN
|
2023-03-16 07:53:42 +00:00
|
|
|
SizedBox(
|
|
|
|
child: overseas == true
|
|
|
|
? FormBuilderDropdown<Country>(
|
|
|
|
initialValue: null,
|
2023-03-24 06:46:17 +00:00
|
|
|
validator: FormBuilderValidators.required(errorText: "This field is required"),
|
2023-03-16 07:53:42 +00:00
|
|
|
items: state.countries.map<
|
|
|
|
DropdownMenuItem<
|
|
|
|
Country>>(
|
|
|
|
(Country country) {
|
|
|
|
return DropdownMenuItem<
|
|
|
|
Country>(
|
|
|
|
value: country,
|
|
|
|
child: FittedBox(
|
|
|
|
child: Text(
|
|
|
|
country
|
|
|
|
.name!)));
|
|
|
|
}).toList(),
|
|
|
|
name: 'country',
|
|
|
|
decoration:
|
|
|
|
normalTextFieldStyle(
|
|
|
|
"Country*",
|
|
|
|
"Country"),
|
|
|
|
onChanged:
|
|
|
|
(Country? value) {
|
|
|
|
selectedCountry = value;
|
|
|
|
},
|
|
|
|
)
|
|
|
|
: Column(
|
|
|
|
children: [
|
2023-03-24 06:46:17 +00:00
|
|
|
////REGION DROPDOWN
|
2023-03-16 07:53:42 +00:00
|
|
|
FormBuilderDropdown<
|
|
|
|
Region?>(
|
|
|
|
autovalidateMode:
|
|
|
|
AutovalidateMode
|
|
|
|
.onUserInteraction,
|
2023-03-24 06:46:17 +00:00
|
|
|
validator: FormBuilderValidators.required(errorText: "This field is required"),
|
|
|
|
//// region onchange
|
2023-03-16 07:53:42 +00:00
|
|
|
onChanged: (Region?
|
|
|
|
region) async {
|
|
|
|
setState(() {
|
|
|
|
provinceCall = true;
|
|
|
|
});
|
|
|
|
selectedRegion =
|
|
|
|
region;
|
|
|
|
getProvinces();
|
|
|
|
},
|
|
|
|
initialValue:
|
|
|
|
selectedRegion,
|
|
|
|
decoration:
|
|
|
|
normalTextFieldStyle(
|
|
|
|
"Region*",
|
|
|
|
"Region"),
|
|
|
|
name: 'region',
|
|
|
|
items: state.regions.map<
|
|
|
|
DropdownMenuItem<
|
|
|
|
Region>>((Region
|
|
|
|
region) {
|
|
|
|
return DropdownMenuItem<
|
|
|
|
Region>(
|
|
|
|
value: region,
|
|
|
|
child: Text(region
|
|
|
|
.description!));
|
|
|
|
}).toList(),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
2023-03-24 06:46:17 +00:00
|
|
|
////PROVINCE DROPDOWN
|
2023-03-16 07:53:42 +00:00
|
|
|
SizedBox(
|
|
|
|
height: 70,
|
|
|
|
child: ModalProgressHUD(
|
|
|
|
color: Colors
|
|
|
|
.transparent,
|
|
|
|
inAsyncCall:
|
|
|
|
provinceCall,
|
|
|
|
child: DropdownButtonFormField<
|
|
|
|
Province?>(
|
|
|
|
autovalidateMode:
|
|
|
|
AutovalidateMode
|
|
|
|
.onUserInteraction,
|
|
|
|
validator: (value) =>
|
|
|
|
value == null
|
|
|
|
? 'required'
|
|
|
|
: null,
|
|
|
|
isExpanded: true,
|
|
|
|
value:
|
|
|
|
selectedProvince,
|
|
|
|
onChanged:
|
|
|
|
(Province?
|
|
|
|
province) {
|
|
|
|
setState(() {
|
|
|
|
cityCall =
|
|
|
|
true;
|
|
|
|
});
|
|
|
|
selectedProvince =
|
|
|
|
province;
|
|
|
|
getCities();
|
|
|
|
},
|
|
|
|
items: provinces ==
|
|
|
|
null
|
|
|
|
? []
|
|
|
|
: provinces!.map<
|
|
|
|
DropdownMenuItem<
|
|
|
|
Province>>((Province
|
|
|
|
province) {
|
|
|
|
return DropdownMenuItem(
|
|
|
|
value:
|
|
|
|
province,
|
|
|
|
child:
|
|
|
|
FittedBox(
|
|
|
|
child:
|
|
|
|
Text(province.description!),
|
|
|
|
));
|
|
|
|
}).toList(),
|
|
|
|
decoration:
|
|
|
|
normalTextFieldStyle(
|
|
|
|
"Province*",
|
|
|
|
"Province")),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2023-03-24 06:46:17 +00:00
|
|
|
//// CityMunicipalities dropdown
|
2023-03-16 07:53:42 +00:00
|
|
|
SizedBox(
|
|
|
|
height: 70,
|
|
|
|
child: ModalProgressHUD(
|
|
|
|
color: Colors.white,
|
|
|
|
inAsyncCall: cityCall,
|
|
|
|
child: DropdownButtonFormField<
|
|
|
|
CityMunicipality>(
|
2023-03-02 05:28:33 +00:00
|
|
|
validator: (value) =>
|
|
|
|
value == null
|
|
|
|
? 'required'
|
|
|
|
: null,
|
|
|
|
isExpanded: true,
|
|
|
|
onChanged:
|
2023-03-16 07:53:42 +00:00
|
|
|
(CityMunicipality?
|
|
|
|
city) {
|
|
|
|
selectedMunicipality =
|
|
|
|
city;
|
2023-03-02 05:28:33 +00:00
|
|
|
},
|
2023-03-16 07:53:42 +00:00
|
|
|
decoration: normalTextFieldStyle(
|
|
|
|
"Municipality*",
|
|
|
|
"Municipality"),
|
|
|
|
value:
|
|
|
|
selectedMunicipality,
|
|
|
|
items: citymuns ==
|
2023-03-02 05:28:33 +00:00
|
|
|
null
|
|
|
|
? []
|
2023-03-16 07:53:42 +00:00
|
|
|
: citymuns!.map<
|
|
|
|
DropdownMenuItem<
|
|
|
|
CityMunicipality>>(
|
|
|
|
(CityMunicipality
|
|
|
|
c) {
|
2023-03-02 05:28:33 +00:00
|
|
|
return DropdownMenuItem(
|
|
|
|
value:
|
2023-03-16 07:53:42 +00:00
|
|
|
c,
|
|
|
|
child: Text(
|
|
|
|
c.description!));
|
2023-03-02 05:28:33 +00:00
|
|
|
}).toList(),
|
2023-03-16 07:53:42 +00:00
|
|
|
),
|
2023-03-02 05:28:33 +00:00
|
|
|
),
|
|
|
|
),
|
2023-03-16 07:53:42 +00:00
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
2023-02-23 05:51:53 +00:00
|
|
|
|
2023-03-16 07:53:42 +00:00
|
|
|
const Expanded(
|
|
|
|
child: SizedBox(),
|
|
|
|
),
|
2023-03-02 05:28:33 +00:00
|
|
|
|
2023-03-16 07:53:42 +00:00
|
|
|
SizedBox(
|
|
|
|
width: screenWidth,
|
|
|
|
height: 60,
|
|
|
|
child: ElevatedButton(
|
|
|
|
style: mainBtnStyle(primary,
|
|
|
|
Colors.transparent, second),
|
|
|
|
onPressed: () {
|
|
|
|
//rating
|
|
|
|
double? rate = rating == null
|
|
|
|
? null
|
|
|
|
: double.parse(rating!);
|
|
|
|
//lisence
|
|
|
|
String? licenseNumber = license;
|
|
|
|
CityMunicipality? cityMunicipality =
|
|
|
|
selectedMunicipality;
|
|
|
|
DateTime? examDate =
|
|
|
|
examDateController.text.isEmpty
|
|
|
|
? null
|
|
|
|
: DateTime.parse(
|
|
|
|
examDateController
|
|
|
|
.text);
|
|
|
|
DateTime? validityDate =
|
|
|
|
validityDateController
|
|
|
|
.text.isEmpty
|
|
|
|
? null
|
|
|
|
: DateTime.parse(
|
|
|
|
validityDateController
|
|
|
|
.text);
|
2023-02-27 06:26:27 +00:00
|
|
|
|
2023-03-16 07:53:42 +00:00
|
|
|
ExamAddress examAddress =
|
|
|
|
ExamAddress(
|
|
|
|
barangay: null,
|
|
|
|
id: null,
|
|
|
|
addressCategory: null,
|
|
|
|
examAddressClass: null,
|
|
|
|
country: selectedCountry ??
|
|
|
|
Country(
|
|
|
|
id: 175,
|
|
|
|
name: 'Philippines',
|
|
|
|
code: 'PH'),
|
|
|
|
cityMunicipality:
|
|
|
|
cityMunicipality);
|
|
|
|
EligibityCert eligibityCert =
|
|
|
|
EligibityCert(
|
|
|
|
id: null,
|
|
|
|
rating: rate,
|
|
|
|
examDate: examDate,
|
|
|
|
attachments: null,
|
|
|
|
eligibility:
|
|
|
|
selectedEligibility,
|
|
|
|
examAddress: examAddress,
|
|
|
|
validityDate: validityDate,
|
|
|
|
licenseNumber:
|
|
|
|
licenseNumber,
|
|
|
|
overseas: overseas);
|
|
|
|
if (formKey.currentState!
|
|
|
|
.saveAndValidate()) {
|
|
|
|
context
|
|
|
|
.read<EligibilityBloc>()
|
|
|
|
.add(AddEligibility(
|
|
|
|
eligibityCert:
|
|
|
|
eligibityCert,
|
|
|
|
profileId: profileId!,
|
|
|
|
token: token!));
|
|
|
|
}
|
|
|
|
// context.read<ProfileBloc>().add(AddEligibility(eligibityCert: eligibityCert, profileId: profileId, token: token))
|
|
|
|
},
|
|
|
|
child: const Text(submit)),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
),
|
2023-03-02 05:28:33 +00:00
|
|
|
),
|
|
|
|
),
|
2023-03-16 07:53:42 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
return Container();
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return Container();
|
2023-02-23 05:51:53 +00:00
|
|
|
},
|
|
|
|
);
|
2023-02-23 00:53:14 +00:00
|
|
|
}
|
|
|
|
return Container();
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
2023-02-23 05:51:53 +00:00
|
|
|
|
|
|
|
Future<void> getProvinces() async {
|
2023-03-02 00:40:47 +00:00
|
|
|
try {
|
|
|
|
List<Province> newProvinces = await LocationUtils.instance
|
|
|
|
.getProvinces(regionCode: selectedRegion!.code.toString());
|
|
|
|
setState(() {
|
|
|
|
provinces = newProvinces;
|
|
|
|
selectedProvince = provinces![0];
|
|
|
|
provinceCall = false;
|
|
|
|
cityCall = true;
|
|
|
|
getCities();
|
|
|
|
});
|
|
|
|
} catch (e) {
|
2023-03-02 05:28:33 +00:00
|
|
|
context.read<EligibilityBloc>().add(CallErrorState());
|
2023-03-02 00:40:47 +00:00
|
|
|
}
|
2023-02-23 05:51:53 +00:00
|
|
|
}
|
2023-02-27 06:26:27 +00:00
|
|
|
|
|
|
|
Future<void> getCities() async {
|
2023-03-02 00:40:47 +00:00
|
|
|
try {
|
|
|
|
List<CityMunicipality> newCities = await LocationUtils.instance
|
|
|
|
.getCities(code: selectedProvince!.code.toString());
|
|
|
|
citymuns = newCities;
|
|
|
|
setState(() {
|
|
|
|
selectedMunicipality = newCities[0];
|
|
|
|
cityCall = false;
|
|
|
|
});
|
|
|
|
} catch (e) {
|
2023-03-02 05:28:33 +00:00
|
|
|
context.read<EligibilityBloc>().add(CallErrorState());
|
2023-03-02 00:40:47 +00:00
|
|
|
}
|
2023-02-23 05:51:53 +00:00
|
|
|
}
|
2023-02-23 00:53:14 +00:00
|
|
|
}
|