fefactor address and created its own bloc

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
PGAN-MIS 2023-03-07 10:31:28 +08:00
parent 4251002cbf
commit 367402b288
51 changed files with 324 additions and 149 deletions

View File

@ -1,14 +1,14 @@
import 'package:bloc/bloc.dart'; import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import '../../model/location/city.dart'; import '../../../model/location/city.dart';
import '../../model/location/country.dart'; import '../../../model/location/country.dart';
import '../../model/location/provinces.dart'; import '../../../model/location/provinces.dart';
import '../../model/location/region.dart'; import '../../../model/location/region.dart';
import '../../model/profile/eligibility.dart'; import '../../../model/profile/eligibility.dart';
import '../../model/utils/eligibility.dart'; import '../../../model/utils/eligibility.dart';
import '../../sevices/profile/eligibility_services.dart'; import '../../../sevices/profile/eligibility_services.dart';
import '../../utils/location_utilities.dart'; import '../../../utils/location_utilities.dart';
import '../../utils/profile_utilities.dart'; import '../../../utils/profile_utilities.dart';
part 'eligibility_event.dart'; part 'eligibility_event.dart';
part 'eligibility_state.dart'; part 'eligibility_state.dart';

View File

@ -2,7 +2,7 @@ import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:unit2/sevices/profile/family_services.dart'; import 'package:unit2/sevices/profile/family_services.dart';
import '../../model/profile/family_backround.dart'; import '../../../model/profile/family_backround.dart';
part 'family_event.dart'; part 'family_event.dart';
part 'family_state.dart'; part 'family_state.dart';

View File

@ -2,7 +2,7 @@ import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:unit2/sevices/profile/learningDevelopment_service.dart'; import 'package:unit2/sevices/profile/learningDevelopment_service.dart';
import '../../model/profile/learning_development.dart'; import '../../../model/profile/learning_development.dart';
part 'learning_development_event.dart'; part 'learning_development_event.dart';
part 'learning_development_state.dart'; part 'learning_development_state.dart';

View File

@ -2,7 +2,7 @@ import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:unit2/sevices/skillshobbies_services.dart'; import 'package:unit2/sevices/skillshobbies_services.dart';
import '../../model/profile/other_information/skills_and_hobbies.dart'; import '../../../../model/profile/other_information/skills_and_hobbies.dart';
part 'hoobies_event.dart'; part 'hoobies_event.dart';
part 'hoobies_state.dart'; part 'hoobies_state.dart';

View File

@ -2,7 +2,8 @@ import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:unit2/sevices/profile/non_academic_services.dart'; import 'package:unit2/sevices/profile/non_academic_services.dart';
import '../../model/profile/other_information/non_acedimic_recognition.dart'; import '../../../../model/profile/other_information/non_acedimic_recognition.dart';
part 'non_academic_recognition_event.dart'; part 'non_academic_recognition_event.dart';
part 'non_academic_recognition_state.dart'; part 'non_academic_recognition_state.dart';

View File

@ -2,7 +2,7 @@ import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:unit2/sevices/profile/orgmembership_services.dart'; import 'package:unit2/sevices/profile/orgmembership_services.dart';
import '../../model/profile/other_information/organization_memberships.dart'; import '../../../../model/profile/other_information/organization_memberships.dart';
part 'organization_membership_event.dart'; part 'organization_membership_event.dart';
part 'organization_membership_state.dart'; part 'organization_membership_state.dart';

View File

@ -0,0 +1,22 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import '../../../../model/profile/basic_information/adress.dart';
part 'address_event.dart';
part 'address_state.dart';
class AddressBloc extends Bloc<AddressEvent, AddressState> {
AddressBloc() : super(AddressInitial()) {
List<MainAdress> addresses = [];
on<GetAddress>((event, emit) {
emit(AddressLoadingState());
try{
addresses = event.addresses;
emit(AddressLoadedState(addresses: addresses));
}catch(e){
emit(AddressErrorState(message: e.toString()));
}
});
}
}

View File

@ -0,0 +1,15 @@
part of 'address_bloc.dart';
abstract class AddressEvent extends Equatable {
const AddressEvent();
@override
List<Object> get props => [];
}
class GetAddress extends AddressEvent{
final List<MainAdress> addresses;
const GetAddress({required this.addresses});
@override
List<Object> get props => [addresses];
}

View File

