passo_mobile_app/lib/screens/profile/profile.dart

266 lines
14 KiB
Dart
Raw Normal View History

2023-01-26 02:15:00 +00:00
import 'package:expandable_group/expandable_group_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
2023-01-26 02:15:00 +00:00
import 'package:fluttericon/brandico_icons.dart';
import 'package:fluttericon/elusive_icons.dart';
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';
2023-02-08 03:07:30 +00:00
import 'package:unit2/screens/profile/components/basic_information/address_screen.dart';
import 'package:unit2/screens/profile/components/basic_information/citizenship_screen.dart';
2023-02-09 08:48:19 +00:00
import 'package:unit2/screens/profile/components/basic_information/contact_information_screen.dart';
import 'package:unit2/screens/profile/components/basic_information/identification_information_screen.dart';
import 'package:unit2/screens/profile/components/basic_information/primary_information_screen.dart';
2023-02-07 01:29:38 +00:00
import 'package:unit2/screens/profile/components/education_screen.dart';
2023-02-09 08:48:19 +00:00
import 'package:unit2/screens/profile/components/eligibility_screen.dart';
2023-02-08 08:06:27 +00:00
import 'package:unit2/screens/profile/components/family_background_screen.dart';
import 'package:unit2/screens/profile/components/learning_and_development_screen.dart';
import 'package:unit2/screens/profile/components/loading_screen.dart';
2023-02-09 08:48:19 +00:00
import 'package:unit2/screens/profile/components/other_information/non_academic_recognition_screen.dart';
import 'package:unit2/screens/profile/components/other_information/org_membership_screen.dart';
2023-02-07 06:17:49 +00:00
import 'package:unit2/screens/profile/components/other_information/skills_and_hobbies_screen.dart';
import 'package:unit2/screens/profile/components/references_screen.dart';
2023-02-07 01:29:38 +00:00
import 'package:unit2/screens/profile/components/work_history_screen.dart';
2023-02-09 08:48:19 +00:00
import 'package:unit2/screens/profile/components/voluntary_works_screen.dart';
2023-01-26 02:15:00 +00:00
import 'package:unit2/theme-data.dart/colors.dart';
import '../../bloc/user/user_bloc.dart';
2023-01-26 02:15:00 +00:00
import 'components/main_menu.dart';
import 'components/submenu.dart';
class ProfileInfo extends StatefulWidget {
const ProfileInfo({super.key});
@override
State<ProfileInfo> createState() => _ProfileInfoState();
}
class _ProfileInfoState extends State<ProfileInfo> {
@override
Widget build(BuildContext context) {
2023-02-09 08:48:19 +00:00
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
centerTitle: true,
title: const Text('Profile'),
),
body: ProgressHUD(
child:
BlocBuilder<UserBloc, UserState>(builder: (context, state) {
if (state is UserLoggedIn) {
return BlocConsumer<ProfileBloc, ProfileState>(
listener: (context, state) {
if (state is ProfileLoading) {
final progress = ProgressHUD.of(context);
progress?.showWithText(
'Loading Profile',
);
}
if (state is ProfileLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is ProfileLoaded) {
2023-02-09 08:48:19 +00:00
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,),
ExpandableGroup(
collapsedIcon:
const Icon(Icons.keyboard_arrow_down),
expandedIcon:
const Icon(Icons.keyboard_arrow_up),
header: const ListTile(
leading: Icon(
Elusive.address_book,
color: primary,
),
title: Text(
"Basic Information",
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.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);
}));
2023-02-08 03:07:30 +00:00
}),
2023-02-09 08:48:19 +00:00
subMenu(
Icons.contact_phone, "Contact Info",(){
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
2023-02-09 08:48:19 +00:00
return ContactInformationScreen(contacts: state.profileInformation.basicInfo.contactInformation,);
}));
}),
2023-02-09 08:48:19 +00:00
subMenu(Icons.flag, "Citizenships",(){
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
2023-02-09 08:48:19 +00:00
return CitizenShipScreen(citizenships: state.profileInformation.basicInfo.citizenships,);
}));
2023-02-09 08:48:19 +00:00
}),
]),
const Divider(),
MainMenu(
icon: Elusive.group,
title: "Family",
onTap: (){
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return FamilyBackgroundScreen(familyBackground: state.profileInformation.families);
}));
},
),
const Divider(),
MainMenu(
icon: FontAwesome5.graduation_cap,
title: "Education",
onTap: (){
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return EducationScreen(educationBackgrounds: state.profileInformation.educationalBackgrounds);
}));
},
),
const Divider(),
MainMenu(
icon: Icons.stars,
title: "Eligibility",
onTap: (){
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return EligibiltyScreen(eligibilities: state.profileInformation.eligibilities);
}));
},
),
const Divider(),
MainMenu(
icon: FontAwesome5.shopping_bag,
title: "Work History",
onTap: (){
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return WorkHistoryScreen(workExperiences: state.profileInformation.workExperiences);
}));
},
),
const Divider(),
MainMenu(
icon: FontAwesome5.walking,
title: "Voluntary Work & Civic Services",
onTap: (){
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return VolunataryWorkScreen(voluntaryWorks: state.profileInformation.voluntaryWorks);
}));
},
),
const Divider(),
MainMenu(
icon: Elusive.lightbulb,
title: "Learning & Development",
onTap: (){
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return LearningAndDevelopmentScreen(learningDevelopments: state.profileInformation.learningsAndDevelopment);
}));
},
),
const Divider(),
MainMenu(
icon: Brandico.codepen,
title: "Personal 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),
header: const ListTile(
leading: Icon(
Icons.info,
color: primary,
),
title: Text(
"Other Information",
style: TextStyle(
fontWeight: FontWeight.bold),
),
),
2023-02-09 08:48:19 +00:00
items: [
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);
}));
}),
subMenu(Entypo.doc_text,
"Non-Academic Recognitions",(){
2023-02-08 03:07:30 +00:00
2023-02-09 08:48:19 +00:00
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),
header: const ListTile(
leading: Icon(
FontAwesome5.laptop_house,
color: primary,
),
title: Text(
"Assets",
style: TextStyle(
fontWeight: FontWeight.bold),
),
),
items: [
subMenu(ModernPictograms.home,
"Real Property Tax",(){}),
]),
],
),
);
}
if (state is ProfileLoading) {
return const LoadingScreen();
}
2023-02-09 08:48:19 +00:00
return Container();
},
);
}
return Container();
}),
));
2023-01-26 02:15:00 +00:00
}
}