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';
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
|
|
||||||
class EducationScreen extends StatelessWidget {
|
class EducationScreen extends StatelessWidget {
|
||||||
|
|
||||||
const EducationScreen({super.key});
|
const EducationScreen({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -29,10 +28,9 @@ class EducationScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
//userbloc
|
//userbloc
|
||||||
body: ProgressHUD(
|
body: ProgressHUD(
|
||||||
padding: const EdgeInsets.all(24),
|
padding: const EdgeInsets.all(24),
|
||||||
backgroundColor: Colors.black87,
|
backgroundColor: Colors.black87,
|
||||||
indicatorWidget: const SpinKitFadingCircle(
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
color: Colors.white),
|
|
||||||
child: BlocBuilder<UserBloc, UserState>(
|
child: BlocBuilder<UserBloc, UserState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is UserLoggedIn) {
|
if (state is UserLoggedIn) {
|
||||||
|
@ -43,14 +41,15 @@ class EducationScreen extends StatelessWidget {
|
||||||
//education bloc
|
//education bloc
|
||||||
return BlocConsumer<EducationBloc, EducationState>(
|
return BlocConsumer<EducationBloc, EducationState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is EducationalBackgroundLoadingState) {
|
if (state is EducationalBackgroundLoadingState) {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
progress!.showWithText("Please wait...");
|
progress!.showWithText("Please wait...");
|
||||||
}
|
}
|
||||||
if(state is EducationalBackgroundLoadedState || state is EducationalBackgroundErrorState){
|
if (state is EducationalBackgroundLoadedState ||
|
||||||
final progress = ProgressHUD.of(context);
|
state is EducationalBackgroundErrorState) {
|
||||||
progress!.dismiss();
|
final progress = ProgressHUD.of(context);
|
||||||
}
|
progress!.dismiss();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is EducationalBackgroundLoadedState) {
|
if (state is EducationalBackgroundLoadedState) {
|
||||||
|
@ -59,13 +58,15 @@ class EducationScreen extends StatelessWidget {
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 8, horizontal: 10),
|
vertical: 8, horizontal: 10),
|
||||||
itemCount: state.educationalBackground.length,
|
itemCount: state.educationalBackground.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder:
|
||||||
|
(BuildContext context, int index) {
|
||||||
String level = state
|
String level = state
|
||||||
.educationalBackground[index]
|
.educationalBackground[index]
|
||||||
.education!
|
.education!
|
||||||
.level!;
|
.level!;
|
||||||
String periodFrom = state
|
String periodFrom = state
|
||||||
.educationalBackground[index].periodFrom!;
|
.educationalBackground[index]
|
||||||
|
.periodFrom!;
|
||||||
String periodTo = state
|
String periodTo = state
|
||||||
.educationalBackground[index].periodTo!;
|
.educationalBackground[index].periodTo!;
|
||||||
String? program = state
|
String? program = state
|
||||||
|
@ -97,7 +98,8 @@ class EducationScreen extends StatelessWidget {
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.start,
|
MainAxisAlignment.start,
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment
|
||||||
|
.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
@ -115,10 +117,10 @@ class EducationScreen extends StatelessWidget {
|
||||||
)),
|
)),
|
||||||
Text(
|
Text(
|
||||||
"$periodFrom - ",
|
"$periodFrom - ",
|
||||||
style:
|
style: Theme.of(
|
||||||
Theme.of(context)
|
context)
|
||||||
.textTheme
|
.textTheme
|
||||||
.bodyMedium,
|
.bodyMedium,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -135,7 +137,8 @@ class EducationScreen extends StatelessWidget {
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets
|
const EdgeInsets
|
||||||
.only(top: 8),
|
.only(top: 8),
|
||||||
child: honors.isNotEmpty
|
child: honors
|
||||||
|
.isNotEmpty
|
||||||
? Column(
|
? Column(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment
|
MainAxisAlignment
|
||||||
|
@ -152,8 +155,7 @@ class EducationScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
children: honors
|
children: honors
|
||||||
.map((Honor
|
.map((Honor honor) =>
|
||||||
honor) =>
|
|
||||||
Text(" - ${honor.name!}"))
|
Text(" - ${honor.name!}"))
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
|
@ -198,8 +200,10 @@ class EducationScreen extends StatelessWidget {
|
||||||
message:
|
message:
|
||||||
"You don't have any Educational Background added. Please click + to add.");
|
"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();
|
return Container();
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
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/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';
|
||||||
|
@ -9,54 +15,115 @@ import 'package:unit2/widgets/empty_data.dart';
|
||||||
import '../../../../utils/global.dart';
|
import '../../../../utils/global.dart';
|
||||||
|
|
||||||
class OrgMembershipsScreen extends StatelessWidget {
|
class OrgMembershipsScreen extends StatelessWidget {
|
||||||
final List<OrganizationMembership> orgMemberships;
|
const OrgMembershipsScreen({super.key});
|
||||||
const OrgMembershipsScreen({super.key, required this.orgMemberships});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text(orgMembershipTitle),
|
title: const Text(orgMembershipTitle),
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
actions: [AddLeading(onPressed: (){})],
|
actions: [AddLeading(onPressed: () {})],
|
||||||
),
|
),
|
||||||
body: orgMemberships.isNotEmpty? ListView.builder(
|
body: ProgressHUD(
|
||||||
itemCount: orgMemberships.length,
|
padding: const EdgeInsets.all(24),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10),
|
backgroundColor: Colors.black87,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
String entity =
|
child: BlocBuilder<UserBloc, UserState>(
|
||||||
orgMemberships[index].agency!.privateEntity == false
|
builder: (context, state) {
|
||||||
? governmentText.toUpperCase()
|
if (state is UserLoggedIn) {
|
||||||
: privateText.toUpperCase();
|
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||||
String agencyName = orgMemberships[index].agency!.name!;
|
builder: (context, state) {
|
||||||
return Column(
|
if (state is ProfileLoaded) {
|
||||||
children: [
|
return BlocConsumer<OrganizationMembershipBloc,
|
||||||
Container(
|
OrganizationMembershipState>(
|
||||||
width: screenWidth,
|
listener: (context, state) {
|
||||||
decoration: box1(),
|
if(state is OrgmembershipLoadingState){
|
||||||
padding:
|
final progress = ProgressHUD.of(context);
|
||||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
progress!.showWithText("Please wait...");
|
||||||
child: Row(children: [
|
}
|
||||||
Expanded(
|
if(state is OrganizationMembershipLoaded || state is OrganizationMembershipErrorState){
|
||||||
child: Column(
|
final progress = ProgressHUD.of(context);
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
progress!.dismiss();
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
}
|
||||||
children: [
|
},
|
||||||
|
builder: (context, state) {
|
||||||
Text(agencyName,style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500),),
|
if (state is OrganizationMembershipLoaded) {
|
||||||
const Divider(),
|
return ListView.builder(
|
||||||
Text(entity,style: Theme.of(context).textTheme.labelLarge,),
|
itemCount: state.orgMemberships.length,
|
||||||
],
|
padding: const EdgeInsets.symmetric(
|
||||||
)),
|
vertical: 8, horizontal: 10),
|
||||||
IconButton(
|
itemBuilder: (BuildContext context, int index) {
|
||||||
onPressed: () {}, icon: const Icon(Icons.more_vert,color: Colors.grey,))
|
String entity = state.orgMemberships[index]
|
||||||
]),
|
.agency!
|
||||||
),
|
.privateEntity ==
|
||||||
const SizedBox(height: 5,),
|
false
|
||||||
],
|
? governmentText.toUpperCase()
|
||||||
);
|
: privateText.toUpperCase();
|
||||||
}):const EmptyData(message: "You don't have any Organization Membership added. Please click + to add."),
|
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/material.dart';
|
||||||
import 'package:flutter/src/widgets/framework.dart';
|
import 'package:flutter/src/widgets/framework.dart';
|
||||||
import 'package:flutter/src/widgets/placeholder.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/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';
|
||||||
|
@ -9,43 +15,82 @@ import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||||
import 'package:unit2/widgets/empty_data.dart';
|
import 'package:unit2/widgets/empty_data.dart';
|
||||||
|
|
||||||
class SkillHobbiesScreen extends StatelessWidget {
|
class SkillHobbiesScreen extends StatelessWidget {
|
||||||
final List<SkillsHobbies>skillsHobbies;
|
const SkillHobbiesScreen({super.key});
|
||||||
const SkillHobbiesScreen({super.key,required this.skillsHobbies});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text(skillAndHobbiesTitle),
|
appBar: AppBar(
|
||||||
backgroundColor: primary,
|
title: const Text(skillAndHobbiesTitle),
|
||||||
centerTitle: true,
|
backgroundColor: primary,
|
||||||
actions: [AddLeading(onPressed: (){})],
|
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()
|
|
||||||
|
|
||||||
),
|
),
|
||||||
):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/entypo_icons.dart';
|
||||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
import 'package:fluttericon/modern_pictograms_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/education/education_bloc.dart';
|
||||||
import 'package:unit2/bloc/eligibility/eligibility_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/learningDevelopment/learning_development_bloc.dart';
|
||||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||||
import 'package:unit2/bloc/references/references_bloc.dart';
|
import 'package:unit2/bloc/references/references_bloc.dart';
|
||||||
|
@ -153,19 +155,19 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
||||||
MainMenu(
|
MainMenu(
|
||||||
icon: Elusive.group,
|
icon: Elusive.group,
|
||||||
title: "Family",
|
title: "Family",
|
||||||
onTap: () {
|
onTap: () {},
|
||||||
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
MainMenu(
|
MainMenu(
|
||||||
icon: FontAwesome5.graduation_cap,
|
icon: FontAwesome5.graduation_cap,
|
||||||
title: "Education",
|
title: "Education",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(context, MaterialPageRoute(
|
Navigator.push(context, MaterialPageRoute(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => EducationBloc()..add(GetEducationalBackground(profileId: profileId!, token: token!)),
|
create: (context) => EducationBloc()
|
||||||
|
..add(GetEducationalBackground(
|
||||||
|
profileId: profileId!, token: token!)),
|
||||||
child: const EducationScreen(),
|
child: const EducationScreen(),
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
|
@ -179,7 +181,9 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
||||||
Navigator.push(context, MaterialPageRoute(
|
Navigator.push(context, MaterialPageRoute(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => EligibilityBloc()..add(GetEligibilities(profileId: profileId!, token: token!)),
|
create: (context) => EligibilityBloc()
|
||||||
|
..add(GetEligibilities(
|
||||||
|
profileId: profileId!, token: token!)),
|
||||||
child: const EligibiltyScreen(),
|
child: const EligibiltyScreen(),
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
|
@ -193,11 +197,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
||||||
Navigator.push(context, MaterialPageRoute(
|
Navigator.push(context, MaterialPageRoute(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => WorkHistoryBloc()..add(GetWorkHistories(profileId: profileId!, token: token!)),
|
create: (context) => WorkHistoryBloc()
|
||||||
|
..add(GetWorkHistories(
|
||||||
|
profileId: profileId!, token: token!)),
|
||||||
child: const WorkHistoryScreen(),
|
child: const WorkHistoryScreen(),
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
|
@ -205,10 +210,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
||||||
icon: FontAwesome5.walking,
|
icon: FontAwesome5.walking,
|
||||||
title: "Voluntary Work & Civic Services",
|
title: "Voluntary Work & Civic Services",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(context, MaterialPageRoute(
|
Navigator.push(context, MaterialPageRoute(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => VoluntaryWorkBloc()..add(GetVoluntarWorks(profileId: profileId!, token: token!)),
|
create: (context) => VoluntaryWorkBloc()
|
||||||
|
..add(GetVoluntarWorks(
|
||||||
|
profileId: profileId!, token: token!)),
|
||||||
child: const VolunataryWorkScreen(),
|
child: const VolunataryWorkScreen(),
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
|
@ -219,10 +226,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
||||||
icon: Elusive.lightbulb,
|
icon: Elusive.lightbulb,
|
||||||
title: "Learning & Development",
|
title: "Learning & Development",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(context, MaterialPageRoute(
|
Navigator.push(context, MaterialPageRoute(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => LearningDevelopmentBloc()..add(GetLearningDevelopments(profileId: profileId!, token: token!)),
|
create: (context) => LearningDevelopmentBloc()
|
||||||
|
..add(GetLearningDevelopments(
|
||||||
|
profileId: profileId!, token: token!)),
|
||||||
child: const LearningAndDevelopmentScreen(),
|
child: const LearningAndDevelopmentScreen(),
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
|
@ -233,10 +242,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
||||||
icon: Brandico.codepen,
|
icon: Brandico.codepen,
|
||||||
title: "Personal References",
|
title: "Personal References",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(context, MaterialPageRoute(
|
Navigator.push(context, MaterialPageRoute(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => ReferencesBloc()..add(GetReferences(profileId: profileId!, token: token!)),
|
create: (context) => ReferencesBloc()
|
||||||
|
..add(GetReferences(
|
||||||
|
profileId: profileId!, token: token!)),
|
||||||
child: const ReferencesScreen(),
|
child: const ReferencesScreen(),
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
|
@ -260,24 +271,33 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
||||||
subMenu(
|
subMenu(
|
||||||
Icons.fitness_center, "Skills & Hobbies",
|
Icons.fitness_center, "Skills & Hobbies",
|
||||||
() {
|
() {
|
||||||
// Navigator.push(context, MaterialPageRoute(
|
Navigator.push(context, MaterialPageRoute(
|
||||||
// builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
// return SkillHobbiesScreen(
|
return BlocProvider(
|
||||||
// skillsHobbies: state.profileInformation
|
create: (context) => HoobiesBloc()
|
||||||
// .otherInformation.skillsAndHobbies);
|
..add(GetSkillsHobbies(
|
||||||
// }));
|
profileId: profileId!,
|
||||||
|
token: token!)),
|
||||||
|
child: const SkillHobbiesScreen(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
}),
|
}),
|
||||||
subMenu(FontAwesome5.certificate,
|
subMenu(FontAwesome5.certificate,
|
||||||
"Organization Memberships", () {
|
"Organization Memberships", () {
|
||||||
// Navigator.push(context, MaterialPageRoute(
|
Navigator.push(context, MaterialPageRoute(
|
||||||
// builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
// return OrgMembershipsScreen(
|
return BlocProvider(
|
||||||
// orgMemberships: state.profileInformation
|
create: (context) => OrganizationMembershipBloc()
|
||||||
// .otherInformation.orgMemberships);
|
..add(GetOrganizationMembership(
|
||||||
// }));
|
profileId: profileId!,
|
||||||
|
token: token!)),
|
||||||
|
child: const OrgMembershipsScreen(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
}),
|
}),
|
||||||
subMenu(Entypo.doc_text,
|
subMenu(Entypo.doc_text,
|
||||||
"Non-Academic Recognitions", () {
|
"Non-Academic Recognitions", () {
|
||||||
|
|
||||||
// Navigator.push(context, MaterialPageRoute(
|
// Navigator.push(context, MaterialPageRoute(
|
||||||
// builder: (BuildContext context) {
|
// builder: (BuildContext context) {
|
||||||
// return NonAcademicRecognitionScreen(
|
// 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(){
|
String getVoluntaryWorks(){
|
||||||
return "/api/jobnet_app/profile/pds/voluntary_work/";
|
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
|
// location utils path
|
||||||
String getCounties(){
|
String getCounties(){
|
||||||
return "/api/jobnet_app/countries/";
|
return "/api/jobnet_app/countries/";
|
||||||
|
|
Loading…
Reference in New Issue