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:equatable/equatable.dart';
import '../../model/location/city.dart';
import '../../model/location/country.dart';
import '../../model/location/provinces.dart';
import '../../model/location/region.dart';
import '../../model/profile/eligibility.dart';
import '../../model/utils/eligibility.dart';
import '../../sevices/profile/eligibility_services.dart';
import '../../utils/location_utilities.dart';
import '../../utils/profile_utilities.dart';
import '../../../model/location/city.dart';
import '../../../model/location/country.dart';
import '../../../model/location/provinces.dart';
import '../../../model/location/region.dart';
import '../../../model/profile/eligibility.dart';
import '../../../model/utils/eligibility.dart';
import '../../../sevices/profile/eligibility_services.dart';
import '../../../utils/location_utilities.dart';
import '../../../utils/profile_utilities.dart';
part 'eligibility_event.dart';
part 'eligibility_state.dart';

View File

@ -2,7 +2,7 @@ import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.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_state.dart';

View File

@ -2,7 +2,7 @@ import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.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_state.dart';

View File

@ -2,7 +2,7 @@ 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';
import '../../../../model/profile/other_information/skills_and_hobbies.dart';
part 'hoobies_event.dart';
part 'hoobies_state.dart';

View File

@ -2,7 +2,8 @@ import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.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_state.dart';

View File

@ -2,7 +2,7 @@ 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';
import '../../../../model/profile/other_information/organization_memberships.dart';
part 'organization_membership_event.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:equatable/equatable.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_state.dart';

View File

@ -1,9 +1,8 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.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_state.dart';

View File

