diff --git a/lib/model/profile/other_info.dart b/lib/model/profile/other_info.dart new file mode 100644 index 0000000..fe43df3 --- /dev/null +++ b/lib/model/profile/other_info.dart @@ -0,0 +1,8 @@ +import 'package:unit2/model/profile/other_information/organization_memberships.dart'; +import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart'; + +class OtherInformation{ + List skillsAndHobbies; + ListorgMemberships; + OtherInformation({required this.skillsAndHobbies, required this.orgMemberships}); +} \ No newline at end of file diff --git a/lib/model/profile/other_information/organization_memberships.dart b/lib/model/profile/other_information/organization_memberships.dart new file mode 100644 index 0000000..7776380 --- /dev/null +++ b/lib/model/profile/other_information/organization_memberships.dart @@ -0,0 +1,101 @@ +// To parse this JSON data, do +// +// final organizationMembership = organizationMembershipFromJson(jsonString); + +import 'dart:convert'; + +OrganizationMembership organizationMembershipFromJson(String str) => OrganizationMembership.fromJson(json.decode(str)); + +String organizationMembershipToJson(OrganizationMembership data) => json.encode(data.toJson()); + +class OrganizationMembership { + OrganizationMembership({ + this.agency, + }); + + final Agency? agency; + + factory OrganizationMembership.fromJson(Map json) => OrganizationMembership( + agency: json["agency"] == null ? null : Agency.fromJson(json["agency"]), + ); + + Map toJson() => { + "agency": agency?.toJson(), + }; +} + +class Agency { + Agency({ + this.id, + this.name, + this.category, + this.privateEntity, + }); + + final int? id; + final String? name; + final Category? category; + final bool? privateEntity; + + factory Agency.fromJson(Map json) => Agency( + id: json["id"], + name: json["name"], + category: json["category"] == null ? null : Category.fromJson(json["category"]), + privateEntity: json["private_entity"], + ); + + Map toJson() => { + "id": id, + "name": name, + "category": category?.toJson(), + "private_entity": privateEntity, + }; +} + +class Category { + Category({ + this.id, + this.name, + this.industryClass, + }); + + final int? id; + final String? name; + final IndustryClass? industryClass; + + factory Category.fromJson(Map json) => Category( + id: json["id"], + name: json["name"], + industryClass: json["industry_class"] == null ? null : IndustryClass.fromJson(json["industry_class"]), + ); + + Map toJson() => { + "id": id, + "name": name, + "industry_class": industryClass?.toJson(), + }; +} + +class IndustryClass { + IndustryClass({ + this.id, + this.name, + this.description, + }); + + final int? id; + final String? name; + final dynamic description; + + factory IndustryClass.fromJson(Map json) => IndustryClass( + id: json["id"], + name: json["name"], + description: json["description"], + ); + + Map toJson() => { + "id": id, + "name": name, + "description": description, + }; +} diff --git a/lib/model/profile/other_information/skills_and_hobbies.dart b/lib/model/profile/other_information/skills_and_hobbies.dart new file mode 100644 index 0000000..4d7cff3 --- /dev/null +++ b/lib/model/profile/other_information/skills_and_hobbies.dart @@ -0,0 +1,29 @@ +// To parse this JSON data, do +// +// final skillsHobbies = skillsHobbiesFromJson(jsonString); + +import 'dart:convert'; + +SkillsHobbies skillsHobbiesFromJson(String str) => SkillsHobbies.fromJson(json.decode(str)); + +String skillsHobbiesToJson(SkillsHobbies data) => json.encode(data.toJson()); + +class SkillsHobbies { + SkillsHobbies({ + this.id, + this.name, + }); + + final int? id; + final String? name; + + factory SkillsHobbies.fromJson(Map json) => SkillsHobbies( + id: json["id"], + name: json["name"], + ); + + Map toJson() => { + "id": id, + "name": name, + }; +} diff --git a/lib/model/profile/profileInfomation.dart b/lib/model/profile/profileInfomation.dart index 61e0155..63bd116 100644 --- a/lib/model/profile/profileInfomation.dart +++ b/lib/model/profile/profileInfomation.dart @@ -3,17 +3,19 @@ import 'package:unit2/model/profile/basic_information/primary-information.dart'; import 'package:unit2/model/profile/educational_background.dart'; import 'package:unit2/model/profile/eligibility.dart'; import 'package:unit2/model/profile/learning_development.dart'; +import 'package:unit2/model/profile/other_info.dart'; import 'package:unit2/model/profile/references.dart'; import 'package:unit2/model/profile/voluntary_works.dart'; import 'package:unit2/model/profile/work_history.dart'; class ProfileInformation{ BasicInfo basicInfo; + OtherInformation otherInformation; List eligibilities; List references; List learningsAndDevelopment; List educationalBackgrounds; ListworkExperiences; List voluntaryWorks; - ProfileInformation({required this.voluntaryWorks, required this.workExperiences, required this.basicInfo,required this.eligibilities,required this.references, required this.learningsAndDevelopment,required this.educationalBackgrounds}); + ProfileInformation({required this.otherInformation, required this.voluntaryWorks, required this.workExperiences, required this.basicInfo,required this.eligibilities,required this.references, required this.learningsAndDevelopment,required this.educationalBackgrounds}); } \ No newline at end of file diff --git a/lib/screens/profile/components/loading_screen.dart b/lib/screens/profile/components/loading_screen.dart index eda754a..d9b11f3 100644 --- a/lib/screens/profile/components/loading_screen.dart +++ b/lib/screens/profile/components/loading_screen.dart @@ -7,6 +7,7 @@ import 'package:fluttericon/font_awesome5_icons.dart'; import 'package:fluttericon/modern_pictograms_icons.dart'; import 'package:unit2/screens/profile/components/main_menu.dart'; import 'package:unit2/screens/profile/components/submenu.dart'; +import 'package:unit2/utils/global.dart'; import '../../../theme-data.dart/colors.dart'; @@ -15,139 +16,149 @@ class LoadingScreen extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( - padding: const EdgeInsets.symmetric( - vertical: 12, horizontal: 12), - child: ListView( - children: [ - const Text( - "View and Update your Profile Information"), - 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), - ), + return Stack( + children: [ + + Container( + padding: const EdgeInsets.symmetric( + vertical: 12, horizontal: 12), + child: ListView( + children: [ + const Text( + "View and Update your Profile Information"), + 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",(){}), + subMenu(Icons.home, "Home Addresses",(){}), + subMenu( + Icons.contact_mail, "Identifications",(){}), + subMenu(Icons.contact_phone, "Contact Info",(){}), + subMenu(Icons.flag, "Citizenships",(){}), + ]), + const Divider(), + MainMenu( + icon: Elusive.group, + title: "Family", + onTap: () { + + }, ), - items: [ - subMenu(Icons.person, "Primary",(){}), - subMenu(Icons.home, "Home Addresses",(){}), - subMenu( - Icons.contact_mail, "Identifications",(){}), - subMenu(Icons.contact_phone, "Contact Info",(){}), - subMenu(Icons.flag, "Citizenships",(){}), - ]), - const Divider(), - MainMenu( - icon: Elusive.group, - title: "Family", - onTap: () { - - }, - ), - const Divider(), - MainMenu( - icon: FontAwesome5.graduation_cap, - title: "Education", - onTap: () { - - }, - ), - const Divider(), - MainMenu( - icon: Icons.stars, - title: "Eligibility", - onTap: () { - - }, - ), - const Divider(), - MainMenu( - icon: FontAwesome5.shopping_bag, - title: "Work History", - onTap: () { - - }, - ), - const Divider(), - MainMenu( - icon: FontAwesome5.walking, - title: "Voluntary Work & Civic Services", - onTap: () { - - }, - ), - const Divider(), - MainMenu( - icon: Elusive.lightbulb, - title: "Learning & Development", - onTap: () { - - }, - ), - const Divider(), - MainMenu( - icon: Brandico.codepen, - title: "Personal References", - onTap: () { - - }, - ), - 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), - ), + const Divider(), + MainMenu( + icon: FontAwesome5.graduation_cap, + title: "Education", + onTap: () { + + }, ), - items: [ - subMenu( - Icons.fitness_center, "Skills & Hobbies",(){}), - subMenu(FontAwesome5.certificate, - "Organization Memberships",(){}), - subMenu(Entypo.doc_text, - "Non-Academic Recognitions",(){}), - ]), - 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), - ), + const Divider(), + MainMenu( + icon: Icons.stars, + title: "Eligibility", + onTap: () { + + }, ), - items: [ - subMenu(ModernPictograms.home, - "Real Property Tax",(){}), - ]), - ], - ), - ); + const Divider(), + MainMenu( + icon: FontAwesome5.shopping_bag, + title: "Work History", + onTap: () { + + }, + ), + const Divider(), + MainMenu( + icon: FontAwesome5.walking, + title: "Voluntary Work & Civic Services", + onTap: () { + + }, + ), + const Divider(), + MainMenu( + icon: Elusive.lightbulb, + title: "Learning & Development", + onTap: () { + + }, + ), + const Divider(), + MainMenu( + icon: Brandico.codepen, + title: "Personal References", + onTap: () { + + }, + ), + 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), + ), + ), + items: [ + subMenu( + Icons.fitness_center, "Skills & Hobbies",(){}), + subMenu(FontAwesome5.certificate, + "Organization Memberships",(){}), + subMenu(Entypo.doc_text, + "Non-Academic Recognitions",(){}), + ]), + 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",(){}), + ]), + ], + ), + ), + Container( + width: screenWidth, + height: screenHeight, + color: Colors.white70, + ), + ], + ); } } \ No newline at end of file diff --git a/lib/screens/profile/components/other_information/org_membership.dart b/lib/screens/profile/components/other_information/org_membership.dart new file mode 100644 index 0000000..a110286 --- /dev/null +++ b/lib/screens/profile/components/other_information/org_membership.dart @@ -0,0 +1,63 @@ +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/theme-data.dart/colors.dart'; + +import '../../../../utils/global.dart'; + +class OrgMembershipsScreen extends StatefulWidget { + final List orgMemberships; + const OrgMembershipsScreen({super.key, required this.orgMemberships}); + + @override + State createState() => _OrgMembershipsScreenState(); +} + +class _OrgMembershipsScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text("Organization Memberships"), + backgroundColor: primary, + centerTitle: true, + ), + body: ListView.builder( + itemCount: widget.orgMemberships.length, + itemBuilder: (BuildContext context, int index) { + String entity = + widget.orgMemberships[index].agency!.privateEntity == false + ? "Government" + : "Private"; + String agencyName = widget.orgMemberships[index].agency!.name!; + return Column( + children: [ + Container( + width: screenWidth, + decoration: BoxDecoration( + color: Colors.grey[200], + borderRadius: + const BorderRadius.all(Radius.circular(12))), + padding: + const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + child: Row(children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(entity), + Text(agencyName), + ], + )), + IconButton( + onPressed: () {}, icon: const Icon(Icons.more_vert)) + ]), + ) + ], + ); + }), + ); + } +} diff --git a/lib/screens/profile/components/other_information/skills_and_hobbies_screen.dart b/lib/screens/profile/components/other_information/skills_and_hobbies_screen.dart new file mode 100644 index 0000000..332a02f --- /dev/null +++ b/lib/screens/profile/components/other_information/skills_and_hobbies_screen.dart @@ -0,0 +1,49 @@ +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/skills_and_hobbies.dart'; +import 'package:unit2/theme-data.dart/colors.dart'; + +class SkillHobbiesScreen extends StatefulWidget { + final ListskillsHobbies; + const SkillHobbiesScreen({super.key,required this.skillsHobbies}); + + @override + State createState() => _SkillHobbiesScreenState(); +} + +class _SkillHobbiesScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text("Skills and Hobbies"), + backgroundColor: primary, + centerTitle: true, + + ), + body: Wrap( + spacing: 5, + runSpacing: 5, + clipBehavior: Clip.none, + verticalDirection: VerticalDirection.down, + children:widget.skillsHobbies.map((SkillsHobbies sh){ + return Badge( + padding: const EdgeInsets.all(8), + alignment: AlignmentDirectional.topStart, + backgroundColor: Colors.grey.shade300, + child: Row( + children: [ + Text(sh.name!), + IconButton( + onPressed: () {}, + icon: const Icon(Icons.close)), + ], + ), + + ); + }).toList() + + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/profile/profile.dart b/lib/screens/profile/profile.dart index 32c9216..53c4fed 100644 --- a/lib/screens/profile/profile.dart +++ b/lib/screens/profile/profile.dart @@ -16,6 +16,8 @@ import 'package:unit2/screens/profile/components/education_screen.dart'; import 'package:unit2/screens/profile/components/eligibility.dart'; import 'package:unit2/screens/profile/components/learning_and_development_screen.dart'; import 'package:unit2/screens/profile/components/loading_screen.dart'; +import 'package:unit2/screens/profile/components/other_information/org_membership.dart'; +import 'package:unit2/screens/profile/components/other_information/skills_and_hobbies_screen.dart'; import 'package:unit2/screens/profile/components/references_screen.dart'; import 'package:unit2/screens/profile/components/work_history_screen.dart'; import 'package:unit2/screens/profile/voluntary_works.dart'; @@ -193,9 +195,17 @@ class _ProfileInfoState extends State { ), items: [ subMenu(Icons.fitness_center, - "Skills & Hobbies",(){}), + "Skills & Hobbies",(){ + Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){ + return SkillHobbiesScreen(skillsHobbies: state.profileInformation.otherInformation.skillsAndHobbies); + })); + }), subMenu(FontAwesome5.certificate, - "Organization Memberships",(){}), + "Organization Memberships",(){ + Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){ + return OrgMembershipsScreen(orgMemberships: state.profileInformation.otherInformation.orgMemberships); + })); + }), subMenu(Entypo.doc_text, "Non-Academic Recognitions",(){}), ]), diff --git a/lib/sevices/profile/profile_service.dart b/lib/sevices/profile/profile_service.dart index 50d098a..e7ecf66 100644 --- a/lib/sevices/profile/profile_service.dart +++ b/lib/sevices/profile/profile_service.dart @@ -8,14 +8,17 @@ import 'package:unit2/model/profile/basic_information/identification_information import 'package:unit2/model/profile/educational_background.dart'; import 'package:unit2/model/profile/eligibility.dart'; import 'package:unit2/model/profile/learning_development.dart'; +import 'package:unit2/model/profile/other_info.dart'; import 'package:unit2/model/profile/profileInfomation.dart'; import 'package:unit2/model/profile/references.dart'; +import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart'; import 'package:unit2/model/profile/voluntary_works.dart'; import 'package:unit2/model/profile/work_history.dart'; import 'package:unit2/utils/request.dart'; import 'package:unit2/utils/urls.dart'; import '../../model/profile/basic_information/primary-information.dart'; +import '../../model/profile/other_information/organization_memberships.dart'; class ProfileService { static final ProfileService _instance = ProfileService(); @@ -35,6 +38,8 @@ class ProfileService { List learningsDevelopments = []; List educationalBackgrounds = []; List voluntaryWorks =[]; + List skillsHobbies = []; + List orgMemberships = []; Map headers = { 'Content-Type': 'application/json; charset=UTF-8', 'Authorization': "Token $token" @@ -105,13 +110,27 @@ class ProfileService { voluntaryWorks.add(vwork); }); + // get all hobbies + data['data']['other_information']['skills_hobbies'].forEach((var skills_hobbies){ + SkillsHobbies skillsAndHobbies = SkillsHobbies.fromJson(skills_hobbies); + skillsHobbies.add(skillsAndHobbies); + }); + + data['data']['other_information']['organization_memberships'].forEach((var org) { + OrganizationMembership organization = + OrganizationMembership.fromJson(org); + orgMemberships.add(organization); + }); + BasicInfo basicInfo = BasicInfo( contactInformation: contactInformation, primaryInformation: primaryInformation, identifications: identificationInformation, citizenships: citizenships); + OtherInformation otherInformation = OtherInformation(skillsAndHobbies: skillsHobbies,orgMemberships: orgMemberships); ProfileInformation profileInformation = ProfileInformation( + otherInformation: otherInformation, workExperiences: workExperiences, basicInfo: basicInfo, eligibilities: eligibilities, @@ -119,6 +138,7 @@ class ProfileService { learningsAndDevelopment: learningsDevelopments, educationalBackgrounds: educationalBackgrounds, voluntaryWorks: voluntaryWorks + ); profileInformation0 = profileInformation; }