@ -0,0 +1,27 @@
part of 'address_bloc.dart';
abstract class AddressState extends Equatable {
const AddressState();
@override
List<Object> get props => [];
}
class AddressInitial extends AddressState {}
class AddressLoadedState extends AddressState{
final List<MainAdress> addresses;
const AddressLoadedState({required this.addresses});
@override
List<Object> get props => [addresses];
}
class AddressErrorState extends AddressState{
final String message;
const AddressErrorState({required this.message});
@override
List<Object> get props => [message];
}
class AddressLoadingState extends AddressState{
}

View File

@ -1,7 +1,7 @@
import 'package:bloc/bloc.dart'; import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:unit2/sevices/profile/references_services.dart'; import 'package:unit2/sevices/profile/references_services.dart';
import '../../model/profile/references.dart'; import '../../../model/profile/references.dart';
part 'references_event.dart'; part 'references_event.dart';
part 'references_state.dart'; part 'references_state.dart';

View File

@ -1,9 +1,8 @@
import 'package:bloc/bloc.dart'; import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:unit2/sevices/profile/volunatary_services.dart'; import 'package:unit2/sevices/profile/volunatary_services.dart';
import 'package:unit2/sevices/profile/work_history_services.dart';
import '../../model/profile/voluntary_works.dart'; import '../../../model/profile/voluntary_works.dart';
part 'voluntary_work_event.dart'; part 'voluntary_work_event.dart';
part 'voluntary_work_state.dart'; part 'voluntary_work_state.dart';

View File

@ -1,4 +1,9 @@
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:unit2/bloc/profile/primary_information/address/address_bloc.dart';
import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/model/profile/basic_information/adress.dart'; import 'package:unit2/model/profile/basic_information/adress.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,52 +11,156 @@ import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart'; import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart'; import 'package:unit2/widgets/empty_data.dart';
import 'package:unit2/widgets/error_state.dart';
class AddressScreen extends StatelessWidget { class AddressScreen extends StatelessWidget {
final List<MainAdress> addresses;
const AddressScreen({super.key, required this.addresses}); const AddressScreen({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text(adressScreenTitle),centerTitle: true, backgroundColor: primary, actions: [AddLeading(onPressed: (){})],), appBar: AppBar(
body: addresses.isNotEmpty ? ListView.builder( title: const Text(adressScreenTitle),
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10), centerTitle: true,
itemCount: addresses.length, backgroundColor: primary,
itemBuilder: ( actions: [AddLeading(onPressed: () {})],
BuildContext context, int index){ ),
String? subdivision = addresses[index].details??''; body: ProgressHUD(
String category = addresses[index].address!.category!.name!; child: BlocBuilder<UserBloc, UserState>(
String? barangay = addresses[index].address!.barangay != null?'${addresses[index].address!.barangay!.description!.toUpperCase()},':''; builder: (context, state) {
String cityMunicipality = addresses[index].address!.cityMunicipality!.description!; if (state is UserLoggedIn) {
String province = addresses[index].address!.cityMunicipality!.province!.description!; return BlocBuilder<ProfileBloc, ProfileState>(
String region = addresses[index].address!.cityMunicipality!.province!.region!.description!; builder: (context, state) {
return Column(children: [ if (state is ProfileLoaded) {
return BlocConsumer<AddressBloc, AddressState>(
listener: (context, state) {
if (state is AddressLoadingState) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is AddressLoadedState ||
state is AddressErrorState) {
final progress = ProgressHUD.of(context);
progress!.dismiss();
}
},
builder: (context, state) {
if (state is AddressLoadedState) {
if (state.addresses.isNotEmpty) {
return ListView.builder(
padding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 10),
itemCount: state.addresses.length,
itemBuilder:
(BuildContext context, int index) {
String? subdivision =
state.addresses[index].details ?? '';
String category = state.addresses[index]
.address!
.category!
.name!;
String? barangay = state.addresses[index]
.address!
.barangay !=
null
? '${state.addresses[index].address!.barangay!.description!.toUpperCase()},'
: '';
String cityMunicipality = state.addresses[index]
.address!
.cityMunicipality!
.description!;
String province = state.addresses[index]
.address!
.cityMunicipality!
.province!
.description!;
String region = state.addresses[index]
.address!
.cityMunicipality!
.province!
.region!
.description!;
return Column(
children: [
Column( Column(
children: [ children: [
Container( Container(
width: screenWidth, width: screenWidth,
decoration: box1(), decoration: box1(),
padding: const EdgeInsets.fromLTRB(8,16,0,16), padding:
const EdgeInsets.fromLTRB(
8, 16, 0, 16),
child: Row(children: [ child: Row(children: [
Expanded(child: Column(children: [ Expanded(
Row(children: [Text(subdivision,style: Theme.of(context).textTheme.titleMedium,), const SizedBox(width: 5,), child: Column(
children: [
Text(category,style: Theme.of(context).textTheme.bodySmall,)],), Row(
children: [
Text(
subdivision,
style:
Theme.of(context)
.textTheme
.titleMedium,
),
const SizedBox(
width: 5,
),
Text(
category,
style:
Theme.of(context)
.textTheme
.bodySmall,
)
],
),
const Divider(), const Divider(),
const SizedBox(height: 5,), const SizedBox(
Text("$barangay $cityMunicipality, $province, $region",style: Theme.of(context).textTheme.labelLarge,), height: 5,
],)), ),
IconButton(onPressed: (){}, icon: const Icon(Icons.more_vert,color: Colors.grey,)) Text(
"$barangay $cityMunicipality, $province, $region",
style: Theme.of(context)
.textTheme
.labelLarge,
),
],
)),
IconButton(
onPressed: () {},
icon: const Icon(
Icons.more_vert,
color: Colors.grey,
))
]), ]),
), ),
], ],
), ),
const SizedBox(height: 5,), const SizedBox(
],); height: 5,
}):const EmptyData(message: "You don't have address added. Please click + to add."), ),
],
);
});
} else {
const EmptyData(
message:
"You don't have address added. Please click + to add.");
}
}
return Container();
},
); );
} }
return Container();
},
);
}
return Container();
},
),
));
}
} }

View File

@ -44,11 +44,9 @@ class IdentificationsScreen extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(agency,style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500)), Expanded(child: Text(agency,style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w400))),
const Divider(), const Divider(),
const SizedBox(height: 5,), const SizedBox(height: 5,),
Row(
children: [
Expanded( Expanded(
child: Text( child: Text(
"$idNumberText : $idNumber",style: Theme.of(context).textTheme.titleSmall, "$idNumberText : $idNumber",style: Theme.of(context).textTheme.titleSmall,
@ -64,8 +62,6 @@ class IdentificationsScreen extends StatelessWidget {
? privateText.toUpperCase() ? privateText.toUpperCase()
:governmentText.toUpperCase(), :governmentText.toUpperCase(),
style: Theme.of(context).textTheme.bodySmall!.copyWith(color: Colors.white),)), style: Theme.of(context).textTheme.bodySmall!.copyWith(color: Colors.white),)),
],
),
const SizedBox(height: 5,), const SizedBox(height: 5,),
Text(issuedAt), Text(issuedAt),
]), ]),

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:unit2/bloc/education/education_bloc.dart';
import 'package:unit2/bloc/profile/profile_bloc.dart'; import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart';
@ -14,6 +13,8 @@ import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart'; import 'package:unit2/widgets/empty_data.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import '../../../bloc/profile/education/education_bloc.dart';
class EducationScreen extends StatelessWidget { class EducationScreen extends StatelessWidget {
const EducationScreen({super.key}); const EducationScreen({super.key});

View File

@ -6,11 +6,11 @@ import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
import 'package:unit2/bloc/eligibility/eligibility_bloc.dart';
import 'package:unit2/bloc/profile/profile_bloc.dart'; import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/model/profile/eligibility.dart'; import 'package:unit2/model/profile/eligibility.dart';
import '../../../../bloc/profile/eligibility/eligibility_bloc.dart';
import '../../../../model/location/city.dart'; import '../../../../model/location/city.dart';
import '../../../../model/location/country.dart'; import '../../../../model/location/country.dart';
import '../../../../model/location/provinces.dart'; import '../../../../model/location/provinces.dart';

View File

@ -4,13 +4,13 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
import 'package:unit2/bloc/eligibility/eligibility_bloc.dart';
import 'package:unit2/bloc/profile/profile_bloc.dart'; import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/model/location/city.dart'; import 'package:unit2/model/location/city.dart';
import 'package:unit2/model/profile/eligibility.dart'; import 'package:unit2/model/profile/eligibility.dart';
import 'package:unit2/model/utils/eligibility.dart'; import 'package:unit2/model/utils/eligibility.dart';
import 'package:unit2/utils/location_utilities.dart'; import 'package:unit2/utils/location_utilities.dart';
import '../../../../bloc/profile/eligibility/eligibility_bloc.dart';
import '../../../../model/location/country.dart'; import '../../../../model/location/country.dart';
import '../../../../model/location/region.dart'; import '../../../../model/location/region.dart';
import '../../../../model/location/provinces.dart'; import '../../../../model/location/provinces.dart';

View File

@ -4,7 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:fluttericon/font_awesome_icons.dart'; import 'package:fluttericon/font_awesome_icons.dart';
import 'package:unit2/bloc/eligibility/eligibility_bloc.dart';
import 'package:unit2/bloc/profile/profile_bloc.dart'; import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/model/profile/eligibility.dart'; import 'package:unit2/model/profile/eligibility.dart';
@ -17,6 +16,7 @@ import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart'; import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/Leadings/close_leading.dart'; import 'package:unit2/widgets/Leadings/close_leading.dart';
import 'package:unit2/widgets/empty_data.dart'; import 'package:unit2/widgets/empty_data.dart';
import '../../../bloc/profile/eligibility/eligibility_bloc.dart';
import '../../../utils/alerts.dart'; import '../../../utils/alerts.dart';
class EligibiltyScreen extends StatelessWidget { class EligibiltyScreen extends StatelessWidget {

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.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/profile/profile_bloc.dart';
import 'package:unit2/bloc/user/user_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';
@ -11,6 +10,8 @@ import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global.dart'; import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import '../../../bloc/profile/family/family_bloc.dart';
class FamilyBackgroundScreen extends StatefulWidget { class FamilyBackgroundScreen extends StatefulWidget {
const FamilyBackgroundScreen({ const FamilyBackgroundScreen({
super.key, super.key,

View File

@ -5,7 +5,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.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/user/user_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/model/profile/learning_development.dart'; import 'package:unit2/model/profile/learning_development.dart';
@ -17,6 +16,8 @@ import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart'; import 'package:unit2/widgets/empty_data.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import '../../../bloc/profile/learningDevelopment/learning_development_bloc.dart';
class LearningAndDevelopmentScreen extends StatelessWidget { class LearningAndDevelopmentScreen extends StatelessWidget {
const LearningAndDevelopmentScreen( const LearningAndDevelopmentScreen(

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:unit2/bloc/non_academic_recognition.dart/non_academic_recognition_bloc.dart';
import 'package:unit2/bloc/profile/profile_bloc.dart'; import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/theme-data.dart/box_shadow.dart'; import 'package:unit2/theme-data.dart/box_shadow.dart';
@ -12,6 +11,8 @@ import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart'; import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart'; import 'package:unit2/widgets/empty_data.dart';
import '../../../../bloc/profile/other_information/non_academic_recognition.dart/non_academic_recognition_bloc.dart';
class NonAcademicRecognitionScreen extends StatelessWidget { class NonAcademicRecognitionScreen extends StatelessWidget {
const NonAcademicRecognitionScreen({ const NonAcademicRecognitionScreen({
super.key, super.key,

View File

@ -10,8 +10,7 @@ import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart'; import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart'; import 'package:unit2/widgets/empty_data.dart';
import '../../../../bloc/profile/other_information/org_membership/organization_membership_bloc.dart';
import '../../../../bloc/org_membership/organization_membership_bloc.dart';
import '../../../../utils/global.dart'; import '../../../../utils/global.dart';
class OrgMembershipsScreen extends StatelessWidget { class OrgMembershipsScreen extends StatelessWidget {

View File

@ -4,7 +4,6 @@ import 'package:flutter/src/widgets/placeholder.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.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/profile/profile_bloc.dart';
import 'package:unit2/bloc/user/user_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';
@ -14,6 +13,8 @@ import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart'; import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart'; import 'package:unit2/widgets/empty_data.dart';
import '../../../../bloc/profile/other_information/hobbies/hoobies_bloc.dart';
class SkillHobbiesScreen extends StatelessWidget { class SkillHobbiesScreen extends StatelessWidget {
const SkillHobbiesScreen({super.key}); const SkillHobbiesScreen({super.key});

View File

@ -5,7 +5,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.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/user/user_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/model/profile/references.dart'; import 'package:unit2/model/profile/references.dart';
import 'package:unit2/theme-data.dart/box_shadow.dart'; import 'package:unit2/theme-data.dart/box_shadow.dart';
@ -14,6 +13,8 @@ import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart'; import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart'; import 'package:unit2/widgets/empty_data.dart';
import '../../../bloc/profile/references/references_bloc.dart';
class ReferencesScreen extends StatelessWidget { class ReferencesScreen extends StatelessWidget {
const ReferencesScreen({super.key}); const ReferencesScreen({super.key});
@override @override

View File

@ -5,13 +5,14 @@ import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:unit2/bloc/profile/profile_bloc.dart'; import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/bloc/voluntary_works/voluntary_work_bloc.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';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart'; import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart'; import 'package:unit2/widgets/empty_data.dart';
import '../../../bloc/profile/voluntary_works/voluntary_work_bloc.dart';
class VolunataryWorkScreen extends StatelessWidget { class VolunataryWorkScreen extends StatelessWidget {
const VolunataryWorkScreen({super.key}); const VolunataryWorkScreen({super.key});

View File

@ -5,7 +5,6 @@ import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:unit2/bloc/profile/profile_bloc.dart'; import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/bloc/workHistory/workHistory_bloc.dart';
import 'package:unit2/model/profile/work_history.dart'; import 'package:unit2/model/profile/work_history.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';
@ -14,6 +13,7 @@ import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart'; import 'package:unit2/widgets/empty_data.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import '../../../bloc/profile/workHistory/workHistory_bloc.dart';
import '../../../utils/global.dart'; import '../../../utils/global.dart';
class WorkHistoryScreen extends StatelessWidget { class WorkHistoryScreen extends StatelessWidget {

View File

@ -8,17 +8,8 @@ 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/education/education_bloc.dart'; import 'package:unit2/bloc/profile/primary_information/address/address_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/learningDevelopment/learning_development_bloc.dart';
import 'package:unit2/bloc/non_academic_recognition.dart/non_academic_recognition_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/voluntary_works/voluntary_work_bloc.dart';
import 'package:unit2/bloc/workHistory/workHistory_bloc.dart';
import 'package:unit2/model/login_data/employee_info/employee_info.dart';
import 'package:unit2/screens/profile/components/basic_information/address_screen.dart'; import 'package:unit2/screens/profile/components/basic_information/address_screen.dart';
import 'package:unit2/screens/profile/components/basic_information/citizenship_screen.dart'; import 'package:unit2/screens/profile/components/basic_information/citizenship_screen.dart';
import 'package:unit2/screens/profile/components/basic_information/contact_information_screen.dart'; import 'package:unit2/screens/profile/components/basic_information/contact_information_screen.dart';
@ -36,7 +27,16 @@ import 'package:unit2/screens/profile/components/references_screen.dart';
import 'package:unit2/screens/profile/components/work_history_screen.dart'; import 'package:unit2/screens/profile/components/work_history_screen.dart';
import 'package:unit2/screens/profile/components/voluntary_works_screen.dart'; import 'package:unit2/screens/profile/components/voluntary_works_screen.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import '../../bloc/org_membership/organization_membership_bloc.dart'; import '../../bloc/profile/eligibility/eligibility_bloc.dart';
import '../../bloc/profile/family/family_bloc.dart';
import '../../bloc/profile/education/education_bloc.dart';
import '../../bloc/profile/learningDevelopment/learning_development_bloc.dart';
import '../../bloc/profile/other_information/hobbies/hoobies_bloc.dart';
import '../../bloc/profile/other_information/non_academic_recognition.dart/non_academic_recognition_bloc.dart';
import '../../bloc/profile/other_information/org_membership/organization_membership_bloc.dart';
import '../../bloc/profile/references/references_bloc.dart';
import '../../bloc/profile/voluntary_works/voluntary_work_bloc.dart';
import '../../bloc/profile/workHistory/workHistory_bloc.dart';
import '../../bloc/user/user_bloc.dart'; import '../../bloc/user/user_bloc.dart';
import 'components/main_menu.dart'; import 'components/main_menu.dart';
import 'components/submenu.dart'; import 'components/submenu.dart';
@ -119,10 +119,14 @@ class _ProfileInfoState extends State<ProfileInfo> {
subMenu(Icons.home, "Home Addresses", () { subMenu(Icons.home, "Home Addresses", () {
Navigator.push(context, MaterialPageRoute( Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) { builder: (BuildContext context) {
return AddressScreen( return BlocProvider(
addresses: state.profileInformation create: (context) => AddressBloc()
.basicInfo.addresses); ..add(GetAddress(
addresses: state.profileInformation.basicInfo.addresses)),
child: const AddressScreen(),
);
})); }));
}), }),
subMenu(Icons.contact_mail, "Identifications", subMenu(Icons.contact_mail, "Identifications",
() { () {

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart'; import 'package:unit2/screens/unit2/homepage.dart/module-screen.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';
import 'package:unit2/utils/global.dart';
class DashBoard extends StatelessWidget { class DashBoard extends StatelessWidget {
final List<Module> roles; final List<Module> roles;
@ -27,9 +29,9 @@ class DashBoard extends StatelessWidget {
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.labelLarge! .labelLarge!
.copyWith(fontSize: 16, fontWeight: FontWeight.w700), .copyWith(fontSize: 14),
), ),
const Divider(),
const SizedBox( const SizedBox(
height: 8, height: 8,
), ),
@ -42,7 +44,10 @@ class DashBoard extends StatelessWidget {
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
vertical: 5, horizontal: 5), vertical: 5, horizontal: 5),
children: roles[index].roles.map((role) { children: roles[index].roles.map((role) {
return GestureDetector( return Container(
padding: const EdgeInsets.all(8),
decoration:box1(),
child: GestureDetector(
onTap: () { onTap: () {
}, },
child: Column(children: [ child: Column(children: [
@ -62,13 +67,15 @@ class DashBoard extends StatelessWidget {
.textTheme .textTheme
.labelLarge! .labelLarge!
.copyWith( .copyWith(
fontSize: 11, fontSize: blockSizeVertical*1.1,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
), ),
]), ]),
),
); );
}).toList()), }).toList()),
const SizedBox(height: 8,)
], ],
), ),
); );

View File

@ -31,10 +31,9 @@ class _MainScreenState extends State<MainScreen> {
}, },
child: BlocBuilder<UserBloc, UserState>(builder: (context, state) { child: BlocBuilder<UserBloc, UserState>(builder: (context, state) {
if (state is UserLoggedIn) { if (state is UserLoggedIn) {
print(state.userData!.user!.login!.token); for (var role in state.userData!.user!.login!.user!.roles!) {
state.userData!.user!.login!.user!.roles!.forEach((role) {
Role? getRole = role; Role? getRole = role;
role!.modules!.forEach((module) { for (var module in role!.modules!) {
if (module!.name!.toLowerCase() == 'unit2') { if (module!.name!.toLowerCase() == 'unit2') {
IconData iconData = iconGenerator(getRole!.name!); IconData iconData = iconGenerator(getRole!.name!);
Roles newRole = Roles(role: getRole, icon: iconData); Roles newRole = Roles(role: getRole, icon: iconData);
@ -45,8 +44,8 @@ class _MainScreenState extends State<MainScreen> {
Roles newRole = Roles(role: getRole, icon: iconData); Roles newRole = Roles(role: getRole, icon: iconData);
roles[1].roles.add(newRole); roles[1].roles.add(newRole);
} }
}); }
}); }
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
backgroundColor: primary, backgroundColor: primary,

View File

@ -31,20 +31,10 @@ class ProfileService {
String path = url + id.toString(); String path = url + id.toString();
ProfileInformation? profileInformation0; ProfileInformation? profileInformation0;
PrimaryInformation? primaryInformation; PrimaryInformation? primaryInformation;
List<WorkHistory> workExperiences = [];
List<PersonalReference> references = [];
List<MainAdress> addresses = []; List<MainAdress> addresses = [];
List<Identification> identificationInformation = []; List<Identification> identificationInformation = [];
List<ContactInfo> contactInformation = []; List<ContactInfo> contactInformation = [];
List<FamilyBackground> families = [];
List<Citizenship> citizenships = []; List<Citizenship> citizenships = [];
List<LearningDevelopement> learningsDevelopments = [];
List<EducationalBackground> educationalBackgrounds = [];
List<VoluntaryWork> voluntaryWorks = [];
List<SkillsHobbies> skillsHobbies = [];
List<OrganizationMembership> orgMemberships = [];
List<NonAcademicRecognition> nonAcademicRecognitions = [];
Map<String, String> headers = { Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
'Authorization': "Token $token" 'Authorization': "Token $token"