load eligibilities with profile bloc
parent
0fb2ca49fa
commit
b9615e3666
|
@ -2,6 +2,7 @@ import 'package:bloc/bloc.dart';
|
|||
import 'package:equatable/equatable.dart';
|
||||
import 'package:unit2/model/profile/basic_info.dart';
|
||||
import 'package:unit2/model/profile/basic_information/primary-information.dart';
|
||||
import 'package:unit2/model/profile/eligibility.dart';
|
||||
import 'package:unit2/model/profile/profileInfomation.dart';
|
||||
import 'package:unit2/sevices/profile/profile_service.dart';
|
||||
|
||||
|
@ -23,5 +24,10 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||
// emit(ProfileErrorState(mesage: e.toString()));
|
||||
// }
|
||||
});
|
||||
|
||||
on<LoadEligibility>((event,emit){
|
||||
emit(ProfileLoading());
|
||||
emit(EligibilityLoaded(eligibilities: event.eligibilities));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,3 +21,10 @@ class LoadProfileInformation extends ProfileEvent{
|
|||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class LoadEligibility extends ProfileEvent{
|
||||
final List<EligibityCert> eligibilities;
|
||||
const LoadEligibility({required this.eligibilities});
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
|
|
|
@ -27,3 +27,10 @@ class ProfileLoading extends ProfileState{
|
|||
|
||||
}
|
||||
|
||||
class EligibilityLoaded extends ProfileState{
|
||||
final List<EligibityCert> eligibilities;
|
||||
const EligibilityLoaded({required this.eligibilities});
|
||||
@override
|
||||
List<Object> get props => [eligibilities];
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
// To parse this JSON data, do
|
||||
//
|
||||
// final barangay = barangayFromJson(jsonString);
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
Barangay barangayFromJson(String str) => Barangay.fromJson(json.decode(str));
|
||||
|
||||
String barangayToJson(Barangay data) => json.encode(data.toJson());
|
||||
|
||||
class Barangay {
|
||||
Barangay({
|
||||
required this.code,
|
||||
required this.description,
|
||||
required this.cityMunicipality,
|
||||
});
|
||||
|
||||
final String code;
|
||||
final String description;
|
||||
final CityMunicipality cityMunicipality;
|
||||
|
||||
factory Barangay.fromJson(Map<String, dynamic> json) => Barangay(
|
||||
code: json["code"],
|
||||
description: json["description"],
|
||||
cityMunicipality: CityMunicipality.fromJson(json["city_municipality"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"code": code,
|
||||
"description": description,
|
||||
"city_municipality": cityMunicipality.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class CityMunicipality {
|
||||
CityMunicipality({
|
||||
required this.code,
|
||||
required this.description,
|
||||
required this.province,
|
||||
required this.psgcCode,
|
||||
required this.zipcode,
|
||||
});
|
||||
|
||||
final String code;
|
||||
final String description;
|
||||
final Province province;
|
||||
final String psgcCode;
|
||||
final String zipcode;
|
||||
|
||||
factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
|
||||
code: json["code"],
|
||||
description: json["description"],
|
||||
province: Province.fromJson(json["province"]),
|
||||
psgcCode: json["psgc_code"],
|
||||
zipcode: json["zipcode"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"code": code,
|
||||
"description": description,
|
||||
"province": province.toJson(),
|
||||
"psgc_code": psgcCode,
|
||||
"zipcode": zipcode,
|
||||
};
|
||||
}
|
||||
|
||||
class Province {
|
||||
Province({
|
||||
required this.code,
|
||||
required this.description,
|
||||
required this.region,
|
||||
required this.psgcCode,
|
||||
required this.shortname,
|
||||
});
|
||||
|
||||
final String code;
|
||||
final String description;
|
||||
final Region region;
|
||||
final String psgcCode;
|
||||
final String shortname;
|
||||
|
||||
factory Province.fromJson(Map<String, dynamic> json) => Province(
|
||||
code: json["code"],
|
||||
description: json["description"],
|
||||
region: Region.fromJson(json["region"]),
|
||||
psgcCode: json["psgc_code"],
|
||||
shortname: json["shortname"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"code": code,
|
||||
"description": description,
|
||||
"region": region.toJson(),
|
||||
"psgc_code": psgcCode,
|
||||
"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,
|
||||
};
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
// To parse this JSON data, do
|
||||
//
|
||||
// final city = cityFromJson(jsonString);
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
City cityFromJson(String str) => City.fromJson(json.decode(str));
|
||||
|
||||
String cityToJson(City data) => json.encode(data.toJson());
|
||||
|
||||
class City {
|
||||
City({
|
||||
required this.code,
|
||||
required this.description,
|
||||
required this.province,
|
||||
required this.psgcCode,
|
||||
required this.zipcode,
|
||||
});
|
||||
|
||||
final String code;
|
||||
final String description;
|
||||
final Province province;
|
||||
final String psgcCode;
|
||||
final String zipcode;
|
||||
|
||||
factory City.fromJson(Map<String, dynamic> json) => City(
|
||||
code: json["code"],
|
||||
description: json["description"],
|
||||
province: Province.fromJson(json["province"]),
|
||||
psgcCode: json["psgc_code"],
|
||||
zipcode: json["zipcode"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"code": code,
|
||||
"description": description,
|
||||
"province": province.toJson(),
|
||||
"psgc_code": psgcCode,
|
||||
"zipcode": zipcode,
|
||||
};
|
||||
}
|
||||
|
||||
class Province {
|
||||
Province({
|
||||
required this.code,
|
||||
required this.description,
|
||||
required this.region,
|
||||
required this.psgcCode,
|
||||
required this.shortname,
|
||||
});
|
||||
|
||||
final String code;
|
||||
final String description;
|
||||
final Region region;
|
||||
final String psgcCode;
|
||||
final String shortname;
|
||||
|
||||
factory Province.fromJson(Map<String, dynamic> json) => Province(
|
||||
code: json["code"],
|
||||
description: json["description"],
|
||||
region: Region.fromJson(json["region"]),
|
||||
psgcCode: json["psgc_code"],
|
||||
shortname: json["shortname"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"code": code,
|
||||
"description": description,
|
||||
"region": region.toJson(),
|
||||
"psgc_code": psgcCode,
|
||||
"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,
|
||||
};
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
// To parse this JSON data, do
|
||||
//
|
||||
// final country = countryFromJson(jsonString);
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
Country countryFromJson(String str) => Country.fromJson(json.decode(str));
|
||||
|
||||
String countryToJson(Country data) => json.encode(data.toJson());
|
||||
|
||||
class Country {
|
||||
Country({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.code,
|
||||
});
|
||||
|
||||
final int id;
|
||||
final String name;
|
||||
final String code;
|
||||
|
||||
factory Country.fromJson(Map<String, dynamic> json) => Country(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
code: json["code"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"code": code,
|
||||
};
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
// To parse this JSON data, do
|
||||
//
|
||||
// final province = provinceFromJson(jsonString);
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
Province provinceFromJson(String str) => Province.fromJson(json.decode(str));
|
||||
|
||||
String provinceToJson(Province data) => json.encode(data.toJson());
|
||||
|
||||
class Province {
|
||||
Province({
|
||||
required this.code,
|
||||
required this.description,
|
||||
required this.region,
|
||||
required this.psgcCode,
|
||||
required this.shortname,
|
||||
});
|
||||
|
||||
final String code;
|
||||
final String description;
|
||||
final Region region;
|
||||
final String psgcCode;
|
||||
final String shortname;
|
||||
|
||||
factory Province.fromJson(Map<String, dynamic> json) => Province(
|
||||
code: json["code"],
|
||||
description: json["description"],
|
||||
region: Region.fromJson(json["region"]),
|
||||
psgcCode: json["psgc_code"],
|
||||
shortname: json["shortname"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"code": code,
|
||||
"description": description,
|
||||
"region": region.toJson(),
|
||||
"psgc_code": psgcCode,
|
||||
"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,
|
||||
};
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
// To parse this JSON data, do
|
||||
//
|
||||
// final region = regionFromJson(jsonString);
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
Region regionFromJson(String str) => Region.fromJson(json.decode(str));
|
||||
|
||||
String regionToJson(Region data) => json.encode(data.toJson());
|
||||
|
||||
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,
|
||||
};
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
// To parse this JSON data, do
|
||||
//
|
||||
// final eligibilities = eligibilitiesFromJson(jsonString);
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
Eligibilities eligibilitiesFromJson(String str) => Eligibilities.fromJson(json.decode(str));
|
||||
|
||||
String eligibilitiesToJson(Eligibilities data) => json.encode(data.toJson());
|
||||
|
||||
class Eligibilities {
|
||||
Eligibilities({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.type,
|
||||
});
|
||||
|
||||
final int id;
|
||||
final String title;
|
||||
final String type;
|
||||
|
||||
factory Eligibilities.fromJson(Map<String, dynamic> json) => Eligibilities(
|
||||
id: json["id"],
|
||||
title: json["title"],
|
||||
type: json["type"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"title": title,
|
||||
"type": type,
|
||||
};
|
||||
}
|
|
@ -0,0 +1,225 @@
|
|||
import 'package:date_time_picker/date_time_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/src/widgets/framework.dart';
|
||||
import 'package:flutter/src/widgets/placeholder.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:unit2/model/profile/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';
|
||||
import '../../../../utils/text_container.dart';
|
||||
|
||||
class EditEligibilityScreen extends StatefulWidget {
|
||||
final EligibityCert eligibityCert;
|
||||
const EditEligibilityScreen({super.key,required this.eligibityCert});
|
||||
|
||||
@override
|
||||
State<EditEligibilityScreen> createState() => _EditEligibilityScreenState();
|
||||
}
|
||||
|
||||
class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||
final formKey = GlobalKey<FormBuilderState>();
|
||||
bool overseas =false;
|
||||
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 25, horizontal: 18),
|
||||
child: FormBuilder(
|
||||
key: formKey,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
FormBuilderTextField(
|
||||
name: "eligibility",
|
||||
initialValue: widget.eligibityCert.eligibility!.title!,
|
||||
decoration:
|
||||
normalTextFieldStyle("Eligibility", "Eligibility"),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: screenWidth,
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: FormBuilderTextField(
|
||||
name: 'license number',
|
||||
initialValue:
|
||||
widget.eligibityCert.licenseNumber,
|
||||
decoration: normalTextFieldStyle(
|
||||
"license number", "license number"),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: FormBuilderTextField(
|
||||
name: 'rating',
|
||||
initialValue:
|
||||
widget.eligibityCert.rating.toString(),
|
||||
decoration:
|
||||
normalTextFieldStyle('rating', 'rating'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: screenWidth,
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: DateTimePicker(
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
decoration: normalTextFieldStyle(
|
||||
"Exam date", "Exam date"),
|
||||
initialValue:
|
||||
widget.eligibityCert.examDate == null
|
||||
? ''
|
||||
: dteFormat2.format(
|
||||
widget.eligibityCert.examDate!),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: DateTimePicker(
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
decoration: normalTextFieldStyle(
|
||||
"Validity date", "Validity date"),
|
||||
initialValue:
|
||||
widget.eligibityCert.validityDate == null
|
||||
? ''
|
||||
: dteFormat2.format(
|
||||
widget.eligibityCert.validityDate!),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Text(
|
||||
"Placement of Examination/Confinement",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.displaySmall!
|
||||
.copyWith(fontSize: blockSizeVertical * 2),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
FormBuilderSwitch(
|
||||
initialValue: overseas,
|
||||
activeColor: second,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
overseas = value!;
|
||||
});
|
||||
},
|
||||
decoration: normalTextFieldStyle("", ''),
|
||||
name: 'overseas',
|
||||
title: const Text("Overseas Address?"),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
child: overseas == true
|
||||
? FormBuilderTextField(
|
||||
name: 'country',
|
||||
decoration: normalTextFieldStyle(
|
||||
"Country", "Country"),
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
FormBuilderDropdown(
|
||||
decoration: normalTextFieldStyle(
|
||||
"Region", "Region"),
|
||||
name: 'region',
|
||||
items: [],
|
||||
initialValue: widget
|
||||
.eligibityCert
|
||||
.examAddress
|
||||
?.cityMunicipality
|
||||
?.province
|
||||
?.region
|
||||
?.description ==
|
||||
null
|
||||
? 'region'
|
||||
: 'region',
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
FormBuilderDropdown(
|
||||
decoration: normalTextFieldStyle(
|
||||
'Province', "Province"),
|
||||
name: 'province',
|
||||
items: [],
|
||||
initialValue: widget
|
||||
.eligibityCert
|
||||
.examAddress
|
||||
?.cityMunicipality
|
||||
?.province
|
||||
?.description ==
|
||||
null
|
||||
? 'region'
|
||||
: 'pprovince'),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
FormBuilderDropdown(
|
||||
decoration: normalTextFieldStyle(
|
||||
"Municipality", "Municipality"),
|
||||
name: 'municipality',
|
||||
items: [],
|
||||
initialValue: widget
|
||||
.eligibityCert
|
||||
.examAddress
|
||||
?.cityMunicipality
|
||||
?.description ==
|
||||
null
|
||||
? 'region'
|
||||
: 'municipality',
|
||||
),
|
||||
],
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: screenWidth,
|
||||
height: 60,
|
||||
child: ElevatedButton(
|
||||
style: mainBtnStyle(
|
||||
primary, Colors.transparent, second),
|
||||
onPressed: () {},
|
||||
child: const Text(submit)),
|
||||
),
|
||||
const SizedBox(height: 20,),
|
||||
|
||||
]),
|
||||
),
|
||||
),
|
||||
);;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
import 'package:app_popup_menu/app_popup_menu.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/src/widgets/framework.dart';
|
||||
import 'package:flutter/src/widgets/placeholder.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:fluttericon/font_awesome_icons.dart';
|
||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||
import 'package:unit2/bloc/user/user_bloc.dart';
|
||||
import 'package:unit2/model/profile/eligibility.dart';
|
||||
import 'package:unit2/screens/profile/components/eligibility/edit_modal.dart';
|
||||
import 'package:unit2/theme-data.dart/box_shadow.dart';
|
||||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/alerts.dart';
|
||||
import 'package:unit2/utils/global.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
class EligibiltyScreen extends StatefulWidget {
|
||||
const EligibiltyScreen({super.key,});
|
||||
|
||||
@override
|
||||
State<EligibiltyScreen> createState() => _EligibiltyScreenState();
|
||||
}
|
||||
|
||||
class _EligibiltyScreenState extends State<EligibiltyScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text(elibilityScreenTitle),
|
||||
centerTitle: true,
|
||||
backgroundColor: primary,
|
||||
actions: context.read()[AddLeading(
|
||||
onPressed: () => () {},
|
||||
)],
|
||||
),
|
||||
body: BlocBuilder<UserBloc, UserState>(
|
||||
builder: (context, state) {
|
||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||
builder: (context, state) {
|
||||
if(state is EligibilityLoaded){
|
||||
return ListView.builder(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
|
||||
itemCount: state.eligibilities.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
String title =
|
||||
state.eligibilities[index].eligibility!.title!;
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: screenWidth,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 8),
|
||||
decoration: box1(),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
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 ?? 'N/A'}.",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall)
|
||||
]),
|
||||
),
|
||||
AppPopupMenu<int>(
|
||||
offset: const Offset(-10, -10),
|
||||
elevation: 3,
|
||||
onSelected: (value) {
|
||||
// if (value == 1) {
|
||||
// confirmAlert(context, () => null,
|
||||
// "Delete?", "Confirm Delete?");
|
||||
// }
|
||||
// if (value == 2) {
|
||||
// context.read<ProfileBloc>().add(
|
||||
// EditEligibility(
|
||||
// eligibityCert: widget
|
||||
// .eligibilities[index]));
|
||||
// }
|
||||
},
|
||||
menuItems: [
|
||||
PopupMenuItem(
|
||||
value: 1,
|
||||
child: Row(
|
||||
children: const [
|
||||
Icon(
|
||||
Icons.delete,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Delete',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 2,
|
||||
child: Row(
|
||||
children: const [
|
||||
Icon(
|
||||
Icons.edit,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Edit',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 2,
|
||||
child: Row(
|
||||
children: const [
|
||||
Icon(
|
||||
FontAwesome.attach,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Attachment',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
icon: const Icon(
|
||||
Icons.more_vert,
|
||||
color: Colors.grey,
|
||||
),
|
||||
tooltip: "Options",
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
);
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import 'package:fluttericon/entypo_icons.dart';
|
|||
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||
import 'package:fluttericon/modern_pictograms_icons.dart';
|
||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||
import 'package:unit2/model/login_data/employee_info/employee_info.dart';
|
||||
import 'package:unit2/screens/profile/components/basic_information/address_screen.dart';
|
||||
import 'package:unit2/screens/profile/components/basic_information/citizenship_screen.dart';
|
||||
import 'package:unit2/screens/profile/components/basic_information/contact_information_screen.dart';
|
||||
|
@ -46,8 +47,7 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
title: const Text('Profile'),
|
||||
),
|
||||
body: ProgressHUD(
|
||||
child:
|
||||
BlocBuilder<UserBloc, UserState>(builder: (context, state) {
|
||||
child: BlocBuilder<UserBloc, UserState>(builder: (context, state) {
|
||||
if (state is UserLoggedIn) {
|
||||
return BlocConsumer<ProfileBloc, ProfileState>(
|
||||
listener: (context, state) {
|
||||
|
@ -64,20 +64,20 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
},
|
||||
builder: (context, state) {
|
||||
if (state is ProfileLoaded) {
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 12, horizontal: 12),
|
||||
child: ListView(
|
||||
children: [
|
||||
Text(
|
||||
"View and Update your Profile Information",textAlign: TextAlign.center
|
||||
,style: Theme.of(context).textTheme.bodyLarge,),
|
||||
Text(
|
||||
"View and Update your Profile Information",
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
ExpandableGroup(
|
||||
collapsedIcon:
|
||||
const Icon(Icons.keyboard_arrow_down),
|
||||
expandedIcon:
|
||||
const Icon(Icons.keyboard_arrow_up),
|
||||
expandedIcon: const Icon(Icons.keyboard_arrow_up),
|
||||
header: const ListTile(
|
||||
leading: Icon(
|
||||
Elusive.address_book,
|
||||
|
@ -85,115 +85,157 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
),
|
||||
title: Text(
|
||||
"Basic Information",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold),
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
items: [
|
||||
subMenu(Icons.person, "Primary",(){
|
||||
Navigator.push(context,MaterialPageRoute(builder: (BuildContext context){
|
||||
return PrimaryInfo(primaryInformation: state.profileInformation.basicInfo.primaryInformation!);
|
||||
}) );
|
||||
subMenu(Icons.person, "Primary", () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return PrimaryInfo(
|
||||
primaryInformation: state
|
||||
.profileInformation
|
||||
.basicInfo
|
||||
.primaryInformation!);
|
||||
}));
|
||||
}),
|
||||
subMenu(Icons.home, "Home Addresses",(){
|
||||
Navigator.push(context,MaterialPageRoute(builder: (BuildContext context){
|
||||
return AddressScreen(addresses: state.profileInformation.basicInfo.addresses);
|
||||
}) );
|
||||
|
||||
subMenu(Icons.home, "Home Addresses", () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return AddressScreen(
|
||||
addresses: state.profileInformation
|
||||
.basicInfo.addresses);
|
||||
}));
|
||||
}),
|
||||
subMenu(
|
||||
Icons.contact_mail, "Identifications",(){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return IdentificationsScreen(identities: state.profileInformation.basicInfo.identifications);
|
||||
}));
|
||||
}),
|
||||
subMenu(
|
||||
Icons.contact_phone, "Contact Info",(){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return ContactInformationScreen(contacts: state.profileInformation.basicInfo.contactInformation,);
|
||||
}));
|
||||
}),
|
||||
subMenu(Icons.flag, "Citizenships",(){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return CitizenShipScreen(citizenships: state.profileInformation.basicInfo.citizenships,);
|
||||
subMenu(Icons.contact_mail, "Identifications",
|
||||
() {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return IdentificationsScreen(
|
||||
identities: state.profileInformation
|
||||
.basicInfo.identifications);
|
||||
}));
|
||||
}),
|
||||
subMenu(Icons.contact_phone, "Contact Info",
|
||||
() {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ContactInformationScreen(
|
||||
contacts: state.profileInformation
|
||||
.basicInfo.contactInformation,
|
||||
);
|
||||
}));
|
||||
}),
|
||||
subMenu(Icons.flag, "Citizenships", () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return CitizenShipScreen(
|
||||
citizenships: state.profileInformation
|
||||
.basicInfo.citizenships,
|
||||
);
|
||||
}));
|
||||
}),
|
||||
]),
|
||||
const Divider(),
|
||||
MainMenu(
|
||||
MainMenu(
|
||||
icon: Elusive.group,
|
||||
title: "Family",
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return FamilyBackgroundScreen(familyBackground: state.profileInformation.families);
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return FamilyBackgroundScreen(
|
||||
familyBackground:
|
||||
state.profileInformation.families);
|
||||
}));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
MainMenu(
|
||||
MainMenu(
|
||||
icon: FontAwesome5.graduation_cap,
|
||||
title: "Education",
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return EducationScreen(educationBackgrounds: state.profileInformation.educationalBackgrounds);
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return EducationScreen(
|
||||
educationBackgrounds: state
|
||||
.profileInformation
|
||||
.educationalBackgrounds);
|
||||
}));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
MainMenu(
|
||||
MainMenu(
|
||||
icon: Icons.stars,
|
||||
title: "Eligibility",
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return EligibiltyScreen(eligibilities: state.profileInformation.eligibilities);
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return BlocProvider<ProfileBloc>.value(value: ProfileBloc()..add(LoadEligibility(eligibilities: state.profileInformation.eligibilities)),
|
||||
|
||||
child: EligibiltyScreen(
|
||||
eligibilities: state
|
||||
.profileInformation.eligibilities),
|
||||
);
|
||||
}));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
MainMenu(
|
||||
MainMenu(
|
||||
icon: FontAwesome5.shopping_bag,
|
||||
title: "Work History",
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return WorkHistoryScreen(workExperiences: state.profileInformation.workExperiences);
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return WorkHistoryScreen(
|
||||
workExperiences: state
|
||||
.profileInformation.workExperiences);
|
||||
}));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
MainMenu(
|
||||
MainMenu(
|
||||
icon: FontAwesome5.walking,
|
||||
title: "Voluntary Work & Civic Services",
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return VolunataryWorkScreen(voluntaryWorks: state.profileInformation.voluntaryWorks);
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return VolunataryWorkScreen(
|
||||
voluntaryWorks: state
|
||||
.profileInformation.voluntaryWorks);
|
||||
}));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
MainMenu(
|
||||
MainMenu(
|
||||
icon: Elusive.lightbulb,
|
||||
title: "Learning & Development",
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return LearningAndDevelopmentScreen(learningDevelopments: state.profileInformation.learningsAndDevelopment);
|
||||
}));
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return LearningAndDevelopmentScreen(
|
||||
learningDevelopments: state
|
||||
.profileInformation
|
||||
.learningsAndDevelopment);
|
||||
}));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
MainMenu(
|
||||
MainMenu(
|
||||
icon: Brandico.codepen,
|
||||
title: "Personal References",
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return ReferencesScreen(references: state.profileInformation.references);
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ReferencesScreen(
|
||||
references:
|
||||
state.profileInformation.references);
|
||||
}));
|
||||
},
|
||||
),
|
||||
ExpandableGroup(
|
||||
collapsedIcon:
|
||||
const Icon(Icons.keyboard_arrow_down),
|
||||
expandedIcon:
|
||||
const Icon(Icons.keyboard_arrow_up),
|
||||
expandedIcon: const Icon(Icons.keyboard_arrow_up),
|
||||
header: const ListTile(
|
||||
leading: Icon(
|
||||
Icons.info,
|
||||
|
@ -201,36 +243,45 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
),
|
||||
title: Text(
|
||||
"Other Information",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold),
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
items: [
|
||||
subMenu(Icons.fitness_center,
|
||||
"Skills & Hobbies",(){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return SkillHobbiesScreen(skillsHobbies: state.profileInformation.otherInformation.skillsAndHobbies);
|
||||
}));
|
||||
}),
|
||||
subMenu(
|
||||
Icons.fitness_center, "Skills & Hobbies",
|
||||
() {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return SkillHobbiesScreen(
|
||||
skillsHobbies: state.profileInformation
|
||||
.otherInformation.skillsAndHobbies);
|
||||
}));
|
||||
}),
|
||||
subMenu(FontAwesome5.certificate,
|
||||
"Organization Memberships",(){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return OrgMembershipsScreen(orgMemberships: state.profileInformation.otherInformation.orgMemberships);
|
||||
}));
|
||||
}),
|
||||
"Organization Memberships", () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return OrgMembershipsScreen(
|
||||
orgMemberships: state.profileInformation
|
||||
.otherInformation.orgMemberships);
|
||||
}));
|
||||
}),
|
||||
subMenu(Entypo.doc_text,
|
||||
"Non-Academic Recognitions",(){
|
||||
|
||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||
return NonAcademicRecognitionScreen(nonAcademicRecognitions: state.profileInformation.otherInformation.nonAcademicRecognition);
|
||||
}));
|
||||
}),
|
||||
"Non-Academic Recognitions", () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return NonAcademicRecognitionScreen(
|
||||
nonAcademicRecognitions: state
|
||||
.profileInformation
|
||||
.otherInformation
|
||||
.nonAcademicRecognition);
|
||||
}));
|
||||
}),
|
||||
]),
|
||||
ExpandableGroup(
|
||||
collapsedIcon:
|
||||
const Icon(Icons.keyboard_arrow_down),
|
||||
expandedIcon:
|
||||
const Icon(Icons.keyboard_arrow_up),
|
||||
expandedIcon: const Icon(Icons.keyboard_arrow_up),
|
||||
header: const ListTile(
|
||||
leading: Icon(
|
||||
FontAwesome5.laptop_house,
|
||||
|
@ -238,13 +289,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
),
|
||||
title: Text(
|
||||
"Assets",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold),
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
items: [
|
||||
subMenu(ModernPictograms.home,
|
||||
"Real Property Tax",(){}),
|
||||
"Real Property Tax", () {}),
|
||||
]),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:toggle_switch/toggle_switch.dart';
|
||||
|
||||
class CostumToggleSwitch extends StatelessWidget {
|
||||
final List<Color> activeBGColors;
|
||||
final List<IconData> icons;
|
||||
final int initialLabelIndex;
|
||||
final void Function(int?)? onToggle;
|
||||
final List<String> labels;
|
||||
const CostumToggleSwitch(
|
||||
{Key? key,
|
||||
required this.activeBGColors,
|
||||
required this.icons,
|
||||
required this.onToggle,
|
||||
required this.labels,
|
||||
required this.initialLabelIndex
|
||||
|
||||
})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
height: 80,
|
||||
child: ToggleSwitch(
|
||||
minWidth: 150.0,
|
||||
cornerRadius: 25.0,
|
||||
activeBgColors: [
|
||||
[Colors.green[800]!],
|
||||
[Colors.red[800]!]
|
||||
],
|
||||
activeFgColor: Colors.white,
|
||||
inactiveBgColor: Colors.grey,
|
||||
inactiveFgColor: Colors.white,
|
||||
initialLabelIndex: initialLabelIndex,
|
||||
totalSwitches: 2,
|
||||
labels: labels,
|
||||
icons: icons,
|
||||
radiusStyle: false,
|
||||
onToggle: onToggle),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -9,6 +9,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
app_popup_menu:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: app_popup_menu
|
||||
sha256: e05b262b65289431603a84e04e53cb2f3aca6013d3ea61e3f24ddd48d49ef848
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -68,6 +68,7 @@ dependencies:
|
|||
permission_handler: ^10.2.0
|
||||
expandable_group: ^0.0.8
|
||||
badges: ^3.0.2
|
||||
app_popup_menu: ^1.0.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
Loading…
Reference in New Issue