commit before flutter upgrade
parent
e7d5e933dd
commit
3a53445ec6
|
@ -10,7 +10,9 @@ import 'package:unit2/utils/location_utilities.dart';
|
||||||
import 'package:unit2/utils/profile_utilities.dart';
|
import 'package:unit2/utils/profile_utilities.dart';
|
||||||
import '../../model/location/country.dart' as country;
|
import '../../model/location/country.dart' as country;
|
||||||
import '../../model/location/region.dart' as region;
|
import '../../model/location/region.dart' as region;
|
||||||
|
import '../../model/location/provinces.dart' as province;
|
||||||
|
import '../../model/location/city.dart' as city;
|
||||||
|
import '../../model/location/barangay.dart' as barangay;
|
||||||
part 'profile_event.dart';
|
part 'profile_event.dart';
|
||||||
part 'profile_state.dart';
|
part 'profile_state.dart';
|
||||||
|
|
||||||
|
@ -38,7 +40,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
||||||
List<country.Country> countries = await LocationUtils.instance.getCountries();
|
List<country.Country> countries = await LocationUtils.instance.getCountries();
|
||||||
List<region.Region> regions = await LocationUtils.instance.getRegions();
|
List<region.Region> regions = await LocationUtils.instance.getRegions();
|
||||||
List<EligibilityList> eligibilities = await ProfileUtilities.instance.getEligibilities();
|
List<EligibilityList> eligibilities = await ProfileUtilities.instance.getEligibilities();
|
||||||
emit(EditEligibilityState(eligibityCert: event.eligibityCert,countries: countries,regions: regions,eligibilities: eligibilities));
|
List<province.Province> provinces = await LocationUtils.instance.getProvinces(regionCode: event.eligibityCert.examAddress!.cityMunicipality!.province!.region!.code!.toString());
|
||||||
|
emit(EditEligibilityState(provinces: provinces, eligibityCert: event.eligibityCert,countries: countries,regions: regions,eligibilities: eligibilities));
|
||||||
// }catch(e){
|
// }catch(e){
|
||||||
// emit(ProfileErrorState(mesage: e.toString()));
|
// emit(ProfileErrorState(mesage: e.toString()));
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -39,7 +39,8 @@ class EditEligibilityState extends ProfileState{
|
||||||
final List<EligibilityList> eligibilities;
|
final List<EligibilityList> eligibilities;
|
||||||
final List<country.Country> countries;
|
final List<country.Country> countries;
|
||||||
final List<region.Region> regions;
|
final List<region.Region> regions;
|
||||||
const EditEligibilityState({required this.eligibityCert, required this.eligibilities, required this.countries, required this.regions});
|
List<province.Province> provinces;
|
||||||
|
EditEligibilityState({ required this.provinces,required this.eligibityCert, required this.eligibilities, required this.countries, required this.regions});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [eligibityCert];
|
List<Object> get props => [eligibityCert];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'region.dart';
|
||||||
|
|
||||||
Province provinceFromJson(String str) => Province.fromJson(json.decode(str));
|
Province provinceFromJson(String str) => Province.fromJson(json.decode(str));
|
||||||
|
|
||||||
String provinceToJson(Province data) => json.encode(data.toJson());
|
String provinceToJson(Province data) => json.encode(data.toJson());
|
||||||
|
@ -40,27 +42,3 @@ class Province {
|
||||||
"shortname": shortname,
|
"shortname": shortname,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class Region {
|
|
||||||
Region({
|
|
||||||
required this.code,
|
|
||||||
required this.description,
|
|
||||||
required this.psgcCode,
|
|
||||||
});
|
|
||||||
|
|
||||||
final int? code;
|
|
||||||
final String? description;
|
|
||||||
final String? psgcCode;
|
|
||||||
|
|
||||||
factory Region.fromJson(Map<String, dynamic> json) => Region(
|
|
||||||
code: json["code"],
|
|
||||||
description: json["description"],
|
|
||||||
psgcCode: json["psgc_code"],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
"code": code,
|
|
||||||
"description": description,
|
|
||||||
"psgc_code": psgcCode,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class EligibityCert {
|
||||||
examDate: json['exam_date'] == null? null: DateTime.parse(json["exam_date"]),
|
examDate: json['exam_date'] == null? null: DateTime.parse(json["exam_date"]),
|
||||||
attachments: null,
|
attachments: null,
|
||||||
eligibility: json['eligibility'] == null?null: Eligibility.fromJson(json["eligibility"]),
|
eligibility: json['eligibility'] == null?null: Eligibility.fromJson(json["eligibility"]),
|
||||||
examAddress: json['eligibilty'] == null? null: ExamAddress.fromJson(json["exam_address"]),
|
examAddress: json['exam_address'] == null? null: ExamAddress.fromJson(json["exam_address"]),
|
||||||
validityDate: json["validity_date"],
|
validityDate: json["validity_date"],
|
||||||
licenseNumber: json["license_number"],
|
licenseNumber: json["license_number"],
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,7 +8,10 @@ import 'package:intl/intl.dart';
|
||||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||||
import 'package:unit2/bloc/user/user_bloc.dart';
|
import 'package:unit2/bloc/user/user_bloc.dart';
|
||||||
import 'package:unit2/model/profile/eligibility.dart';
|
import 'package:unit2/model/profile/eligibility.dart';
|
||||||
|
import 'package:unit2/model/utils/eligibilities_choices.dart';
|
||||||
import '../../../../model/location/country.dart' as c;
|
import '../../../../model/location/country.dart' as c;
|
||||||
|
import '../../../../model/location/region.dart' as r;
|
||||||
|
import '../../../../model/location/provinces.dart' as p;
|
||||||
import '../../../../theme-data.dart/btn-style.dart';
|
import '../../../../theme-data.dart/btn-style.dart';
|
||||||
import '../../../../theme-data.dart/colors.dart';
|
import '../../../../theme-data.dart/colors.dart';
|
||||||
import '../../../../theme-data.dart/form-style.dart';
|
import '../../../../theme-data.dart/form-style.dart';
|
||||||
|
@ -30,12 +33,22 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
c.Country? selectedCountry;
|
c.Country? selectedCountry;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
//USERBLOC
|
||||||
return BlocBuilder<UserBloc, UserState>(
|
return BlocBuilder<UserBloc, UserState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
|
//LOGGED IN USER STATE
|
||||||
if (state is UserLoggedIn) {
|
if (state is UserLoggedIn) {
|
||||||
|
//PROFIILE BLOC
|
||||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
|
//EDIT ELIGIBILITY STATE
|
||||||
if (state is EditEligibilityState) {
|
if (state is EditEligibilityState) {
|
||||||
|
String? region = state.eligibityCert.examAddress!
|
||||||
|
.cityMunicipality!.province!.region!.description;
|
||||||
|
String? eligibiltyTitle =
|
||||||
|
state.eligibityCert.eligibility!.title!;
|
||||||
|
String? province = state.eligibityCert.examAddress!
|
||||||
|
.cityMunicipality!.province!.description!;
|
||||||
return Center(
|
return Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
|
@ -46,20 +59,35 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
FormBuilderTextField(
|
//ELIGIBILITIES DROPDOWN
|
||||||
|
FormBuilderDropdown<dynamic>(
|
||||||
|
initialValue: state.eligibityCert.eligibility,
|
||||||
|
items: state.eligibilities
|
||||||
|
.map<DropdownMenuItem<EligibilityList>>(
|
||||||
|
(EligibilityList eligibility) {
|
||||||
|
return DropdownMenuItem<EligibilityList>(
|
||||||
|
value: eligibility,
|
||||||
|
child: Text(eligibility.title));
|
||||||
|
}).toList(),
|
||||||
name: "eligibility",
|
name: "eligibility",
|
||||||
initialValue:
|
|
||||||
widget.eligibityCert.eligibility!.title!,
|
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"Eligibility", "Eligibility"),
|
"Eligibility", eligibiltyTitle)
|
||||||
|
.copyWith(
|
||||||
|
hintStyle: const TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
labelStyle:
|
||||||
|
const TextStyle(color: Colors.black)),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
//LICENSE NUMBER
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: FormBuilderTextField(
|
child: FormBuilderTextField(
|
||||||
|
@ -73,6 +101,7 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 12,
|
width: 12,
|
||||||
),
|
),
|
||||||
|
//RATING
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: FormBuilderTextField(
|
child: FormBuilderTextField(
|
||||||
|
@ -93,6 +122,7 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
//EXAM DATE
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: DateTimePicker(
|
child: DateTimePicker(
|
||||||
|
@ -110,6 +140,7 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 12,
|
width: 12,
|
||||||
),
|
),
|
||||||
|
//VALIDITY DATE
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: DateTimePicker(
|
child: DateTimePicker(
|
||||||
|
@ -141,6 +172,7 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
|
//OVERSEAS ADDRESS SWITCH
|
||||||
FormBuilderSwitch(
|
FormBuilderSwitch(
|
||||||
initialValue: overseas,
|
initialValue: overseas,
|
||||||
activeColor: second,
|
activeColor: second,
|
||||||
|
@ -156,13 +188,14 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
|
//COUNTRY DROPDOWN
|
||||||
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: overseas == true
|
child: overseas == true
|
||||||
? FormBuilderDropdown<dynamic>(
|
? FormBuilderDropdown<dynamic>(
|
||||||
items: state.countries
|
items: state.countries
|
||||||
.map<DropdownMenuItem<c.Country>>(
|
.map<DropdownMenuItem<c.Country>>(
|
||||||
(c.Country country) {
|
(c.Country country) {
|
||||||
|
|
||||||
return DropdownMenuItem<c.Country>(
|
return DropdownMenuItem<c.Country>(
|
||||||
value: country,
|
value: country,
|
||||||
child: Text(country.name!));
|
child: Text(country.name!));
|
||||||
|
@ -178,39 +211,52 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
)
|
)
|
||||||
: Column(
|
: Column(
|
||||||
children: [
|
children: [
|
||||||
FormBuilderDropdown(
|
//REGION DROPDOWN
|
||||||
|
FormBuilderDropdown<dynamic>(
|
||||||
|
// initialValue:state.eligibityCert.examAddress!.cityMunicipality!.province!.description!,
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"Region", "Region"),
|
"Region", region ??
|
||||||
|
"Region*")
|
||||||
|
.copyWith(
|
||||||
|
hintStyle: const TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
labelStyle: const TextStyle(
|
||||||
|
color: Colors.black)),
|
||||||
name: 'region',
|
name: 'region',
|
||||||
items: [],
|
items: state.regions.map<
|
||||||
initialValue: widget
|
DropdownMenuItem<r.Region>>(
|
||||||
.eligibityCert
|
(r.Region region) {
|
||||||
.examAddress
|
return DropdownMenuItem<r.Region>(
|
||||||
?.cityMunicipality
|
value: region,
|
||||||
?.province
|
child: Text(
|
||||||
?.region
|
region.description!));
|
||||||
?.description ==
|
}).toList(),
|
||||||
null
|
|
||||||
? 'region'
|
|
||||||
: 'region',
|
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
|
//PROVINCE DROPDOWN
|
||||||
FormBuilderDropdown(
|
FormBuilderDropdown(
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
'Province', "Province"),
|
|
||||||
name: 'province',
|
name: 'province',
|
||||||
items: [],
|
items: state.provinces.map<
|
||||||
initialValue: widget
|
DropdownMenuItem<
|
||||||
.eligibityCert
|
p.Province>>(
|
||||||
.examAddress
|
(p.Province province) {
|
||||||
?.cityMunicipality
|
return DropdownMenuItem(
|
||||||
?.province
|
value: province,
|
||||||
?.description ==
|
child: Text(
|
||||||
null
|
province.description!));
|
||||||
? 'region'
|
}).toList(),
|
||||||
: 'pprovince'),
|
decoration: normalTextFieldStyle(
|
||||||
|
"Province", province)
|
||||||
|
.copyWith(
|
||||||
|
hintStyle: const TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
labelStyle: const TextStyle(
|
||||||
|
color: Colors.black),
|
||||||
|
)),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
|
@ -257,6 +303,5 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
return Container();
|
return Container();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/src/widgets/framework.dart';
|
import 'package:flutter/src/widgets/framework.dart';
|
||||||
import 'package:flutter/src/widgets/placeholder.dart';
|
import 'package:flutter/src/widgets/placeholder.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
import 'package:fluttericon/font_awesome_icons.dart';
|
import 'package:fluttericon/font_awesome_icons.dart';
|
||||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||||
import 'package:unit2/bloc/user/user_bloc.dart';
|
import 'package:unit2/bloc/user/user_bloc.dart';
|
||||||
|
@ -32,113 +33,135 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
body: BlocBuilder<UserBloc, UserState>(
|
body: BlocBuilder<UserBloc, UserState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is UserLoggedIn) {
|
if (state is UserLoggedIn) {
|
||||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
return ProgressHUD(
|
||||||
builder: (context, state) {
|
child: BlocConsumer<ProfileBloc, ProfileState>(
|
||||||
if (state is EligibilityLoaded) {
|
listener: (context, state) {
|
||||||
return ListView.builder(
|
if (state is EditEligibilityState) {
|
||||||
padding: const EdgeInsets.symmetric(
|
final progress = ProgressHUD.of(context);
|
||||||
vertical: 8, horizontal: 10),
|
progress!.dismiss();
|
||||||
itemCount: state.eligibilities.length,
|
}
|
||||||
itemBuilder: (BuildContext context, int index) {
|
// TODO: implement listener
|
||||||
String title =
|
},
|
||||||
state.eligibilities[index].eligibility!.title!;
|
builder: (context, state) {
|
||||||
return Column(
|
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
builder: (context, state) {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
if (state is EligibilityLoaded) {
|
||||||
children: [
|
return ListView.builder(
|
||||||
Container(
|
padding: const EdgeInsets.symmetric(
|
||||||
width: screenWidth,
|
vertical: 8, horizontal: 10),
|
||||||
padding: const EdgeInsets.symmetric(
|
itemCount: state.eligibilities.length,
|
||||||
horizontal: 12, vertical: 8),
|
itemBuilder: (BuildContext context, int index) {
|
||||||
decoration: box1(),
|
String title = state
|
||||||
child: Row(
|
.eligibilities[index].eligibility!.title!;
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Container(
|
||||||
child: Column(
|
width: screenWidth,
|
||||||
mainAxisAlignment:
|
padding: const EdgeInsets.symmetric(
|
||||||
MainAxisAlignment.start,
|
horizontal: 12, vertical: 8),
|
||||||
crossAxisAlignment:
|
decoration: box1(),
|
||||||
CrossAxisAlignment.start,
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Expanded(
|
||||||
title,
|
child: Column(
|
||||||
style: Theme.of(context)
|
mainAxisAlignment:
|
||||||
.textTheme
|
MainAxisAlignment.start,
|
||||||
.titleMedium!
|
crossAxisAlignment:
|
||||||
.copyWith(
|
CrossAxisAlignment.start,
|
||||||
fontWeight:
|
children: [
|
||||||
FontWeight.w500),
|
Text(
|
||||||
|
title,
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(
|
||||||
|
fontWeight:
|
||||||
|
FontWeight
|
||||||
|
.w500),
|
||||||
|
),
|
||||||
|
const Divider(),
|
||||||
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"$licenseNumber: ${state.eligibilities[index].licenseNumber == null ? 'N/A' : state.eligibilities[index].licenseNumber.toString()}",
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleSmall),
|
||||||
|
const SizedBox(
|
||||||
|
height: 3,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
" : ${state.eligibilities[index].rating}.",
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleSmall)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
AppPopupMenu<int>(
|
||||||
|
offset: const Offset(-10, -10),
|
||||||
|
elevation: 3,
|
||||||
|
onSelected: (value) {
|
||||||
|
if (value == 2) {
|
||||||
|
confirmAlert(
|
||||||
|
context,
|
||||||
|
() => null,
|
||||||
|
"Delete?",
|
||||||
|
"Confirm Delete?");
|
||||||
|
}
|
||||||
|
if (value == 1) {
|
||||||
|
final progress =
|
||||||
|
ProgressHUD.of(context);
|
||||||
|
progress!
|
||||||
|
.showWithText("Loading...");
|
||||||
|
context.read<ProfileBloc>().add(
|
||||||
|
EditEligibility(
|
||||||
|
eligibityCert:
|
||||||
|
state.eligibilities[
|
||||||
|
index]));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
menuItems: [
|
||||||
|
popMenuItem(
|
||||||
|
text: "Edit",
|
||||||
|
value: 1,
|
||||||
|
icon: Icons.edit),
|
||||||
|
popMenuItem(
|
||||||
|
text: "Delete",
|
||||||
|
value: 2,
|
||||||
|
icon: Icons.delete),
|
||||||
|
popMenuItem(
|
||||||
|
text: "Attachment",
|
||||||
|
value: 3,
|
||||||
|
icon: FontAwesome.attach)
|
||||||
|
],
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
const Divider(),
|
tooltip: "Options",
|
||||||
const SizedBox(
|
)
|
||||||
height: 5,
|
],
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"$licenseNumber: ${state.eligibilities[index].licenseNumber == null ? 'N/A' : state.eligibilities[index].licenseNumber.toString()}",
|
|
||||||
style: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.titleSmall),
|
|
||||||
const SizedBox(
|
|
||||||
height: 3,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
" : ${state.eligibilities[index].rating}.",
|
|
||||||
style: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.titleSmall)
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
AppPopupMenu<int>(
|
|
||||||
offset: const Offset(-10, -10),
|
|
||||||
elevation: 3,
|
|
||||||
onSelected: (value) {
|
|
||||||
if (value == 2) {
|
|
||||||
confirmAlert(context, () => null,
|
|
||||||
"Delete?", "Confirm Delete?");
|
|
||||||
}
|
|
||||||
if (value == 1) {
|
|
||||||
context.read<ProfileBloc>().add(
|
|
||||||
EditEligibility(
|
|
||||||
eligibityCert: state
|
|
||||||
.eligibilities[index]));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
menuItems: [
|
|
||||||
popMenuItem(
|
|
||||||
text: "Edit",
|
|
||||||
value: 1,
|
|
||||||
icon: Icons.edit),
|
|
||||||
popMenuItem(
|
|
||||||
text: "Delete",
|
|
||||||
value: 2,
|
|
||||||
icon: Icons.delete),
|
|
||||||
popMenuItem(
|
|
||||||
text: "Attachment",
|
|
||||||
value: 3,
|
|
||||||
icon: FontAwesome.attach)
|
|
||||||
],
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.more_vert,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
),
|
||||||
tooltip: "Options",
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
),
|
});
|
||||||
const SizedBox(
|
}
|
||||||
height: 5,
|
if (state is EditEligibilityState) {
|
||||||
)
|
return EditEligibilityScreen(
|
||||||
],
|
eligibityCert: state.eligibityCert);
|
||||||
);
|
}
|
||||||
});
|
return Container();
|
||||||
}
|
},
|
||||||
if (state is EditEligibilityState) {
|
);
|
||||||
return EditEligibilityScreen(
|
},
|
||||||
eligibityCert: state.eligibityCert);
|
),
|
||||||
}
|
|
||||||
return Container();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Container();
|
return Container();
|
||||||
|
|
|
@ -230,8 +230,8 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
|
|
||||||
BlocProvider.of<UserBloc>(context)
|
BlocProvider.of<UserBloc>(context)
|
||||||
.add(UserLogin(
|
.add(UserLogin(
|
||||||
username: "rjvincentlopeplopez",
|
username: "rodolfobacuinjr",
|
||||||
password: "shesthequ33n",
|
password: "nav071394",
|
||||||
// username: _formKey
|
// username: _formKey
|
||||||
// .currentState!
|
// .currentState!
|
||||||
// .value['username'],
|
// .value['username'],
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:convert';
|
||||||
|
|
||||||
import 'package:unit2/model/location/country.dart';
|
import 'package:unit2/model/location/country.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:unit2/model/location/provinces.dart';
|
||||||
import 'package:unit2/utils/request.dart';
|
import 'package:unit2/utils/request.dart';
|
||||||
import 'package:unit2/utils/urls.dart';
|
import 'package:unit2/utils/urls.dart';
|
||||||
|
|
||||||
|
@ -10,13 +11,16 @@ class LocationUtils {
|
||||||
static final LocationUtils _instance = LocationUtils();
|
static final LocationUtils _instance = LocationUtils();
|
||||||
static LocationUtils get instance => _instance;
|
static LocationUtils get instance => _instance;
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
};
|
||||||
|
|
||||||
Future<List<Country>>getCountries()async{
|
Future<List<Country>>getCountries()async{
|
||||||
List<Country> countries=[];
|
List<Country> countries=[];
|
||||||
String path = Url.instance.getCounties();
|
String path = Url.instance.getCounties();
|
||||||
|
|
||||||
Map<String, String> headers = {
|
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
};
|
|
||||||
// try{
|
// try{
|
||||||
http.Response response = await Request.instance.getRequest(path: path, param: {},headers: headers);
|
http.Response response = await Request.instance.getRequest(path: path, param: {},headers: headers);
|
||||||
if(response.statusCode == 200){
|
if(response.statusCode == 200){
|
||||||
|
@ -39,9 +43,7 @@ Future<List<Region>>getRegions()async{
|
||||||
List<Region> regions=[];
|
List<Region> regions=[];
|
||||||
String path = Url.instance.getRegions();
|
String path = Url.instance.getRegions();
|
||||||
|
|
||||||
Map<String, String> headers = {
|
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
};
|
|
||||||
// try{
|
// try{
|
||||||
http.Response response = await Request.instance.getRequest(path: path, param: {},headers: headers);
|
http.Response response = await Request.instance.getRequest(path: path, param: {},headers: headers);
|
||||||
if(response.statusCode == 200){
|
if(response.statusCode == 200){
|
||||||
|
@ -58,4 +60,24 @@ Future<List<Region>>getRegions()async{
|
||||||
// }
|
// }
|
||||||
return regions;
|
return regions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<List<Province>>getProvinces({required String regionCode})async{
|
||||||
|
List<Province> provinces = [];
|
||||||
|
String path = Url.instance.getProvinces()+regionCode;
|
||||||
|
|
||||||
|
try{
|
||||||
|
http.Response response = await Request.instance.getRequest(path: path,param:{},headers: headers);
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
if(data['data'] != null){
|
||||||
|
data['data'].forEach((var province){
|
||||||
|
Province newProvince = Province.fromJson(province);
|
||||||
|
provinces.add(newProvince);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch(e){
|
||||||
|
throw(e.toString());
|
||||||
|
}
|
||||||
|
return provinces;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -26,4 +26,7 @@ String eligibilities(){
|
||||||
String getRegions(){
|
String getRegions(){
|
||||||
return "/api/web_app/location/region/";
|
return "/api/web_app/location/region/";
|
||||||
}
|
}
|
||||||
|
String getProvinces(){
|
||||||
|
return "api/web_app/location/province/";
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue