refactor models and add empty response to profile screens

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
PGAN-MIS 2023-02-10 15:39:00 +08:00
parent 98991c0ef6
commit 0fb2ca49fa
29 changed files with 452 additions and 288 deletions

View File

@ -5,9 +5,6 @@ import 'package:unit2/model/profile/basic_information/primary-information.dart';
import 'package:unit2/model/profile/profileInfomation.dart'; import 'package:unit2/model/profile/profileInfomation.dart';
import 'package:unit2/sevices/profile/profile_service.dart'; import 'package:unit2/sevices/profile/profile_service.dart';
import '../../model/profile/basic_info.dart';
import '../../model/profile/basic_info.dart';
part 'profile_event.dart'; part 'profile_event.dart';
part 'profile_state.dart'; part 'profile_state.dart';

View File

@ -1,9 +1,3 @@
// To parse this JSON data, do
//
// final citizenship = citizenshipFromJson(jsonString);
import 'package:meta/meta.dart';
import 'dart:convert';
class Citizenship { class Citizenship {
Citizenship({ Citizenship({

View File

@ -48,8 +48,8 @@ class CommService {
factory CommService.fromJson(Map<String, dynamic> json) => CommService( factory CommService.fromJson(Map<String, dynamic> json) => CommService(
id: json["id"], id: json["id"],
serviceType: ServiceType.fromJson(json["service_type"]), serviceType: json["service_type"]==null?null: ServiceType.fromJson(json["service_type"]),
serviceProvider: ServiceProvider.fromJson(json["service_provider"]), serviceProvider: json["service_provider"] == null?null: ServiceProvider.fromJson(json["service_provider"]),
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
@ -73,7 +73,7 @@ class ServiceProvider {
factory ServiceProvider.fromJson(Map<String, dynamic> json) => ServiceProvider( factory ServiceProvider.fromJson(Map<String, dynamic> json) => ServiceProvider(
id: json["id"], id: json["id"],
alias: json["alias"], alias: json["alias"],
agency: Agency.fromJson(json["agency"]), agency: json["agency"] == null? null: Agency.fromJson(json["agency"]),
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
@ -99,7 +99,7 @@ class Agency {
factory Agency.fromJson(Map<String, dynamic> json) => Agency( factory Agency.fromJson(Map<String, dynamic> json) => Agency(
id: json["id"], id: json["id"],
name: json["name"], name: json["name"],
category: Category.fromJson(json["category"]), category: json["category"] == null? null : Category.fromJson(json["category"]),
privateEntity: json["private_entity"], privateEntity: json["private_entity"],
); );
@ -125,7 +125,7 @@ class Category {
factory Category.fromJson(Map<String, dynamic> json) => Category( factory Category.fromJson(Map<String, dynamic> json) => Category(
id: json["id"], id: json["id"],
name: json["name"], name: json["name"],
industryClass: IndustryClass.fromJson(json["industry_class"]), industryClass: json["industry_class"] == null? null: IndustryClass.fromJson(json["industry_class"]),
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {

View File

@ -25,8 +25,8 @@ class Identification {
factory Identification.fromJson(Map<String, dynamic> json) => Identification( factory Identification.fromJson(Map<String, dynamic> json) => Identification(
id: json["id"], id: json["id"],
agency: Agency.fromJson(json["agency"]), agency:json["agency"] == null? null: Agency.fromJson(json["agency"]),
issuedAt: IssuedAt.fromJson(json["issued_at"]), issuedAt: json["issued_at"] == null? null:IssuedAt.fromJson(json["issued_at"]),
dateIssued:json["date_issued"]==null?null:DateTime.parse(json["date_issued"]), dateIssued:json["date_issued"]==null?null:DateTime.parse(json["date_issued"]),
expirationDate:json["expiration_date"]==null?null:DateTime.parse(json["expiration_date"]), expirationDate:json["expiration_date"]==null?null:DateTime.parse(json["expiration_date"]),
asPdfReference: json["as_pdf_reference"], asPdfReference: json["as_pdf_reference"],
@ -60,7 +60,7 @@ class Agency {
factory Agency.fromJson(Map<String, dynamic> json) => Agency( factory Agency.fromJson(Map<String, dynamic> json) => Agency(
id: json["id"], id: json["id"],
name: json["name"], name: json["name"],
category: Category.fromJson(json["category"]), category: json["category"] == null? null: Category.fromJson(json["category"]),
privateEntity: json["private_entity"], privateEntity: json["private_entity"],
); );
@ -86,7 +86,7 @@ class Category {
factory Category.fromJson(Map<String, dynamic> json) => Category( factory Category.fromJson(Map<String, dynamic> json) => Category(
id: json["id"], id: json["id"],
name: json["name"], name: json["name"],
industryClass: IndustryClass.fromJson(json["industry_class"]), industryClass:json['industry_class'] == null? null: IndustryClass.fromJson(json["industry_class"]),
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
@ -140,10 +140,10 @@ class IssuedAt {
factory IssuedAt.fromJson(Map<String, dynamic> json) => IssuedAt( factory IssuedAt.fromJson(Map<String, dynamic> json) => IssuedAt(
id: json["id"], id: json["id"],
issuedAtClass: json["class"], issuedAtClass: json["class"],
country: Country.fromJson(json["country"]), country: json['country'] == null? null: Country.fromJson(json["country"]),
barangay: json["barangay"], barangay: json["barangay"],
addressCategory: AddressCategory.fromJson(json["address_category"]), addressCategory: json["address_category"] == null? null: AddressCategory.fromJson(json["address_category"]),
cityMunicipality: CityMunicipality.fromJson(json["city_municipality"]), cityMunicipality:json["city_municipality"] == null? null: CityMunicipality.fromJson(json["city_municipality"]),
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
@ -198,7 +198,7 @@ class CityMunicipality {
factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality( factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
code: json["code"], code: json["code"],
zipcode: json["zipcode"], zipcode: json["zipcode"],
province: Province.fromJson(json["province"]), province:json["province"] == null? null : Province.fromJson(json["province"]),
psgcCode: json["psgc_code"], psgcCode: json["psgc_code"],
description: json["description"], description: json["description"],
); );
@ -229,7 +229,7 @@ class Province {
factory Province.fromJson(Map<String, dynamic> json) => Province( factory Province.fromJson(Map<String, dynamic> json) => Province(
code: json["code"], code: json["code"],
region: Region.fromJson(json["region"]), region: json["region"] == null? null:Region.fromJson(json["region"]),
psgcCode: json["psgc_code"], psgcCode: json["psgc_code"],
shortname: json["shortname"], shortname: json["shortname"],
description: json["description"], description: json["description"],

View File

@ -33,10 +33,10 @@ class EligibityCert {
factory EligibityCert.fromJson(Map<String, dynamic> json) => EligibityCert( factory EligibityCert.fromJson(Map<String, dynamic> json) => EligibityCert(
id: json["id"], id: json["id"],
rating: json["rating"]?.toDouble(), rating: json["rating"]?.toDouble(),
examDate: DateTime.parse(json["exam_date"]), examDate: json['exam_date'] == null? null: DateTime.parse(json["exam_date"]),
attachments: null, attachments: null,
eligibility: Eligibility.fromJson(json["eligibility"]), eligibility: json['eligibility'] == null?null: Eligibility.fromJson(json["eligibility"]),
examAddress: ExamAddress.fromJson(json["exam_address"]), examAddress: json['eligibilty'] == null? null: ExamAddress.fromJson(json["exam_address"]),
validityDate: json["validity_date"], validityDate: json["validity_date"],
licenseNumber: json["license_number"], licenseNumber: json["license_number"],
); );
@ -97,10 +97,10 @@ class ExamAddress {
factory ExamAddress.fromJson(Map<String, dynamic> json) => ExamAddress( factory ExamAddress.fromJson(Map<String, dynamic> json) => ExamAddress(
id: json["id"], id: json["id"],
examAddressClass: json["class"], examAddressClass: json["class"],
country: Country.fromJson(json["country"]), country:json["country"] == null? null: Country.fromJson(json["country"]),
barangay: json["barangay"], barangay: json["barangay"],
addressCategory: AddressCategory.fromJson(json["address_category"]), addressCategory: json["address_category"] == null?null: AddressCategory.fromJson(json["address_category"]),
cityMunicipality: CityMunicipality.fromJson(json["city_municipality"]), cityMunicipality: json["city_municipality"]==null? null: CityMunicipality.fromJson(json["city_municipality"]),
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
@ -155,7 +155,7 @@ class CityMunicipality {
factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality( factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
code: json["code"], code: json["code"],
zipcode: json["zipcode"], zipcode: json["zipcode"],
province: Province.fromJson(json["province"]), province: json["province"]== null? null: Province.fromJson(json["province"]),
psgcCode: json["psgc_code"], psgcCode: json["psgc_code"],
description: json["description"], description: json["description"],
); );
@ -186,7 +186,7 @@ class Province {
factory Province.fromJson(Map<String, dynamic> json) => Province( factory Province.fromJson(Map<String, dynamic> json) => Province(
code: json["code"], code: json["code"],
region: Region.fromJson(json["region"]), region:json["region"] == null? null: Region.fromJson(json["region"]),
psgcCode: json["psgc_code"], psgcCode: json["psgc_code"],
shortname: json["shortname"], shortname: json["shortname"],
description: json["description"], description: json["description"],

View File

@ -93,7 +93,7 @@ class IndustryClass {
final int? id; final int? id;
final String? name; final String? name;
final dynamic description; final String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass( factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"], id: json["id"],

View File

@ -85,7 +85,7 @@ class IndustryClass {
final int? id; final int? id;
final String? name; final String? name;
final dynamic description; final String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass( factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"], id: json["id"],

View File

@ -139,7 +139,7 @@ class CityMunicipality {
factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality( factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
code: json["code"], code: json["code"],
zipcode: json["zipcode"], zipcode: json["zipcode"],
province: Province.fromJson(json["province"]), province: json["province"] == null? null : Province.fromJson(json["province"]),
psgcCode: json["psgc_code"], psgcCode: json["psgc_code"],
description: json["description"], description: json["description"],
); );
@ -170,7 +170,7 @@ class Province {
factory Province.fromJson(Map<String, dynamic> json) => Province( factory Province.fromJson(Map<String, dynamic> json) => Province(
code: json["code"], code: json["code"],
region: Region.fromJson(json["region"]), region: json["region"] == null? null : Region.fromJson(json["region"]),
psgcCode: json["psgc_code"], psgcCode: json["psgc_code"],
shortname: json["shortname"], shortname: json["shortname"],
description: json["description"], description: json["description"],

View File

@ -28,7 +28,7 @@ class VoluntaryWork {
factory VoluntaryWork.fromJson(Map<String, dynamic> json) => VoluntaryWork( factory VoluntaryWork.fromJson(Map<String, dynamic> json) => VoluntaryWork(
agency: json["agency"] == null ? null : Agency.fromJson(json["agency"]), agency: json["agency"] == null ? null : Agency.fromJson(json["agency"]),
address: json["address"] == null ? null : Address.fromJson(json["address"]), address: json["address"] == null ? null : Address.fromJson(json["address"]),
toDate: json["to_date"], toDate: json["to_date"] == null? null : DateTime.parse(json['to_data']),
position: json["position"] == null ? null : Position.fromJson(json["position"]), position: json["position"] == null ? null : Position.fromJson(json["position"]),
fromDate: json["from_date"] == null ? null : DateTime.parse(json["from_date"]), fromDate: json["from_date"] == null ? null : DateTime.parse(json["from_date"]),
totalHours: json["total_hours"], totalHours: json["total_hours"],
@ -277,7 +277,7 @@ class IndustryClass {
final int? id; final int? id;
final String? name; final String? name;
final dynamic description; final String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass( factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"], id: json["id"],

View File

@ -121,7 +121,7 @@ class IndustryClass {
final int? id; final int? id;
final String? name; final String? name;
final dynamic description; final String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass( factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"], id: json["id"],

View File

@ -4,32 +4,29 @@ import 'package:unit2/theme-data.dart/box_shadow.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global.dart'; import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
class AddressScreen extends StatefulWidget { class AddressScreen extends StatelessWidget {
final List<MainAdress> addresses; final List<MainAdress> addresses;
const AddressScreen({super.key, required this.addresses}); const AddressScreen({super.key, required this.addresses});
@override
State<AddressScreen> createState() => _AddressScreenState();
}
class _AddressScreenState extends State<AddressScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text(adressScreenTitle),centerTitle: true, backgroundColor: primary,), appBar: AppBar(title: const Text(adressScreenTitle),centerTitle: true, backgroundColor: primary, actions: [AddLeading(onPressed: (){})],),
body: ListView.builder( body: addresses.isNotEmpty ? ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10),
itemCount: widget.addresses.length, itemCount: addresses.length,
itemBuilder: ( itemBuilder: (
BuildContext context, int index){ BuildContext context, int index){
String? subdivision = widget.addresses[index].details??''; String? subdivision = addresses[index].details??'';
String category = widget.addresses[index].address!.category!.name!; String category = addresses[index].address!.category!.name!;
String? barangay = widget.addresses[index].address!.barangay != null?'${widget.addresses[index].address!.barangay!.description!.toUpperCase()},':''; String? barangay = addresses[index].address!.barangay != null?'${addresses[index].address!.barangay!.description!.toUpperCase()},':'';
String cityMunicipality = widget.addresses[index].address!.cityMunicipality!.description!; String cityMunicipality = addresses[index].address!.cityMunicipality!.description!;
String province = widget.addresses[index].address!.cityMunicipality!.province!.description!; String province = addresses[index].address!.cityMunicipality!.province!.description!;
String region = widget.addresses[index].address!.cityMunicipality!.province!.region!.description!; String region = addresses[index].address!.cityMunicipality!.province!.region!.description!;
return Column(children: [ return Column(children: [
Column( Column(
@ -54,7 +51,7 @@ class _AddressScreenState extends State<AddressScreen> {
), ),
const SizedBox(height: 5,), const SizedBox(height: 5,),
],); ],);
}), }):const EmptyData(message: "You don't have address added. Please click + to add."),
); );
} }
} }

View File

@ -3,16 +3,13 @@ import 'package:unit2/model/profile/basic_information/contact_information.dart';
import 'package:unit2/theme-data.dart/box_shadow.dart'; import 'package:unit2/theme-data.dart/box_shadow.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
class ContactInformationScreen extends StatefulWidget { class ContactInformationScreen extends StatelessWidget {
final List<ContactInfo> contacts; final List<ContactInfo> contacts;
const ContactInformationScreen({super.key, required this.contacts}); const ContactInformationScreen({super.key, required this.contacts});
@override
State<ContactInformationScreen> createState() => _ContactInformationScreenState();
}
class _ContactInformationScreenState extends State<ContactInformationScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SafeArea( return SafeArea(
@ -21,13 +18,14 @@ class _ContactInformationScreenState extends State<ContactInformationScreen> {
title: const Text(contactScreenTitle), title: const Text(contactScreenTitle),
centerTitle: true, centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
actions: [AddLeading(onPressed: (){})],
), ),
body: ListView.builder( body: contacts.isEmpty? ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10),
itemCount: widget.contacts.length, itemCount: contacts.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
String numberMail = widget.contacts[index].numbermail!; String numberMail = contacts[index].numbermail!;
String commService = widget.contacts[index].commService!.serviceProvider!.alias!; String commService = contacts[index].commService!.serviceProvider!.alias!;
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -52,13 +50,13 @@ class _ContactInformationScreenState extends State<ContactInformationScreen> {
.toString(),style: Theme.of(context).textTheme.titleSmall,), .toString(),style: Theme.of(context).textTheme.titleSmall,),
), ),
widget.contacts[index].active==true? const Badge(backgroundColor: Colors.green, label: Text("Active",),):const SizedBox(), contacts[index].active==true? const Badge(backgroundColor: Colors.green, label: Text("Active",),):const SizedBox(),
const SizedBox(width: 5), const SizedBox(width: 5),
widget.contacts[index].primary==true? const Badge(backgroundColor: Colors.blue, label: Text("Primary"),):const SizedBox() contacts[index].primary==true? const Badge(backgroundColor: Colors.blue, label: Text("Primary"),):const SizedBox()
], ],
), ),
const SizedBox(height: 5,), const SizedBox(height: 5,),
Text(widget.contacts[index].commService! Text(contacts[index].commService!
.serviceProvider!.agency!.name .serviceProvider!.agency!.name
.toString()), .toString()),
@ -74,7 +72,7 @@ class _ContactInformationScreenState extends State<ContactInformationScreen> {
], ],
); );
}), }):const EmptyData(message: "You don't have contact information added. Please click + to add"),
), ),
); );
} }

View File

@ -4,18 +4,13 @@ import 'package:unit2/theme-data.dart/box_shadow.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global.dart'; import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
class IdentificationsScreen extends StatefulWidget { class IdentificationsScreen extends StatelessWidget {
final List<Identification> identities; final List<Identification> identities;
const IdentificationsScreen({super.key, required this.identities}); const IdentificationsScreen({super.key, required this.identities});
@override
State<IdentificationsScreen> createState() =>
_IdentificationsScreenState();
}
class _IdentificationsScreenState
extends State<IdentificationsScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -23,15 +18,16 @@ class _IdentificationsScreenState
title: const Text(identificationScreenTitle), title: const Text(identificationScreenTitle),
centerTitle: true, centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
actions: [AddLeading(onPressed: (){})],
), ),
body: ListView.builder( body:identities.isNotEmpty? ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
itemCount: widget.identities.length, itemCount: identities.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
String agency = widget.identities[index].agency!.name!; String agency = identities[index].agency!.name!;
String idNumber = widget.identities[index].identificationNumber!; String idNumber = identities[index].identificationNumber!;
bool government = widget.identities[index].agency!.privateEntity!; bool government = identities[index].agency!.privateEntity!;
String issuedAt = "${widget.identities[index].issuedAt!.cityMunicipality!.description!} ${widget.identities[index].issuedAt!.cityMunicipality!.province!.description}"; String issuedAt = "${identities[index].issuedAt!.cityMunicipality!.description!} ${identities[index].issuedAt!.cityMunicipality!.province!.description}";
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -84,7 +80,7 @@ class _IdentificationsScreenState
), ),
], ],
); );
}), }):const EmptyData(message: "You don't have identifications added. Please click + to add."),
); );
} }
} }

View File

@ -4,16 +4,13 @@ import 'package:unit2/model/profile/educational_background.dart';
import 'package:unit2/theme-data.dart/box_shadow.dart'; import 'package:unit2/theme-data.dart/box_shadow.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
class EducationScreen extends StatefulWidget { class EducationScreen extends StatelessWidget {
final List<EducationalBackground> educationBackgrounds; final List<EducationalBackground> educationBackgrounds;
const EducationScreen({super.key, required this.educationBackgrounds}); const EducationScreen({super.key, required this.educationBackgrounds});
@override
State<EducationScreen> createState() => _EducationScreenState();
}
class _EducationScreenState extends State<EducationScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -21,23 +18,24 @@ class _EducationScreenState extends State<EducationScreen> {
title: const Text(educationScreenTitle), title: const Text(educationScreenTitle),
centerTitle: true, centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
actions: [AddLeading(onPressed: (){})],
), ),
body: ListView.builder( body: educationBackgrounds.isNotEmpty ? ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
itemCount: widget.educationBackgrounds.length, itemCount: educationBackgrounds.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
String level = widget.educationBackgrounds[index].education!.level!; String level = educationBackgrounds[index].education!.level!;
String periodFrom = widget.educationBackgrounds[index].periodFrom!; String periodFrom = educationBackgrounds[index].periodFrom!;
String periodTo = widget.educationBackgrounds[index].periodTo!; String periodTo = educationBackgrounds[index].periodTo!;
String? program = String? program =
widget.educationBackgrounds[index].education!.course == null educationBackgrounds[index].education!.course == null
? null ? null
: widget.educationBackgrounds[index].education!.course! : educationBackgrounds[index].education!.course!
.program!; .program!;
List<Honor>? honors = List<Honor>? honors =
widget.educationBackgrounds[index].honors!.toList(); educationBackgrounds[index].honors!.toList();
String school = String school =
widget.educationBackgrounds[index].education!.school!.name!; educationBackgrounds[index].education!.school!.name!;
return Column( return Column(
children: [ children: [
Container( Container(
@ -81,13 +79,13 @@ class _EducationScreenState extends State<EducationScreen> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const Text("$honorsText : "), const Text("$honorsText : ",style: TextStyle(fontWeight: FontWeight.w600),),
Column( Column(
children: children:
honors honors
.map((Honor honor) => .map((Honor honor) =>
Text(" ${honor.name!}")) Text(" - ${honor.name!}"))
.toList(), .toList(),
), ),
], ],
@ -123,7 +121,7 @@ class _EducationScreenState extends State<EducationScreen> {
), ),
], ],
); );
}), }):const EmptyData(message: "You don't have any Educational Background added. Please click + to add."),
); );
} }
} }

View File

@ -6,16 +6,13 @@ import 'package:unit2/theme-data.dart/box_shadow.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global.dart'; import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/text_container.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 { class EligibiltyScreen extends StatelessWidget {
final List<EligibityCert> eligibilities; final List<EligibityCert> eligibilities;
const EligibiltyScreen({super.key, required this.eligibilities}); const EligibiltyScreen({super.key, required this.eligibilities});
@override
State<EligibiltyScreen> createState() => _EligibiltyScreenState();
}
class _EligibiltyScreenState extends State<EligibiltyScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -23,12 +20,13 @@ class _EligibiltyScreenState extends State<EligibiltyScreen> {
title: const Text(elibilityScreenTitle), title: const Text(elibilityScreenTitle),
centerTitle: true, centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
actions: [AddLeading(onPressed: (){})],
), ),
body: ListView.builder( body: eligibilities.isNotEmpty? ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
itemCount: widget.eligibilities.length, itemCount: eligibilities.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
String title = widget.eligibilities[index].eligibility!.title!; String title = eligibilities[index].eligibility!.title!;
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -51,20 +49,21 @@ class _EligibiltyScreenState extends State<EligibiltyScreen> {
const Divider(), const Divider(),
const SizedBox(height: 5,), const SizedBox(height: 5,),
Text( Text(
"$licenseNumber: ${widget.eligibilities[index].licenseNumber == null ? 'N/A' : widget.eligibilities[index].licenseNumber.toString()}",style: Theme.of(context).textTheme.titleSmall), "$licenseNumber: ${eligibilities[index].licenseNumber == null ? 'N/A' : eligibilities[index].licenseNumber.toString()}",style: Theme.of(context).textTheme.titleSmall),
const SizedBox(height: 3,), const SizedBox(height: 3,),
Text( Text(
"$rating : ${widget.eligibilities[index].rating}.",style: Theme.of(context).textTheme.titleSmall) "$rating : ${eligibilities[index].rating}.",style: Theme.of(context).textTheme.titleSmall)
]), ]),
), ),
IconButton( IconButton(
onPressed: () {}, icon: const Icon(Icons.more_vert,color: Colors.grey,)) onPressed: () {}, icon: const Icon(Icons.more_vert,color: Colors.grey,))
], ],
), ),
) ),
const SizedBox(height: 5,)
], ],
); );
}), }):const EmptyData(message: "You don't have any Eligibility added. Please click + to add."),
); );
} }
} }

View File

@ -71,7 +71,11 @@ class _FamilyBackgroundScreenState extends State<FamilyBackgroundScreen> {
Text(" $fullname",style: Theme.of(context).textTheme.bodySmall,), Text(" $fullname",style: Theme.of(context).textTheme.bodySmall,),
Row( Row(
children: [ children: [
Checkbox(value: false, onChanged: (value) {}), Checkbox(value: false, onChanged: (value) {
setState(() {
value = !value!;
});
}),
const Text(incaseOfEmergency) const Text(incaseOfEmergency)
], ],
) )

View File

@ -7,34 +7,33 @@ import 'package:unit2/theme-data.dart/box_shadow.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global.dart'; import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
class LearningAndDevelopmentScreen extends StatefulWidget { class LearningAndDevelopmentScreen extends StatelessWidget {
final List<LearningDevelopement> learningDevelopments; final List<LearningDevelopement> learningDevelopments;
const LearningAndDevelopmentScreen({super.key, required this.learningDevelopments}); const LearningAndDevelopmentScreen({super.key, required this.learningDevelopments});
@override
State<LearningAndDevelopmentScreen> createState() => _LearningAndDevelopmentScreenState();
}
class _LearningAndDevelopmentScreenState extends State<LearningAndDevelopmentScreen> {
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text(learningAndDevelopmentScreenTitle), appBar: AppBar(title: const Text(learningAndDevelopmentScreenTitle),
centerTitle: true, centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
actions: [AddLeading(onPressed: (){})],
), ),
body: ListView.builder( body: learningDevelopments.isNotEmpty? ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10),
itemCount: widget.learningDevelopments.length, itemCount: learningDevelopments.length,
itemBuilder: (BuildContext context, int index){ itemBuilder: (BuildContext context, int index){
String training = widget.learningDevelopments[index].conductedTraining!.title!.title!; String training = learningDevelopments[index].conductedTraining!.title!.title!;
String provider = widget.learningDevelopments[index].conductedTraining!.conductedBy!.name!; String provider = learningDevelopments[index].conductedTraining!.conductedBy!.name!;
String start = dteFormat2.format(widget.learningDevelopments[index].conductedTraining!.fromDate!); String start = dteFormat2.format(learningDevelopments[index].conductedTraining!.fromDate!);
String end = dteFormat2.format(widget.learningDevelopments[index].conductedTraining!.toDate!); String end = dteFormat2.format(learningDevelopments[index].conductedTraining!.toDate!);
String type = widget.learningDevelopments[index].conductedTraining!.learningDevelopmentType!.title!; String type = learningDevelopments[index].conductedTraining!.learningDevelopmentType!.title!;
return Column( return Column(
children: [ children: [
Container( Container(
@ -65,7 +64,7 @@ class _LearningAndDevelopmentScreenState extends State<LearningAndDevelopmentScr
const SizedBox(height: 8,), const SizedBox(height: 8,),
], ],
); );
}), }):const EmptyData(message: "You don't have any Learning and Development added. Please click + to add."),
); );
} }
} }

View File

@ -6,26 +6,23 @@ import 'package:unit2/theme-data.dart/box_shadow.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global.dart'; import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
class NonAcademicRecognitionScreen extends StatefulWidget { class NonAcademicRecognitionScreen extends StatelessWidget {
final List<NonAcademicRecognition> nonAcademicRecognitions; final List<NonAcademicRecognition> nonAcademicRecognitions;
const NonAcademicRecognitionScreen({super.key, required this.nonAcademicRecognitions}); const NonAcademicRecognitionScreen({super.key, required this.nonAcademicRecognitions});
@override
State<NonAcademicRecognitionScreen> createState() => _NonAcademicRecognitionScreenState();
}
class _NonAcademicRecognitionScreenState extends State<NonAcademicRecognitionScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text(nonAcademicRecTitle), centerTitle: true, backgroundColor: primary,), appBar: AppBar(title: const Text(nonAcademicRecTitle), centerTitle: true, backgroundColor: primary,actions: [AddLeading(onPressed: (){})],),
body: ListView.builder( body: nonAcademicRecognitions.isNotEmpty?ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10),
itemCount: widget.nonAcademicRecognitions.length, itemCount: nonAcademicRecognitions.length,
itemBuilder: (BuildContext context, int index){ itemBuilder: (BuildContext context, int index){
String award = widget.nonAcademicRecognitions[index].title!; String award = nonAcademicRecognitions[index].title!;
String presenter = widget.nonAcademicRecognitions[index].presenter!.name!; String presenter = nonAcademicRecognitions[index].presenter!.name!;
return Column( return Column(
children: [ children: [
Container( Container(
@ -50,7 +47,7 @@ class _NonAcademicRecognitionScreenState extends State<NonAcademicRecognitionScr
const SizedBox(height: 5,), const SizedBox(height: 5,),
], ],
); );
}), }): const EmptyData(message: "You don't have any Non Academic Recognition added. Please click + to add"),
); );
} }
} }

View File

@ -1,22 +1,17 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:unit2/model/profile/other_information/organization_memberships.dart'; import 'package:unit2/model/profile/other_information/organization_memberships.dart';
import 'package:unit2/theme-data.dart/box_shadow.dart'; import 'package:unit2/theme-data.dart/box_shadow.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
import '../../../../utils/global.dart'; import '../../../../utils/global.dart';
class OrgMembershipsScreen extends StatefulWidget { class OrgMembershipsScreen extends StatelessWidget {
final List<OrganizationMembership> orgMemberships; final List<OrganizationMembership> orgMemberships;
const OrgMembershipsScreen({super.key, required this.orgMemberships}); const OrgMembershipsScreen({super.key, required this.orgMemberships});
@override
State<OrgMembershipsScreen> createState() => _OrgMembershipsScreenState();
}
class _OrgMembershipsScreenState extends State<OrgMembershipsScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -24,16 +19,17 @@ class _OrgMembershipsScreenState extends State<OrgMembershipsScreen> {
title: const Text(orgMembershipTitle), title: const Text(orgMembershipTitle),
backgroundColor: primary, backgroundColor: primary,
centerTitle: true, centerTitle: true,
actions: [AddLeading(onPressed: (){})],
), ),
body: ListView.builder( body: orgMemberships.isNotEmpty? ListView.builder(
itemCount: widget.orgMemberships.length, itemCount: orgMemberships.length,
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10),
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
String entity = String entity =
widget.orgMemberships[index].agency!.privateEntity == false orgMemberships[index].agency!.privateEntity == false
? governmentText.toUpperCase() ? governmentText.toUpperCase()
: privateText.toUpperCase(); : privateText.toUpperCase();
String agencyName = widget.orgMemberships[index].agency!.name!; String agencyName = orgMemberships[index].agency!.name!;
return Column( return Column(
children: [ children: [
Container( Container(
@ -60,7 +56,7 @@ class _OrgMembershipsScreenState extends State<OrgMembershipsScreen> {
const SizedBox(height: 5,), const SizedBox(height: 5,),
], ],
); );
}), }):const EmptyData(message: "You don't have any Organization Membership added. Please click + to add."),
); );
} }
} }

View File

@ -5,26 +5,24 @@ import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global.dart'; import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
class SkillHobbiesScreen extends StatefulWidget { class SkillHobbiesScreen extends StatelessWidget {
final List<SkillsHobbies>skillsHobbies; final List<SkillsHobbies>skillsHobbies;
const SkillHobbiesScreen({super.key,required this.skillsHobbies}); const SkillHobbiesScreen({super.key,required this.skillsHobbies});
@override
State<SkillHobbiesScreen> createState() => _SkillHobbiesScreenState();
}
class _SkillHobbiesScreenState extends State<SkillHobbiesScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text(skillAndHobbiesTitle), appBar: AppBar(title: const Text(skillAndHobbiesTitle),
backgroundColor: primary, backgroundColor: primary,
centerTitle: true, centerTitle: true,
actions: [AddLeading(onPressed: (){})],
), ),
body: Padding( body: skillsHobbies.isNotEmpty? Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(24),
child: Wrap( child: Wrap(
spacing: 8, spacing: 8,
runSpacing: 8, runSpacing: 8,
@ -33,7 +31,7 @@ class _SkillHobbiesScreenState extends State<SkillHobbiesScreen> {
verticalDirection: VerticalDirection.up, verticalDirection: VerticalDirection.up,
crossAxisAlignment: WrapCrossAlignment.start, crossAxisAlignment: WrapCrossAlignment.start,
direction: Axis.horizontal, direction: Axis.horizontal,
children:widget.skillsHobbies.map((SkillsHobbies sh){ children:skillsHobbies.map((SkillsHobbies sh){
return FittedBox( return FittedBox(
child: Row( child: Row(
children: [ children: [
@ -47,7 +45,7 @@ class _SkillHobbiesScreenState extends State<SkillHobbiesScreen> {
}).toList() }).toList()
), ),
), ):const EmptyData(message: "You don't have any Skills and Hobbies added. Please click + to add"),
); );
} }
} }

View File

@ -5,31 +5,36 @@ import 'package:unit2/model/profile/references.dart';
import 'package:unit2/theme-data.dart/box_shadow.dart'; import 'package:unit2/theme-data.dart/box_shadow.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
class ReferencesScreen extends StatefulWidget { class ReferencesScreen extends StatelessWidget {
final List<PersonalReference> references; final List<PersonalReference> references;
const ReferencesScreen({super.key, required this.references}); const ReferencesScreen({super.key, required this.references});
@override
State<ReferencesScreen> createState() => _ReferencesScreenState();
}
class _ReferencesScreenState extends State<ReferencesScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text(referencesScreenTitle),centerTitle: true,backgroundColor: primary,), appBar: AppBar(
body: ListView.builder( title: const Text(referencesScreenTitle),
centerTitle: true,
backgroundColor: primary,
actions: [AddLeading(onPressed: (){})],
),
body: references.isNotEmpty? ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
itemCount: widget.references.length, itemCount: references.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
String fullname = "${widget.references[index].firstName} ${widget.references[index].middleName} ${widget.references[index].lastName}"; String fullname =
String addres = "${widget.references[index].address!.cityMunicipality!.description}, ${widget.references[index].address!.cityMunicipality!.province!.description}, ${widget.references[0].address!.cityMunicipality!.province!.region!.description}"; "${references[index].firstName} ${references[index].middleName} ${references[index].lastName}";
String mobile = widget.references[index].contactNo.toString(); String addres =
return Column(children: [ "${references[index].address!.cityMunicipality!.description}, ${references[index].address!.cityMunicipality!.province!.description}, ${references[0].address!.cityMunicipality!.province!.region!.description}";
String mobile = references[index].contactNo.toString();
return Column(
children: [
Container( Container(
padding: const EdgeInsets.symmetric(horizontal: 12,vertical: 8), padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: box1(), decoration: box1(),
child: Row( child: Row(
children: [ children: [
@ -38,22 +43,44 @@ class _ReferencesScreenState extends State<ReferencesScreen> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(fullname,
Text(fullname,style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500)), style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(fontWeight: FontWeight.w500)),
const Divider(), const Divider(),
const SizedBox(height: 5,), const SizedBox(
Text(addres,style: Theme.of(context).textTheme.titleSmall!.copyWith(fontWeight: FontWeight.w500)), height: 5,
const SizedBox(height: 8,),
Text("${mobileOrPhone.toUpperCase()} : $mobile",style: Theme.of(context).textTheme.labelMedium!),
],),
), ),
IconButton(onPressed: (){}, icon: const Icon(Icons.more_vert,color: Colors.grey,)) Text(addres,
style: Theme.of(context)
.textTheme
.titleSmall!
.copyWith(fontWeight: FontWeight.w500)),
const SizedBox(
height: 8,
),
Text("${mobileOrPhone.toUpperCase()} : $mobile",
style:
Theme.of(context).textTheme.labelMedium!),
], ],
), ),
), ),
const SizedBox(height: 5,), IconButton(
],); onPressed: () {},
}) , icon: const Icon(
Icons.more_vert,
color: Colors.grey,
))
],
),
),
const SizedBox(
height: 5,
),
],
);
}):const EmptyData(message: "You don't have any References added. Please click + to add."),
); );
} }
} }

View File

@ -4,35 +4,39 @@ import 'package:unit2/model/profile/voluntary_works.dart';
import 'package:unit2/theme-data.dart/box_shadow.dart'; import 'package:unit2/theme-data.dart/box_shadow.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
class VolunataryWorkScreen extends StatefulWidget { class VolunataryWorkScreen extends StatelessWidget {
final List<VoluntaryWork> voluntaryWorks; final List<VoluntaryWork> voluntaryWorks;
const VolunataryWorkScreen({super.key, required this.voluntaryWorks}); const VolunataryWorkScreen({super.key, required this.voluntaryWorks});
@override
State<VolunataryWorkScreen> createState() => _VolunataryWorkScreenState();
}
class _VolunataryWorkScreenState extends State<VolunataryWorkScreen> {
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text(voluntaryScreenTitle),backgroundColor: primary,), appBar: AppBar(
body: ListView.builder( title: const Text(voluntaryScreenTitle),
itemCount:widget.voluntaryWorks.length , backgroundColor: primary,
actions: [AddLeading(onPressed: (){})],
),
body: voluntaryWorks.isNotEmpty? ListView.builder(
itemCount: voluntaryWorks.length,
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
String position = widget.voluntaryWorks[index].position!.title!; String position = voluntaryWorks[index].position!.title!;
String agency = widget.voluntaryWorks[index].agency!.name!; String agency = voluntaryWorks[index].agency!.name!;
String from = dteFormat2.format(widget.voluntaryWorks[index].fromDate!); String from = dteFormat2.format(voluntaryWorks[index].fromDate!);
String hours = widget.voluntaryWorks[index].totalHours.toString(); String hours = voluntaryWorks[index].totalHours.toString();
String? to = widget.voluntaryWorks[index].toDate == null? "Present" : dteFormat2.format(widget.voluntaryWorks[index].toDate!); String? to = voluntaryWorks[index].toDate == null
? "Present"
: dteFormat2.format(voluntaryWorks[index].toDate!);
return Column( return Column(
children: [ children: [
Container( Container(
decoration: box1(), decoration: box1(),
padding: const EdgeInsets.symmetric(horizontal: 12,vertical: 8), padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
@ -40,28 +44,42 @@ class _VolunataryWorkScreenState extends State<VolunataryWorkScreen> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(position,style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500),), Text(
const SizedBox(height: 5,), position,
Text(agency,style: Theme.of(context).textTheme.titleSmall,), style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(fontWeight: FontWeight.w500),
),
const SizedBox(
height: 5,
),
Text(
agency,
style: Theme.of(context).textTheme.titleSmall,
),
const Divider(), const Divider(),
const SizedBox(height: 3,), const SizedBox(
height: 3,
),
Text("$duration : $from to $to"), Text("$duration : $from to $to"),
const SizedBox(height: 5,), const SizedBox(
height: 5,
),
Text("$numberOfHours : $hours hours"), Text("$numberOfHours : $hours hours"),
]), ]),
), ),
IconButton(onPressed: (){}, icon: const Icon(Icons.more_vert)) IconButton(
onPressed: () {}, icon: const Icon(Icons.more_vert))
], ],
), ),
), ),
const SizedBox(height: 5,), const SizedBox(
height: 5,
),
], ],
); );
}):const EmptyData(message: "You don't have any Voluntary Works added. Please click + to add."),
}),
); );
} }
} }

View File

@ -4,38 +4,38 @@ import 'package:unit2/model/profile/work_history.dart';
import 'package:unit2/theme-data.dart/box_shadow.dart'; import 'package:unit2/theme-data.dart/box_shadow.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
import '../../../utils/global.dart'; import '../../../utils/global.dart';
class WorkHistoryScreen extends StatefulWidget { class WorkHistoryScreen extends StatelessWidget {
final List<WorkHistory> workExperiences; final List<WorkHistory> workExperiences;
const WorkHistoryScreen({super.key, required this.workExperiences}); const WorkHistoryScreen({super.key, required this.workExperiences});
@override
State<WorkHistoryScreen> createState() => _WorkHistoryScreenState();
}
class _WorkHistoryScreenState extends State<WorkHistoryScreen> {
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text(workHistoryScreenTitle), title: const Text(workHistoryScreenTitle),
backgroundColor: primary, backgroundColor: primary,
centerTitle: true, centerTitle: true,
actions: [AddLeading(onPressed: (){})],
), ),
body: ListView.builder( body: workExperiences.isNotEmpty? ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
itemCount: widget.workExperiences.length, itemCount: workExperiences.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
String position = widget.workExperiences[index].position!.title!; String position = workExperiences[index].position!.title!;
String agency = widget.workExperiences[index].agency!.name!; String agency = workExperiences[index].agency!.name!;
String from = String from =
dteFormat2.format(widget.workExperiences[index].fromDate!); dteFormat2.format(workExperiences[index].fromDate!);
String? to = widget.workExperiences[index].toDate == null String? to = workExperiences[index].toDate == null
? present.toUpperCase() ? present.toUpperCase()
: dteFormat2.format(widget.workExperiences[index].toDate!); : dteFormat2.format(workExperiences[index].toDate!);
return Column( return Column(
children: [ children: [
@ -65,7 +65,7 @@ class _WorkHistoryScreenState extends State<WorkHistoryScreen> {
), ),
], ],
); );
}), }):const EmptyData(message: "You don't have any Work History added. Please click + to add ."),
); );
} }
} }

View File

@ -8,6 +8,7 @@ import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:unit2/screens/unit2/login/components/update_required.dart'; import 'package:unit2/screens/unit2/login/components/update_required.dart';
import 'package:unit2/utils/alerts.dart'; import 'package:unit2/utils/alerts.dart';
import 'package:unit2/utils/internet_time_out.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import '../../../bloc/user/user_bloc.dart'; import '../../../bloc/user/user_bloc.dart';
@ -319,14 +320,13 @@ class _UniT2LoginState extends State<UniT2Login> {
}); });
} }
if (state is UserError) { if (state is UserError) {
return ErrorState( return SomethingWentWrong(
message: state.message, message:onError ,
onpressed:(){} ,
); );
} }
if (state is InternetTimeout) { if (state is InternetTimeout) {
return ErrorState( return const TimeOutError();
message: state.message,
);
} }
if (state is SplashScreen) { if (state is SplashScreen) {
return const UniTSplashScreen(); return const UniTSplashScreen();

View File

@ -1,14 +1,11 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:fluttericon/font_awesome5_icons.dart'; import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:unit2/theme-data.dart/btn-style.dart'; import 'package:unit2/theme-data.dart/btn-style.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:unit2/widgets/wave.dart'; import 'package:unit2/widgets/wave.dart';
import '../../../bloc/user/user_bloc.dart'; import '../../../bloc/user/user_bloc.dart';
import '../../../theme-data.dart/colors.dart'; import '../../../theme-data.dart/colors.dart';
@ -186,8 +183,6 @@ class _QRLoginState extends State<QRLogin> {
], ],
), ),
); );
}if(state is UserError){
return ErrorState(message: state.message,);
} }
return Container(); return Container();
}, },

View File

@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:unit2/theme-data.dart/btn-style.dart';
import '../theme-data.dart/colors.dart';
class TimeOutError extends StatelessWidget {
const TimeOutError({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SvgPicture.asset(
'assets/svgs/timeout.svg',
height: 200.0,
width: 200.0,
allowDrawingOutsideViewBox: true,
),
const SizedBox(
height: 25,
),
const Text(
'Connection Timeout! Pls check your internet connectivity.',
textAlign: TextAlign.center,),
const SizedBox(
height: 25,
),
SizedBox(
height: 50,
child: ElevatedButton.icon(
style: mainBtnStyle(
primary, Colors.transparent, primary.withOpacity(.5)),
onPressed:(){
},
icon: const Icon(
Icons.refresh,
color: Colors.white,
),
label: const Text(
"try again",
style: TextStyle(color: Colors.white),
)),
)
],
),
);
}
}

View File

@ -0,0 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
class AddLeading extends StatelessWidget {
final Function() onPressed;
const AddLeading({super.key, required this.onPressed});
@override
Widget build(BuildContext context) {
return IconButton(onPressed: onPressed, icon: const Icon(Icons.add));
}
}

View File

@ -0,0 +1,39 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:unit2/utils/global.dart';
class EmptyData extends StatelessWidget {
final String message;
const EmptyData({Key? key, required this.message,})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SvgPicture.asset(
'assets/svgs/empty.svg',
height: 200.0,
width: 200.0,
allowDrawingOutsideViewBox: true,
),
const SizedBox(
height: 20,
),
Text(
message,style: Theme.of(context).textTheme.displaySmall!.copyWith(fontSize: blockSizeVertical * 2),
textAlign: TextAlign.center,
),
],
),
),
);
}
}

View File

@ -1,13 +1,58 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/container.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter/src/widgets/framework.dart'; import 'package:unit2/theme-data.dart/btn-style.dart';
class ErrorState extends StatelessWidget { import '../theme-data.dart/colors.dart';
class SomethingWentWrong extends StatelessWidget {
final String? message; final String? message;
const ErrorState({super.key,this.message}); final Function()? onpressed;
const SomethingWentWrong({Key? key, required this.message, required this.onpressed})
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center(child: Text(message!)); return Container(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SvgPicture.asset(
'assets/svgs/error.svg',
height: 200.0,
width: 200.0,
allowDrawingOutsideViewBox: true,
),
const SizedBox(
height: 10,
),
Text(
message??'',
textAlign: TextAlign.center,
),
const SizedBox(
height: 20,
),
SizedBox(
height: 50,
child: ElevatedButton.icon(
style: mainBtnStyle(
primary, Colors.transparent, primary.withOpacity(.5)),
onPressed: onpressed,
icon: const Icon(
Icons.refresh,
color: Colors.white,
),
label: const Text(
"try again",
style: TextStyle(color: Colors.white),
)),
)
],
),
),
);
} }
} }