family background refactor and created its own bloc
parent
2a57e7453b
commit
4251002cbf
|
@ -0,0 +1,24 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/sevices/profile/family_services.dart';
|
||||||
|
|
||||||
|
import '../../model/profile/family_backround.dart';
|
||||||
|
|
||||||
|
part 'family_event.dart';
|
||||||
|
part 'family_state.dart';
|
||||||
|
|
||||||
|
class FamilyBloc extends Bloc<FamilyEvent, FamilyState> {
|
||||||
|
FamilyBloc() : super(FamilyInitial()) {
|
||||||
|
List<FamilyBackground> families = [];
|
||||||
|
on<GetFamilies>((event, emit) async{
|
||||||
|
emit(FamilyLoadingState());
|
||||||
|
try{
|
||||||
|
List<FamilyBackground> family = await FamilyService.instance.getFamilies(event.profileId, event.token);
|
||||||
|
families = family;
|
||||||
|
emit(FamilyLoaded(families: families));
|
||||||
|
}catch(e){
|
||||||
|
emit(FamilyErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
part of 'family_bloc.dart';
|
||||||
|
|
||||||
|
abstract class FamilyEvent extends Equatable {
|
||||||
|
const FamilyEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class GetFamilies extends FamilyEvent{
|
||||||
|
final int profileId;
|
||||||
|
final String token;
|
||||||
|
const GetFamilies({required this.profileId, required this.token});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [profileId,token];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'family_bloc.dart';
|
||||||
|
|
||||||
|
abstract class FamilyState extends Equatable {
|
||||||
|
const FamilyState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FamilyInitial extends FamilyState {}
|
||||||
|
|
||||||
|
class FamilyLoaded extends FamilyState{
|
||||||
|
final List<FamilyBackground> families;
|
||||||
|
const FamilyLoaded({required this.families});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [families];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FamilyErrorState extends FamilyState{
|
||||||
|
final String message;
|
||||||
|
const FamilyErrorState({required this.message});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [message];
|
||||||
|
}
|
||||||
|
class FamilyLoadingState extends FamilyState{
|
||||||
|
|
||||||
|
}
|
|
@ -1,10 +0,0 @@
|
||||||
import 'package:unit2/model/profile/other_information/non_acedimic_recognition.dart';
|
|
||||||
import 'package:unit2/model/profile/other_information/organization_memberships.dart';
|
|
||||||
import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart';
|
|
||||||
|
|
||||||
class OtherInformation{
|
|
||||||
List<SkillsHobbies> skillsAndHobbies;
|
|
||||||
List<OrganizationMembership>orgMemberships;
|
|
||||||
List<NonAcademicRecognition> nonAcademicRecognition;
|
|
||||||
OtherInformation({required this.skillsAndHobbies, required this.orgMemberships, required this.nonAcademicRecognition});
|
|
||||||
}
|
|
|
@ -4,7 +4,6 @@ import 'package:unit2/model/profile/educational_background.dart';
|
||||||
import 'package:unit2/model/profile/eligibility.dart';
|
import 'package:unit2/model/profile/eligibility.dart';
|
||||||
import 'package:unit2/model/profile/family_backround.dart';
|
import 'package:unit2/model/profile/family_backround.dart';
|
||||||
import 'package:unit2/model/profile/learning_development.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/references.dart';
|
||||||
import 'package:unit2/model/profile/voluntary_works.dart';
|
import 'package:unit2/model/profile/voluntary_works.dart';
|
||||||
import 'package:unit2/model/profile/work_history.dart';
|
import 'package:unit2/model/profile/work_history.dart';
|
||||||
|
|
|
@ -20,7 +20,7 @@ class ContactInformationScreen extends StatelessWidget {
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
actions: [AddLeading(onPressed: (){})],
|
actions: [AddLeading(onPressed: (){})],
|
||||||
),
|
),
|
||||||
body: contacts.isEmpty? ListView.builder(
|
body: contacts.isNotEmpty? ListView.builder(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10),
|
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10),
|
||||||
itemCount: contacts.length,
|
itemCount: contacts.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
|
|
@ -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/family/family_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/user/user_bloc.dart';
|
||||||
import 'package:unit2/model/profile/family_backround.dart';
|
import 'package:unit2/model/profile/family_backround.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';
|
||||||
|
@ -6,8 +12,9 @@ import 'package:unit2/utils/global.dart';
|
||||||
import 'package:unit2/utils/text_container.dart';
|
import 'package:unit2/utils/text_container.dart';
|
||||||
|
|
||||||
class FamilyBackgroundScreen extends StatefulWidget {
|
class FamilyBackgroundScreen extends StatefulWidget {
|
||||||
final List<FamilyBackground> familyBackground;
|
const FamilyBackgroundScreen({
|
||||||
const FamilyBackgroundScreen({super.key, required this.familyBackground});
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<FamilyBackgroundScreen> createState() => _FamilyBackgroundScreenState();
|
State<FamilyBackgroundScreen> createState() => _FamilyBackgroundScreenState();
|
||||||
|
@ -21,279 +28,402 @@ class _FamilyBackgroundScreenState extends State<FamilyBackgroundScreen> {
|
||||||
List<FamilyBackground> otherRelated = [];
|
List<FamilyBackground> otherRelated = [];
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
father = widget.familyBackground
|
|
||||||
.firstWhere((element) => element.relationship!.id == 1);
|
|
||||||
mother = widget.familyBackground
|
|
||||||
.firstWhere((element) => element.relationship!.id == 2);
|
|
||||||
spouse = widget.familyBackground
|
|
||||||
.firstWhere((element) => element.relationship!.id == 3);
|
|
||||||
|
|
||||||
// get all children
|
|
||||||
var childs = widget.familyBackground
|
|
||||||
.where((element) => element.relationship!.id == 4);
|
|
||||||
if (childs.isNotEmpty) {
|
|
||||||
for (var element in childs) {
|
|
||||||
children.add(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//get all related persons
|
|
||||||
var relateds = widget.familyBackground
|
|
||||||
.where((element) => element.relationship!.id! > 4);
|
|
||||||
if (relateds.isNotEmpty) {
|
|
||||||
for (var element in relateds) {
|
|
||||||
otherRelated.add(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text(familyBackgroundScreenTitle),
|
title: const Text(familyBackgroundScreenTitle),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
),
|
),
|
||||||
body: ListView(children: [
|
body: ProgressHUD(
|
||||||
//Father----------------------------------------------
|
padding: const EdgeInsets.all(24),
|
||||||
Container(
|
backgroundColor: Colors.black87,
|
||||||
decoration: box1(),
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
child: BlocBuilder<UserBloc, UserState>(
|
||||||
width: screenWidth,
|
builder: (context, state) {
|
||||||
child: Row(
|
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||||
children: [
|
builder: (context, state) {
|
||||||
Expanded(
|
if (state is ProfileLoaded) {
|
||||||
child: Column(
|
return BlocConsumer<FamilyBloc, FamilyState>(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
listener: (context, state) {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
if (state is FamilyLoadingState) {
|
||||||
children: [
|
final progress = ProgressHUD.of(context);
|
||||||
const Text(fatherText),
|
progress!.showWithText("Please wait...");
|
||||||
const SizedBox(height: 5,),
|
}
|
||||||
Text(
|
if (state is FamilyLoaded || state is FamilyErrorState) {
|
||||||
" ${father!.relatedPerson!.firstName} ${father!.relatedPerson!.middleName} ${father!.relatedPerson!.lastName} ${father!.relatedPerson!.nameExtension ?? ''},",style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500),),
|
final progress = ProgressHUD.of(context);
|
||||||
Text(" $fullname",style: Theme.of(context).textTheme.bodySmall,),
|
progress!.dismiss();
|
||||||
Row(
|
}
|
||||||
children: [
|
},
|
||||||
Checkbox(value: false, onChanged: (value) {
|
builder: (context, state) {
|
||||||
setState(() {
|
if (state is FamilyLoaded) {
|
||||||
value = !value!;
|
father = state.families.firstWhere(
|
||||||
});
|
(element) => element.relationship!.id == 1);
|
||||||
}),
|
mother = state.families.firstWhere(
|
||||||
const Text(incaseOfEmergency)
|
(element) => element.relationship!.id == 2);
|
||||||
],
|
spouse = state.families.firstWhere(
|
||||||
)
|
(element) => element.relationship!.id == 3);
|
||||||
]),
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
onPressed: () {},
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.more_vert,
|
|
||||||
color: Colors.grey,
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 5,
|
|
||||||
),
|
|
||||||
|
|
||||||
//Mother-----------------------------------------------------
|
// get all children
|
||||||
Container(
|
var childs = state.families
|
||||||
decoration: box1(),
|
.where((element) => element.relationship!.id == 4);
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
if (childs.isNotEmpty) {
|
||||||
width: screenWidth,
|
for (var element in childs) {
|
||||||
child: Row(
|
children.add(element);
|
||||||
children: [
|
}
|
||||||
Expanded(
|
}
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
//get all related persons
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
var relateds = state.families
|
||||||
children: [
|
.where((element) => element.relationship!.id! > 4);
|
||||||
const Text(motherText),
|
if (relateds.isNotEmpty) {
|
||||||
const SizedBox(height: 5,),
|
for (var element in relateds) {
|
||||||
Text(
|
otherRelated.add(element);
|
||||||
" ${mother!.relatedPerson!.firstName} ${mother!.relatedPerson!.middleName} ${mother!.relatedPerson!.lastName} ${mother!.relatedPerson!.nameExtension ?? ''}",style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500),),
|
}
|
||||||
Text(" $fullname",style: Theme.of(context).textTheme.bodySmall),
|
}
|
||||||
Row(
|
return ListView(children: [
|
||||||
children: [
|
//Father----------------------------------------------
|
||||||
Checkbox(value: false, onChanged: (value) {}),
|
Container(
|
||||||
const Text(incaseOfEmergency)
|
decoration: box1(),
|
||||||
],
|
padding: const EdgeInsets.symmetric(
|
||||||
)
|
horizontal: 12, vertical: 8),
|
||||||
]),
|
width: screenWidth,
|
||||||
),
|
child: Row(
|
||||||
IconButton(
|
|
||||||
onPressed: () {},
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.more_vert,
|
|
||||||
color: Colors.grey,
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 5,
|
|
||||||
),
|
|
||||||
//Spouse ---------------------------------------------------------
|
|
||||||
spouse != null
|
|
||||||
? Container(
|
|
||||||
decoration: box1(),
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
|
||||||
width: screenWidth,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
const Text(spouseText),
|
|
||||||
const SizedBox(height: 5,),
|
|
||||||
Text(
|
|
||||||
" ${spouse!.relatedPerson!.firstName} ${spouse!.relatedPerson!.middleName} ${spouse!.relatedPerson!.lastName} ${spouse!.relatedPerson!.nameExtension ?? ''}",style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500)),
|
|
||||||
Text(" $fullname",style: Theme.of(context).textTheme.bodySmall),
|
|
||||||
Row(
|
|
||||||
children: [
|
children: [
|
||||||
Checkbox(value: false, onChanged: (value) {}),
|
Expanded(
|
||||||
const Text(incaseOfEmergency)
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const Text(fatherText),
|
||||||
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
" ${father!.relatedPerson!.firstName} ${father!.relatedPerson!.middleName} ${father!.relatedPerson!.lastName} ${father!.relatedPerson!.nameExtension ?? ''},",
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(
|
||||||
|
fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
" ",
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.bodySmall,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value: false,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
value = !value!;
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
const Text(incaseOfEmergency)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
color: Colors.grey,
|
||||||
|
))
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
]),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
IconButton(
|
height: 5,
|
||||||
onPressed: () {},
|
),
|
||||||
icon: const Icon(
|
|
||||||
Icons.more_vert,
|
|
||||||
color: Colors.grey,
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: const SizedBox(),
|
|
||||||
const SizedBox(
|
|
||||||
height: 5,
|
|
||||||
),
|
|
||||||
|
|
||||||
// Childrens ----------------------------------
|
//Mother-----------------------------------------------------
|
||||||
children.isNotEmpty
|
Container(
|
||||||
? Container(
|
decoration: box1(),
|
||||||
decoration: box1(),
|
padding: const EdgeInsets.symmetric(
|
||||||
child: Column(
|
horizontal: 12, vertical: 8),
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
width: screenWidth,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Row(
|
||||||
children: children
|
children: [
|
||||||
.map(
|
Expanded(
|
||||||
(child){
|
child: Column(
|
||||||
int index = children.indexOf(child);
|
mainAxisAlignment:
|
||||||
return Container(
|
MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment:
|
||||||
padding: const EdgeInsets.symmetric(
|
CrossAxisAlignment.start,
|
||||||
horizontal: 12, vertical: 8),
|
children: [
|
||||||
width: screenWidth,
|
const Text(motherText),
|
||||||
child: Column(
|
const SizedBox(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
height: 5,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
),
|
||||||
children: [
|
Text(
|
||||||
index == 0? const Text(childrenText):const SizedBox(),
|
" ${mother!.relatedPerson!.firstName} ${mother!.relatedPerson!.middleName} ${mother!.relatedPerson!.lastName} ${mother!.relatedPerson!.nameExtension ?? ''}",
|
||||||
const SizedBox(
|
style: Theme.of(context)
|
||||||
height: 5,
|
.textTheme
|
||||||
),
|
.titleMedium!
|
||||||
Row(
|
.copyWith(
|
||||||
children: [
|
fontWeight: FontWeight.w500),
|
||||||
Expanded(
|
),
|
||||||
child: Column(
|
Text(" ",
|
||||||
mainAxisAlignment:
|
style: Theme.of(context)
|
||||||
MainAxisAlignment.start,
|
.textTheme
|
||||||
crossAxisAlignment:
|
.bodySmall),
|
||||||
CrossAxisAlignment.start,
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Checkbox(
|
||||||
" ${child.relatedPerson!.firstName} ${child.relatedPerson!.middleName} ${child.relatedPerson!.lastName} ${child.relatedPerson!.nameExtension ?? ''}",style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500)),
|
value: false,
|
||||||
Text(" $fullname",style: Theme.of(context).textTheme.bodySmall),
|
onChanged: (value) {}),
|
||||||
Row(
|
const Text(incaseOfEmergency)
|
||||||
children: [
|
],
|
||||||
Checkbox(
|
)
|
||||||
value: false,
|
]),
|
||||||
onChanged: (value) {}),
|
),
|
||||||
const Text(incaseOfEmergency)
|
IconButton(
|
||||||
],
|
onPressed: () {},
|
||||||
)
|
icon: const Icon(
|
||||||
]),
|
Icons.more_vert,
|
||||||
),
|
color: Colors.grey,
|
||||||
IconButton(
|
))
|
||||||
onPressed: () {},
|
],
|
||||||
icon: const Icon(Icons.more_vert,color: Colors.grey,))
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
const SizedBox(
|
||||||
}
|
height: 5,
|
||||||
)
|
),
|
||||||
.toList()),
|
//Spouse ---------------------------------------------------------
|
||||||
)
|
spouse != null
|
||||||
: const SizedBox(),
|
? Container(
|
||||||
const SizedBox(
|
decoration: box1(),
|
||||||
height: 5,
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12, vertical: 8),
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const Text(spouseText),
|
||||||
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
" ${spouse!.relatedPerson!.firstName} ${spouse!.relatedPerson!.middleName} ${spouse!.relatedPerson!.lastName} ${spouse!.relatedPerson!.nameExtension ?? ''}",
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w500)),
|
||||||
|
Text(" ",
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.bodySmall),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value: false,
|
||||||
|
onChanged: (value) {}),
|
||||||
|
const Text(incaseOfEmergency)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
color: Colors.grey,
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
|
||||||
|
// Childrens ----------------------------------
|
||||||
|
children.isNotEmpty
|
||||||
|
? Container(
|
||||||
|
decoration: box1(),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: children.map((child) {
|
||||||
|
int index = children.indexOf(child);
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12, vertical: 8),
|
||||||
|
width: screenWidth,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
index == 0
|
||||||
|
? const Text(childrenText)
|
||||||
|
: const SizedBox(),
|
||||||
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment
|
||||||
|
.start,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment
|
||||||
|
.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
" ${child.relatedPerson!.firstName} ${child.relatedPerson!.middleName} ${child.relatedPerson!.lastName} ${child.relatedPerson!.nameExtension ?? ''}",
|
||||||
|
style: Theme.of(
|
||||||
|
context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(
|
||||||
|
fontWeight:
|
||||||
|
FontWeight
|
||||||
|
.w500)),
|
||||||
|
Text(" ",
|
||||||
|
style: Theme.of(
|
||||||
|
context)
|
||||||
|
.textTheme
|
||||||
|
.bodySmall),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value: false,
|
||||||
|
onChanged:
|
||||||
|
(value) {}),
|
||||||
|
const Text(
|
||||||
|
incaseOfEmergency)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
color: Colors.grey,
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList()),
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
//Other related person
|
||||||
|
otherRelated.isNotEmpty
|
||||||
|
? Container(
|
||||||
|
decoration: box1(),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: otherRelated.map((relative) {
|
||||||
|
int index2 =
|
||||||
|
otherRelated.indexOf(relative);
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12, vertical: 8),
|
||||||
|
width: screenWidth,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
index2 == 0
|
||||||
|
? const Text(otherRelatedText)
|
||||||
|
: const SizedBox(),
|
||||||
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment
|
||||||
|
.start,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment
|
||||||
|
.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
" ${relative.relatedPerson!.firstName} ${relative.relatedPerson!.middleName} ${relative.relatedPerson!.lastName} ${relative.relatedPerson!.nameExtension ?? ''}",
|
||||||
|
style: Theme.of(
|
||||||
|
context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(
|
||||||
|
fontWeight:
|
||||||
|
FontWeight
|
||||||
|
.w500)),
|
||||||
|
Text(" ",
|
||||||
|
style: Theme.of(
|
||||||
|
context)
|
||||||
|
.textTheme
|
||||||
|
.bodySmall!),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value: false,
|
||||||
|
onChanged:
|
||||||
|
(value) {}),
|
||||||
|
const Text(
|
||||||
|
incaseOfEmergency)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
color: Colors.grey,
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList()),
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
//Other related person
|
),
|
||||||
otherRelated.isNotEmpty
|
|
||||||
? Container(
|
|
||||||
decoration: box1(),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: otherRelated
|
|
||||||
.map(
|
|
||||||
(relative){
|
|
||||||
int index2 = otherRelated.indexOf(relative);
|
|
||||||
return Container(
|
|
||||||
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 12, vertical: 8),
|
|
||||||
width: screenWidth,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
index2 == 0? const Text(otherRelatedText):const SizedBox(),
|
|
||||||
const SizedBox(
|
|
||||||
height: 5,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment:
|
|
||||||
CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
" ${relative.relatedPerson!.firstName} ${relative.relatedPerson!.middleName} ${relative.relatedPerson!.lastName} ${relative.relatedPerson!.nameExtension ?? ''}",style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500)),
|
|
||||||
Text(" $fullname",style: Theme.of(context).textTheme.bodySmall!),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Checkbox(
|
|
||||||
value: false,
|
|
||||||
onChanged: (value) {}),
|
|
||||||
const Text(incaseOfEmergency)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
onPressed: () {},
|
|
||||||
icon: const Icon(Icons.more_vert,color: Colors.grey,))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.toList()),
|
|
||||||
)
|
|
||||||
: const SizedBox(),
|
|
||||||
]),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ 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/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/family/family_bloc.dart';
|
||||||
import 'package:unit2/bloc/hobbies/hoobies_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/non_academic_recognition.dart/non_academic_recognition_bloc.dart';
|
import 'package:unit2/bloc/non_academic_recognition.dart/non_academic_recognition_bloc.dart';
|
||||||
|
@ -156,7 +157,17 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
||||||
MainMenu(
|
MainMenu(
|
||||||
icon: Elusive.group,
|
icon: Elusive.group,
|
||||||
title: "Family",
|
title: "Family",
|
||||||
onTap: () {},
|
onTap: () {
|
||||||
|
Navigator.push(context, MaterialPageRoute(
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) => FamilyBloc()
|
||||||
|
..add(GetFamilies(
|
||||||
|
profileId: profileId!, token: token!)),
|
||||||
|
child: const FamilyBackgroundScreen(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
MainMenu(
|
MainMenu(
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:unit2/utils/request.dart';
|
||||||
|
|
||||||
|
import '../../model/profile/family_backround.dart';
|
||||||
|
import '../../utils/urls.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
class FamilyService{
|
||||||
|
static final FamilyService _instance = FamilyService();
|
||||||
|
static FamilyService get instance => _instance;
|
||||||
|
Future< List<FamilyBackground>> getFamilies(int profileId, String token)async{
|
||||||
|
List<FamilyBackground> families = [];
|
||||||
|
String authToken = "Token $token";
|
||||||
|
String path = "${Url.instance.getFamilies()}$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 family){
|
||||||
|
FamilyBackground familyBackground = FamilyBackground.fromJson(family);
|
||||||
|
families.add(familyBackground);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(e){
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
return families;
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,7 +10,6 @@ import 'package:unit2/model/profile/educational_background.dart';
|
||||||
import 'package:unit2/model/profile/eligibility.dart';
|
import 'package:unit2/model/profile/eligibility.dart';
|
||||||
import 'package:unit2/model/profile/family_backround.dart';
|
import 'package:unit2/model/profile/family_backround.dart';
|
||||||
import 'package:unit2/model/profile/learning_development.dart';
|
import 'package:unit2/model/profile/learning_development.dart';
|
||||||
import 'package:unit2/model/profile/other_info.dart';
|
|
||||||
import 'package:unit2/model/profile/other_information/non_acedimic_recognition.dart';
|
import 'package:unit2/model/profile/other_information/non_acedimic_recognition.dart';
|
||||||
import 'package:unit2/model/profile/profileInfomation.dart';
|
import 'package:unit2/model/profile/profileInfomation.dart';
|
||||||
import 'package:unit2/model/profile/references.dart';
|
import 'package:unit2/model/profile/references.dart';
|
||||||
|
|
|
@ -6,8 +6,8 @@ class Url {
|
||||||
// // return '192.168.10.221:3003';
|
// // return '192.168.10.221:3003';
|
||||||
// return 'agusandelnorte.gov.ph';
|
// return 'agusandelnorte.gov.ph';
|
||||||
// return "192.168.10.219:3000";
|
// return "192.168.10.219:3000";
|
||||||
// return "devweb.agusandelnorte.gov.ph";
|
return "devweb.agusandelnorte.gov.ph";
|
||||||
return 'devapi.agusandelnorte.gov.ph:3004';
|
// return 'devapi.agusandelnorte.gov.ph:3004';
|
||||||
}
|
}
|
||||||
|
|
||||||
String authentication() {
|
String authentication() {
|
||||||
|
@ -82,6 +82,11 @@ String getNonAcademicRecognition(){
|
||||||
return "/api/jobnet_app/profile/pds/other/non_acad_recognition/";
|
return "/api/jobnet_app/profile/pds/other/non_acad_recognition/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////family paths
|
||||||
|
String getFamilies(){
|
||||||
|
return "/api/jobnet_app/profile/pds/family/";
|
||||||
|
}
|
||||||
|
|
||||||
// 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