@ -1,4 +1,9 @@
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/theme-data.dart/box_shadow.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/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
import 'package:unit2/widgets/error_state.dart';
class AddressScreen extends StatelessWidget {
final List<MainAdress> addresses;
const AddressScreen({super.key, required this.addresses});
const AddressScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text(adressScreenTitle),centerTitle: true, backgroundColor: primary, actions: [AddLeading(onPressed: (){})],),
body: addresses.isNotEmpty ? ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10),
itemCount: addresses.length,
itemBuilder: (
BuildContext context, int index){
String? subdivision = addresses[index].details??'';
String category = addresses[index].address!.category!.name!;
String? barangay = addresses[index].address!.barangay != null?'${addresses[index].address!.barangay!.description!.toUpperCase()},':'';
String cityMunicipality = addresses[index].address!.cityMunicipality!.description!;
String province = addresses[index].address!.cityMunicipality!.province!.description!;
String region = addresses[index].address!.cityMunicipality!.province!.region!.description!;
return Column(children: [
Column(
children: [
Container(
width: screenWidth,
decoration: box1(),
padding: const EdgeInsets.fromLTRB(8,16,0,16),
child: Row(children: [
Expanded(child: Column(children: [
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 SizedBox(height: 5,),
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 EmptyData(message: "You don't have address added. Please click + to add."),
);
return Scaffold(
appBar: AppBar(
title: const Text(adressScreenTitle),
centerTitle: true,
backgroundColor: primary,
actions: [AddLeading(onPressed: () {})],
),
body: ProgressHUD(
child: BlocBuilder<UserBloc, UserState>(
builder: (context, state) {
if (state is UserLoggedIn) {
return BlocBuilder<ProfileBloc, ProfileState>(
builder: (context, state) {
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(
children: [
Container(
width: screenWidth,
decoration: box1(),
padding:
const EdgeInsets.fromLTRB(
8, 16, 0, 16),
child: Row(children: [
Expanded(
child: Column(
children: [
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 SizedBox(
height: 5,
),
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,
),
],
);
});
} else {
const EmptyData(
message:
"You don't have address added. Please click + to add.");
}
}
return Container();
},
);
}
return Container();
},
);
}
return Container();
},
),
));
}
}
}

View File

@ -44,28 +44,24 @@ class IdentificationsScreen extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
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 SizedBox(height: 5,),
Row(
children: [
Expanded(
child: Text(
"$idNumberText : $idNumber",style: Theme.of(context).textTheme.titleSmall,
),
Expanded(
child: Text(
"$idNumberText : $idNumber",style: Theme.of(context).textTheme.titleSmall,
),
Badge(
backgroundColor: success2,
label: Text(
government ==
true
? privateText.toUpperCase()
:governmentText.toUpperCase(),
style: Theme.of(context).textTheme.bodySmall!.copyWith(color: Colors.white),)),
],
),
Badge(
backgroundColor: success2,
label: Text(
government ==
true
? privateText.toUpperCase()
:governmentText.toUpperCase(),
style: Theme.of(context).textTheme.bodySmall!.copyWith(color: Colors.white),)),
const SizedBox(height: 5,),
Text(issuedAt),
]),

View File

@ -2,7 +2,6 @@ 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/education/education_bloc.dart';
import 'package:unit2/bloc/profile/profile_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/error_state.dart';
import '../../../bloc/profile/education/education_bloc.dart';
class EducationScreen extends StatelessWidget {
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:intl/intl.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/user/user_bloc.dart';
import 'package:unit2/model/profile/eligibility.dart';
import '../../../../bloc/profile/eligibility/eligibility_bloc.dart';
import '../../../../model/location/city.dart';
import '../../../../model/location/country.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:intl/intl.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/user/user_bloc.dart';
import 'package:unit2/model/location/city.dart';
import 'package:unit2/model/profile/eligibility.dart';
import 'package:unit2/model/utils/eligibility.dart';
import 'package:unit2/utils/location_utilities.dart';
import '../../../../bloc/profile/eligibility/eligibility_bloc.dart';
import '../../../../model/location/country.dart';
import '../../../../model/location/region.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_spinkit/flutter_spinkit.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/user/user_bloc.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/close_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
import '../../../bloc/profile/eligibility/eligibility_bloc.dart';
import '../../../utils/alerts.dart';
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_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';
@ -11,6 +10,8 @@ import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/text_container.dart';
import '../../../bloc/profile/family/family_bloc.dart';
class FamilyBackgroundScreen extends StatefulWidget {
const FamilyBackgroundScreen({
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_spinkit/flutter_spinkit.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/user/user_bloc.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/error_state.dart';
import '../../../bloc/profile/learningDevelopment/learning_development_bloc.dart';
class LearningAndDevelopmentScreen extends StatelessWidget {
const LearningAndDevelopmentScreen(

View File

@ -2,7 +2,6 @@ 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/non_academic_recognition.dart/non_academic_recognition_bloc.dart';
import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.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/empty_data.dart';
import '../../../../bloc/profile/other_information/non_academic_recognition.dart/non_academic_recognition_bloc.dart';
class NonAcademicRecognitionScreen extends StatelessWidget {
const NonAcademicRecognitionScreen({
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/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
import '../../../../bloc/org_membership/organization_membership_bloc.dart';
import '../../../../bloc/profile/other_information/org_membership/organization_membership_bloc.dart';
import '../../../../utils/global.dart';
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_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';
@ -14,6 +13,8 @@ import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
import '../../../../bloc/profile/other_information/hobbies/hoobies_bloc.dart';
class SkillHobbiesScreen extends StatelessWidget {
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_spinkit/flutter_spinkit.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/model/profile/references.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/empty_data.dart';
import '../../../bloc/profile/references/references_bloc.dart';
class ReferencesScreen extends StatelessWidget {
const ReferencesScreen({super.key});
@override

View File

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

View File

@ -5,7 +5,6 @@ import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:intl/intl.dart';
import 'package:unit2/bloc/profile/profile_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/theme-data.dart/box_shadow.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/error_state.dart';
import '../../../bloc/profile/workHistory/workHistory_bloc.dart';
import '../../../utils/global.dart';
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/font_awesome5_icons.dart';
import 'package:fluttericon/modern_pictograms_icons.dart';
import 'package:unit2/bloc/education/education_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/primary_information/address/address_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/citizenship_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/voluntary_works_screen.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 'components/main_menu.dart';
import 'components/submenu.dart';
@ -117,12 +117,16 @@ class _ProfileInfoState extends State<ProfileInfo> {
}));
}),
subMenu(Icons.home, "Home Addresses", () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return AddressScreen(
addresses: state.profileInformation
.basicInfo.addresses);
}));
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => AddressBloc()
..add(GetAddress(
addresses: state.profileInformation.basicInfo.addresses)),
child: const AddressScreen(),
);
}));
}),
subMenu(Icons.contact_mail, "Identifications",
() {

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.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/utils/global.dart';
class DashBoard extends StatelessWidget {
final List<Module> roles;
@ -27,9 +29,9 @@ class DashBoard extends StatelessWidget {
style: Theme.of(context)
.textTheme
.labelLarge!
.copyWith(fontSize: 16, fontWeight: FontWeight.w700),
.copyWith(fontSize: 14),
),
const Divider(),
const SizedBox(
height: 8,
),
@ -42,33 +44,38 @@ class DashBoard extends StatelessWidget {
padding: const EdgeInsets.symmetric(
vertical: 5, horizontal: 5),
children: roles[index].roles.map((role) {
return GestureDetector(
onTap: () {
},
child: Column(children: [
Icon(
role.icon,
size: 24,
color: second,
),
const SizedBox(
height: 5,
),
Expanded(
child: Text(
role.role.name!,
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.labelLarge!
.copyWith(
fontSize: 11,
fontWeight: FontWeight.bold),
return Container(
padding: const EdgeInsets.all(8),
decoration:box1(),
child: GestureDetector(
onTap: () {
},
child: Column(children: [
Icon(
role.icon,
size: 24,
color: second,
),
),
]),
const SizedBox(
height: 5,
),
Expanded(
child: Text(
role.role.name!,
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.labelLarge!
.copyWith(
fontSize: blockSizeVertical*1.1,
fontWeight: FontWeight.bold),
),
),
]),
),
);
}).toList()),
const SizedBox(height: 8,)
],
),
);

View File

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

View File

@ -31,20 +31,10 @@ class ProfileService {
String path = url + id.toString();
ProfileInformation? profileInformation0;
PrimaryInformation? primaryInformation;
List<WorkHistory> workExperiences = [];
List<PersonalReference> references = [];
List<MainAdress> addresses = [];
List<Identification> identificationInformation = [];
List<ContactInfo> contactInformation = [];
List<FamilyBackground> families = [];
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 = {
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': "Token $token"