Organization membership refactor and created its own bloc
parent
4151038ff3
commit
acc74653d1
|
@ -0,0 +1,24 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:unit2/sevices/profile/orgmembership_services.dart';
|
||||
|
||||
import '../../model/profile/other_information/organization_memberships.dart';
|
||||
|
||||
part 'organization_membership_event.dart';
|
||||
part 'organization_membership_state.dart';
|
||||
|
||||
class OrganizationMembershipBloc extends Bloc<OrganizationMembershipEvent, OrganizationMembershipState> {
|
||||
OrganizationMembershipBloc() : super(OrganizationMembershipInitial()) {
|
||||
List<OrganizationMembership> organizationMemberships=[];
|
||||
on<GetOrganizationMembership>((event, emit) async{
|
||||
emit(OrgmembershipLoadingState());
|
||||
try{
|
||||
List<OrganizationMembership> orgs = await OrganizationMembershipServices.instance.getOrgMemberships(event.profileId, event.token);
|
||||
organizationMemberships = orgs;
|
||||
emit(OrganizationMembershipLoaded(orgMemberships: organizationMemberships));
|
||||
}catch(e){
|
||||
OrganizationMembershipErrorState(message: e.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
part of 'organization_membership_bloc.dart';
|
||||
|
||||
abstract class OrganizationMembershipEvent extends Equatable {
|
||||
const OrganizationMembershipEvent();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class GetOrganizationMembership extends OrganizationMembershipEvent{
|
||||
final int profileId;
|
||||
final String token;
|
||||
const GetOrganizationMembership({required this.profileId, required this.token});
|
||||
@override
|
||||
List<Object> get props => [profileId,token];
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
part of 'organization_membership_bloc.dart';
|
||||
|
||||
abstract class OrganizationMembershipState extends Equatable {
|
||||
const OrganizationMembershipState();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class OrganizationMembershipInitial extends OrganizationMembershipState {}
|
||||
|
||||
class OrganizationMembershipLoaded extends OrganizationMembershipState{
|
||||
final List<OrganizationMembership>orgMemberships;
|
||||
const OrganizationMembershipLoaded({required this.orgMemberships});
|
||||
@override
|
||||
List<Object> get props => [orgMemberships];
|
||||
}
|
||||
|
||||
class OrganizationMembershipErrorState extends OrganizationMembershipState{
|
||||
final String message;
|
||||
const OrganizationMembershipErrorState({required this.message});
|
||||
@override
|
||||
List<Object> get props => [message];
|
||||
}
|
||||
|
||||
class OrgmembershipLoadingState extends OrganizationMembershipState{
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:unit2/sevices/skillshobbies_services.dart';
|
||||
|
||||
import '../../model/profile/other_information/skills_and_hobbies.dart';
|
||||
|
||||
part 'hoobies_event.dart';
|
||||
part 'hoobies_state.dart';
|
||||
|
||||
class HoobiesBloc extends Bloc<HobbiesEvent, HobbiesState> {
|
||||
HoobiesBloc() : super(HoobiesInitial()) {
|
||||
List<SkillsHobbies> skillsAndHobbies = [];
|
||||
on<GetSkillsHobbies>((event, emit)async {
|
||||
emit(HobbiesLoadingState());
|
||||
try{
|
||||
List<SkillsHobbies> hobbies = await SkillsHobbiesServices.instance.getSkillsHobbies(event.profileId, event.token);
|
||||
skillsAndHobbies = hobbies;
|
||||
emit(HobbiesLoadedState(skillsAndHobbies: skillsAndHobbies));
|
||||
}catch(e){
|
||||
emit(HobbiesErrorState(message: e.toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
part of 'hoobies_bloc.dart';
|
||||
|
||||
abstract class HobbiesEvent extends Equatable {
|
||||
const HobbiesEvent();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class GetSkillsHobbies extends HobbiesEvent{
|
||||
final int profileId;
|
||||
final String token;
|
||||
const GetSkillsHobbies({required this.profileId, required this.token});
|
||||
@override
|
||||
List<Object> get props => [profileId,token];
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
part of 'hoobies_bloc.dart';
|
||||
|
||||
abstract class HobbiesState extends Equatable {
|
||||
const HobbiesState();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class HoobiesInitial extends HobbiesState {}
|
||||
|
||||
class HobbiesLoadedState extends HobbiesState{
|
||||
final List<SkillsHobbies> skillsAndHobbies;
|
||||
const HobbiesLoadedState({required this.skillsAndHobbies});
|
||||
@override
|
||||
List<Object> get props => [skillsAndHobbies];
|
||||
}
|
||||
class HobbiesErrorState extends HobbiesState{
|
||||
final String message;
|
||||
const HobbiesErrorState({required this.message});
|
||||
|
||||
@override
|
||||
List<Object> get props => [message];
|
||||
|
||||
}
|
||||
|
||||
class HobbiesLoadingState extends HobbiesState{
|
||||
|
||||
}
|
|
@ -15,7 +15,6 @@ import 'package:unit2/widgets/empty_data.dart';
|
|||
import 'package:unit2/widgets/error_state.dart';
|
||||
|
||||
class EducationScreen extends StatelessWidget {
|
||||
|
||||
const EducationScreen({super.key});
|
||||
|
||||
@override
|
||||
|
@ -29,10 +28,9 @@ class EducationScreen extends StatelessWidget {
|
|||
),
|
||||
//userbloc
|
||||
body: ProgressHUD(
|
||||
padding: const EdgeInsets.all(24),
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(
|
||||
color: Colors.white),
|
||||
padding: const EdgeInsets.all(24),
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child: BlocBuilder<UserBloc, UserState>(
|
||||
builder: (context, state) {
|
||||
if (state is UserLoggedIn) {
|
||||
|
@ -43,14 +41,15 @@ class EducationScreen extends StatelessWidget {
|
|||
//education bloc
|
||||
return BlocConsumer<EducationBloc, EducationState>(
|
||||
listener: (context, state) {
|
||||
if (state is EducationalBackgroundLoadingState) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.showWithText("Please wait...");
|
||||
}
|
||||
if(state is EducationalBackgroundLoadedState || state is EducationalBackgroundErrorState){
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.dismiss();
|
||||
}
|
||||
if (state is EducationalBackgroundLoadingState) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.showWithText("Please wait...");
|
||||
}
|
||||
if (state is EducationalBackgroundLoadedState ||
|
||||
state is EducationalBackgroundErrorState) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.dismiss();
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is EducationalBackgroundLoadedState) {
|
||||
|
@ -59,13 +58,15 @@ class EducationScreen extends StatelessWidget {
|
|||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 10),
|
||||
itemCount: state.educationalBackground.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
itemBuilder:
|
||||
(BuildContext context, int index) {
|
||||
String level = state
|
||||
.educationalBackground[index]
|
||||
.education!
|
||||
.level!;
|
||||
String periodFrom = state
|
||||
.educationalBackground[index].periodFrom!;
|
||||
.educationalBackground[index]
|
||||
.periodFrom!;
|
||||
String periodTo = state
|
||||
.educationalBackground[index].periodTo!;
|
||||
String? program = state
|
||||
|
@ -97,7 +98,8 @@ class EducationScreen extends StatelessWidget {
|
|||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
CrossAxisAlignment
|
||||
.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
|
@ -115,10 +117,10 @@ class EducationScreen extends StatelessWidget {
|
|||
)),
|
||||
Text(
|
||||
"$periodFrom - ",
|
||||
style:
|
||||
Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium,
|
||||
style: Theme.of(
|
||||
context)
|
||||
.textTheme
|
||||
.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -135,7 +137,8 @@ class EducationScreen extends StatelessWidget {
|
|||
padding:
|
||||
const EdgeInsets
|
||||
.only(top: 8),
|
||||
child: honors.isNotEmpty
|
||||
child: honors
|
||||
.isNotEmpty
|
||||
? Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
|
@ -152,8 +155,7 @@ class EducationScreen extends StatelessWidget {
|
|||
),
|
||||
Column(
|
||||
children: honors
|
||||
.map((Honor
|
||||
honor) =>
|
||||
.map((Honor honor) =>
|
||||
Text(" - ${honor.name!}"))
|
||||
.toList(),
|
||||
),
|
||||
|
@ -198,8 +200,10 @@ class EducationScreen extends StatelessWidget {
|
|||
message:
|
||||
"You don't have any Educational Background added. Please click + to add.");
|
||||
}
|
||||
}if(state is EducationalBackgroundErrorState){
|
||||
return SomethingWentWrong(message: state.message, onpressed: (){});
|
||||
}
|
||||
if (state is EducationalBackgroundErrorState) {
|
||||
return SomethingWentWrong(
|
||||
message: state.message, onpressed: () {});
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:unit2/bloc/bloc/organization_membership_bloc.dart';
|
||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||
import 'package:unit2/bloc/user/user_bloc.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/colors.dart';
|
||||
|
@ -9,54 +15,115 @@ import 'package:unit2/widgets/empty_data.dart';
|
|||
import '../../../../utils/global.dart';
|
||||
|
||||
class OrgMembershipsScreen extends StatelessWidget {
|
||||
final List<OrganizationMembership> orgMemberships;
|
||||
const OrgMembershipsScreen({super.key, required this.orgMemberships});
|
||||
const OrgMembershipsScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text(orgMembershipTitle),
|
||||
backgroundColor: primary,
|
||||
centerTitle: true,
|
||||
actions: [AddLeading(onPressed: (){})],
|
||||
),
|
||||
body: orgMemberships.isNotEmpty? ListView.builder(
|
||||
itemCount: orgMemberships.length,
|
||||
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
String entity =
|
||||
orgMemberships[index].agency!.privateEntity == false
|
||||
? governmentText.toUpperCase()
|
||||
: privateText.toUpperCase();
|
||||
String agencyName = orgMemberships[index].agency!.name!;
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
width: screenWidth,
|
||||
decoration: box1(),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
child: Row(children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Text(agencyName,style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500),),
|
||||
const Divider(),
|
||||
Text(entity,style: Theme.of(context).textTheme.labelLarge,),
|
||||
],
|
||||
)),
|
||||
IconButton(
|
||||
onPressed: () {}, icon: const Icon(Icons.more_vert,color: Colors.grey,))
|
||||
]),
|
||||
),
|
||||
const SizedBox(height: 5,),
|
||||
],
|
||||
);
|
||||
}):const EmptyData(message: "You don't have any Organization Membership added. Please click + to add."),
|
||||
);
|
||||
appBar: AppBar(
|
||||
title: const Text(orgMembershipTitle),
|
||||
backgroundColor: primary,
|
||||
centerTitle: true,
|
||||
actions: [AddLeading(onPressed: () {})],
|
||||
),
|
||||
body: ProgressHUD(
|
||||
padding: const EdgeInsets.all(24),
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child: BlocBuilder<UserBloc, UserState>(
|
||||
builder: (context, state) {
|
||||
if (state is UserLoggedIn) {
|
||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||
builder: (context, state) {
|
||||
if (state is ProfileLoaded) {
|
||||
return BlocConsumer<OrganizationMembershipBloc,
|
||||
OrganizationMembershipState>(
|
||||
listener: (context, state) {
|
||||
if(state is OrgmembershipLoadingState){
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.showWithText("Please wait...");
|
||||
}
|
||||
if(state is OrganizationMembershipLoaded || state is OrganizationMembershipErrorState){
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.dismiss();
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is OrganizationMembershipLoaded) {
|
||||
return ListView.builder(
|
||||
itemCount: state.orgMemberships.length,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 10),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
String entity = state.orgMemberships[index]
|
||||
.agency!
|
||||
.privateEntity ==
|
||||
false
|
||||
? governmentText.toUpperCase()
|
||||
: privateText.toUpperCase();
|
||||
String agencyName =
|
||||
state.orgMemberships[index].agency!.name!;
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
width: screenWidth,
|
||||
decoration: box1(),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 8),
|
||||
child: Row(children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
agencyName,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.copyWith(
|
||||
fontWeight:
|
||||
FontWeight.w500),
|
||||
),
|
||||
const Divider(),
|
||||
Text(
|
||||
entity,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelLarge,
|
||||
),
|
||||
],
|
||||
)),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: const Icon(
|
||||
Icons.more_vert,
|
||||
color: Colors.grey,
|
||||
))
|
||||
]),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// const EmptyData(message: "You don't have any Organization Membership added. Please click + to add."),
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
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:flutter_progress_hud/flutter_progress_hud.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:unit2/bloc/hobbies/hoobies_bloc.dart';
|
||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||
import 'package:unit2/bloc/user/user_bloc.dart';
|
||||
import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart';
|
||||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/global.dart';
|
||||
|
@ -9,43 +15,82 @@ import 'package:unit2/widgets/Leadings/add_leading.dart';
|
|||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
class SkillHobbiesScreen extends StatelessWidget {
|
||||
final List<SkillsHobbies>skillsHobbies;
|
||||
const SkillHobbiesScreen({super.key,required this.skillsHobbies});
|
||||
const SkillHobbiesScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text(skillAndHobbiesTitle),
|
||||
backgroundColor: primary,
|
||||
centerTitle: true,
|
||||
actions: [AddLeading(onPressed: (){})],
|
||||
|
||||
),
|
||||
body: skillsHobbies.isNotEmpty? Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
alignment: WrapAlignment.start,
|
||||
clipBehavior: Clip.none,
|
||||
verticalDirection: VerticalDirection.up,
|
||||
crossAxisAlignment: WrapCrossAlignment.start,
|
||||
direction: Axis.horizontal,
|
||||
children:skillsHobbies.map((SkillsHobbies sh){
|
||||
return FittedBox(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(sh.name!),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: const Icon(Icons.close)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList()
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text(skillAndHobbiesTitle),
|
||||
backgroundColor: primary,
|
||||
centerTitle: true,
|
||||
actions: [AddLeading(onPressed: () {})],
|
||||
),
|
||||
):const EmptyData(message: "You don't have any Skills and Hobbies added. Please click + to add"),
|
||||
);
|
||||
body: ProgressHUD(
|
||||
padding: const EdgeInsets.all(24),
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child: BlocBuilder<UserBloc, UserState>(
|
||||
builder: (context, state) {
|
||||
if (state is UserLoggedIn) {
|
||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||
builder: (context, state) {
|
||||
if (state is ProfileLoaded) {
|
||||
return BlocConsumer<HoobiesBloc, HobbiesState>(
|
||||
listener: (context, state) {
|
||||
if (state is HobbiesLoadingState) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.showWithText("Please wait...");
|
||||
}if(state is HobbiesLoadedState || state is HobbiesErrorState){
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.dismiss();
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is HobbiesLoadedState) {
|
||||
if (state.skillsAndHobbies.isNotEmpty) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
alignment: WrapAlignment.start,
|
||||
clipBehavior: Clip.none,
|
||||
verticalDirection: VerticalDirection.up,
|
||||
crossAxisAlignment:
|
||||
WrapCrossAlignment.start,
|
||||
direction: Axis.horizontal,
|
||||
children:
|
||||
state.skillsAndHobbies.map((SkillsHobbies sh) {
|
||||
return FittedBox(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(sh.name!),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: const Icon(Icons.close)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList()),
|
||||
);
|
||||
} else {
|
||||
const EmptyData(
|
||||
message:
|
||||
"You don't have any Skills and Hobbies added. Please click + to add");
|
||||
}
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,10 @@ 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/bloc/organization_membership_bloc.dart';
|
||||
import 'package:unit2/bloc/education/education_bloc.dart';
|
||||
import 'package:unit2/bloc/eligibility/eligibility_bloc.dart';
|
||||
import 'package:unit2/bloc/hobbies/hoobies_bloc.dart';
|
||||
import 'package:unit2/bloc/learningDevelopment/learning_development_bloc.dart';
|
||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||
import 'package:unit2/bloc/references/references_bloc.dart';
|
||||
|
@ -153,19 +155,19 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
MainMenu(
|
||||
icon: Elusive.group,
|
||||
title: "Family",
|
||||
onTap: () {
|
||||
|
||||
},
|
||||
onTap: () {},
|
||||
),
|
||||
const Divider(),
|
||||
MainMenu(
|
||||
icon: FontAwesome5.graduation_cap,
|
||||
title: "Education",
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => EducationBloc()..add(GetEducationalBackground(profileId: profileId!, token: token!)),
|
||||
create: (context) => EducationBloc()
|
||||
..add(GetEducationalBackground(
|
||||
profileId: profileId!, token: token!)),
|
||||
child: const EducationScreen(),
|
||||
);
|
||||
}));
|
||||
|
@ -179,7 +181,9 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => EligibilityBloc()..add(GetEligibilities(profileId: profileId!, token: token!)),
|
||||
create: (context) => EligibilityBloc()
|
||||
..add(GetEligibilities(
|
||||
profileId: profileId!, token: token!)),
|
||||
child: const EligibiltyScreen(),
|
||||
);
|
||||
}));
|
||||
|
@ -193,11 +197,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => WorkHistoryBloc()..add(GetWorkHistories(profileId: profileId!, token: token!)),
|
||||
create: (context) => WorkHistoryBloc()
|
||||
..add(GetWorkHistories(
|
||||
profileId: profileId!, token: token!)),
|
||||
child: const WorkHistoryScreen(),
|
||||
);
|
||||
}));
|
||||
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
|
@ -205,10 +210,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
icon: FontAwesome5.walking,
|
||||
title: "Voluntary Work & Civic Services",
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => VoluntaryWorkBloc()..add(GetVoluntarWorks(profileId: profileId!, token: token!)),
|
||||
create: (context) => VoluntaryWorkBloc()
|
||||
..add(GetVoluntarWorks(
|
||||
profileId: profileId!, token: token!)),
|
||||
child: const VolunataryWorkScreen(),
|
||||
);
|
||||
}));
|
||||
|
@ -219,10 +226,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
icon: Elusive.lightbulb,
|
||||
title: "Learning & Development",
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => LearningDevelopmentBloc()..add(GetLearningDevelopments(profileId: profileId!, token: token!)),
|
||||
create: (context) => LearningDevelopmentBloc()
|
||||
..add(GetLearningDevelopments(
|
||||
profileId: profileId!, token: token!)),
|
||||
child: const LearningAndDevelopmentScreen(),
|
||||
);
|
||||
}));
|
||||
|
@ -233,10 +242,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
icon: Brandico.codepen,
|
||||
title: "Personal References",
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => ReferencesBloc()..add(GetReferences(profileId: profileId!, token: token!)),
|
||||
create: (context) => ReferencesBloc()
|
||||
..add(GetReferences(
|
||||
profileId: profileId!, token: token!)),
|
||||
child: const ReferencesScreen(),
|
||||
);
|
||||
}));
|
||||
|
@ -260,24 +271,33 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
subMenu(
|
||||
Icons.fitness_center, "Skills & Hobbies",
|
||||
() {
|
||||
// Navigator.push(context, MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return SkillHobbiesScreen(
|
||||
// skillsHobbies: state.profileInformation
|
||||
// .otherInformation.skillsAndHobbies);
|
||||
// }));
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => HoobiesBloc()
|
||||
..add(GetSkillsHobbies(
|
||||
profileId: profileId!,
|
||||
token: token!)),
|
||||
child: const SkillHobbiesScreen(),
|
||||
);
|
||||
}));
|
||||
}),
|
||||
subMenu(FontAwesome5.certificate,
|
||||
"Organization Memberships", () {
|
||||
// Navigator.push(context, MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return OrgMembershipsScreen(
|
||||
// orgMemberships: state.profileInformation
|
||||
// .otherInformation.orgMemberships);
|
||||
// }));
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => OrganizationMembershipBloc()
|
||||
..add(GetOrganizationMembership(
|
||||
profileId: profileId!,
|
||||
token: token!)),
|
||||
child: const OrgMembershipsScreen(),
|
||||
);
|
||||
}));
|
||||
}),
|
||||
subMenu(Entypo.doc_text,
|
||||
"Non-Academic Recognitions", () {
|
||||
|
||||
// Navigator.push(context, MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return NonAcademicRecognitionScreen(
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:unit2/utils/request.dart';
|
||||
|
||||
import '../../model/profile/other_information/organization_memberships.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../utils/urls.dart';
|
||||
|
||||
class OrganizationMembershipServices {
|
||||
static final OrganizationMembershipServices _instance =
|
||||
OrganizationMembershipServices();
|
||||
static OrganizationMembershipServices get instance => _instance;
|
||||
|
||||
Future<List<OrganizationMembership>> getOrgMemberships(
|
||||
int profileId, String token) async {
|
||||
List<OrganizationMembership> orgMemberships = [];
|
||||
String authToken = "Token $token";
|
||||
String path = "${Url.instance.getOrgMemberShips()}$profileId/";
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': authToken
|
||||
};
|
||||
try {
|
||||
http.Response response = await Request.instance
|
||||
.getRequest(path: path, param: {}, headers: headers);
|
||||
if (response.statusCode == 200) {
|
||||
Map data = jsonDecode(response.body);
|
||||
if (data['data'] != null) {
|
||||
data['data'].forEach((var org) {
|
||||
OrganizationMembership organizationMembership =
|
||||
OrganizationMembership.fromJson(org);
|
||||
orgMemberships.add(organizationMembership);
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
throw e.toString();
|
||||
}
|
||||
return orgMemberships;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:unit2/utils/request.dart';
|
||||
|
||||
import '../model/profile/other_information/skills_and_hobbies.dart';
|
||||
import '../utils/urls.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
class SkillsHobbiesServices{
|
||||
static final SkillsHobbiesServices _instance = SkillsHobbiesServices();
|
||||
static SkillsHobbiesServices get instance => _instance;
|
||||
|
||||
Future<List<SkillsHobbies>> getSkillsHobbies(int profileId, String token)async{
|
||||
|
||||
List<SkillsHobbies> skillsAndHobbies = [];
|
||||
String authToken = "Token $token";
|
||||
String path = "${Url.instance.getSkillsHobbies()}$profileId/";
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': authToken
|
||||
};
|
||||
try{
|
||||
http.Response response = await Request.instance.getRequest(path: path,param: {},headers: headers);
|
||||
if(response.statusCode == 200){
|
||||
Map data = jsonDecode(response.body);
|
||||
if(data['data']['skill_hobby'] != null){
|
||||
data['data']['skill_hobby'].forEach((var hobby){
|
||||
SkillsHobbies skillsHobby = SkillsHobbies.fromJson(hobby);
|
||||
skillsAndHobbies.add(skillsHobby);
|
||||
});
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
throw e.toString();
|
||||
}
|
||||
return skillsAndHobbies;
|
||||
}
|
||||
}
|
||||
|
|
@ -67,6 +67,16 @@ String getRefences(){
|
|||
String getVoluntaryWorks(){
|
||||
return "/api/jobnet_app/profile/pds/voluntary_work/";
|
||||
}
|
||||
|
||||
//// skills hobbies
|
||||
String getSkillsHobbies(){
|
||||
return "/api/jobnet_app/profile/pds/other/skill_hobby/";
|
||||
}
|
||||
//// orgmemberships
|
||||
String getOrgMemberShips(){
|
||||
return "/api/jobnet_app/profile/pds/other/org_membership/";
|
||||
}
|
||||
|
||||
// location utils path
|
||||
String getCounties(){
|
||||
return "/api/jobnet_app/countries/";
|
||||
|
|
Loading…
Reference in New Issue