fix bugs for profile and final test in live
parent
e7d6cb8133
commit
4a5d6afcbc
|
@ -241,11 +241,11 @@ class EducationBloc extends Bloc<EducationEvent, EducationState> {
|
||||||
final result = await Share.shareXFiles(
|
final result = await Share.shareXFiles(
|
||||||
[XFile("$appDocumentPath/${event.fileName}")]);
|
[XFile("$appDocumentPath/${event.fileName}")]);
|
||||||
if (result.status == ShareResultStatus.success) {
|
if (result.status == ShareResultStatus.success) {
|
||||||
Fluttertoast.showToast(msg: "Attachment shared successfully");
|
Fluttertoast.showToast(msg: "Attachment shared successful");
|
||||||
emit(EducationAttachmentViewState(
|
emit(EducationAttachmentViewState(
|
||||||
fileUrl: event.source, fileName: event.fileName));
|
fileUrl: event.source, fileName: event.fileName));
|
||||||
} else {
|
} else {
|
||||||
Fluttertoast.showToast(msg: "Attachment shared unsuccessfully");
|
Fluttertoast.showToast(msg: "Attachment shared unsuccessful");
|
||||||
emit(EducationAttachmentViewState(
|
emit(EducationAttachmentViewState(
|
||||||
fileUrl: event.source, fileName: event.fileName));
|
fileUrl: event.source, fileName: event.fileName));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
import 'package:unit2/screens/profile/components/eligibility/eligibility_view_attachment.dart';
|
||||||
import 'package:unit2/utils/attachment_services.dart';
|
import 'package:unit2/utils/attachment_services.dart';
|
||||||
import '../../../model/location/city.dart';
|
import '../../../model/location/city.dart';
|
||||||
import '../../../model/location/country.dart';
|
import '../../../model/location/country.dart';
|
||||||
|
@ -11,6 +18,7 @@ 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';
|
||||||
|
import '../../../utils/request_permission.dart';
|
||||||
import '../../../utils/urls.dart';
|
import '../../../utils/urls.dart';
|
||||||
part 'eligibility_event.dart';
|
part 'eligibility_event.dart';
|
||||||
part 'eligibility_state.dart';
|
part 'eligibility_state.dart';
|
||||||
|
@ -283,7 +291,40 @@ class EligibilityBloc extends Bloc<EligibilityEvent, EligibilityState> {
|
||||||
});
|
});
|
||||||
on<EligibiltyViewAttachmentEvent>((event,emit){
|
on<EligibiltyViewAttachmentEvent>((event,emit){
|
||||||
String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}';
|
String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}';
|
||||||
emit(EligibilityAttachmentViewState(fileUrl: fileUrl));
|
emit(EligibilityAttachmentViewState(fileUrl: fileUrl,fileName: event.filename));
|
||||||
|
});
|
||||||
|
on<ShareAttachment>((event, emit) async {
|
||||||
|
emit(EligibilityLoadingState());
|
||||||
|
Directory directory;
|
||||||
|
String? appDocumentPath;
|
||||||
|
if (await requestPermission(Permission.storage)) {
|
||||||
|
directory = await getApplicationDocumentsDirectory();
|
||||||
|
appDocumentPath = directory.path;
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
final bool success = await AttachmentServices.instance.downloadAttachment(
|
||||||
|
filename: event.fileName,
|
||||||
|
source: event.source,
|
||||||
|
downLoadDir: appDocumentPath!);
|
||||||
|
if (success) {
|
||||||
|
final result = await Share.shareXFiles(
|
||||||
|
[XFile("$appDocumentPath/${event.fileName}")]);
|
||||||
|
if (result.status == ShareResultStatus.success) {
|
||||||
|
Fluttertoast.showToast(msg: "Attachment shared successful");
|
||||||
|
emit(EligibilityAttachmentViewState(
|
||||||
|
fileUrl: event.source, fileName: event.fileName));
|
||||||
|
} else {
|
||||||
|
Fluttertoast.showToast(msg: "Attachment shared unsuccessful");
|
||||||
|
emit(EligibilityAttachmentViewState(
|
||||||
|
fileUrl: event.source, fileName: event.fileName));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
emit(EligibilityAttachmentViewState(
|
||||||
|
fileUrl: event.source, fileName: event.fileName));
|
||||||
|
}
|
||||||
|
}catch(e){
|
||||||
|
emit(EligibilityErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,13 +103,15 @@ class DeleteEligibyAttachment extends EligibilityEvent {
|
||||||
required this.token});
|
required this.token});
|
||||||
}
|
}
|
||||||
|
|
||||||
class EligibilityViewAttachments extends EligibilityEvent {
|
|
||||||
final String source;
|
|
||||||
const EligibilityViewAttachments({required this.source});
|
|
||||||
}
|
|
||||||
|
|
||||||
class EligibiltyViewAttachmentEvent extends EligibilityEvent{
|
class EligibiltyViewAttachmentEvent extends EligibilityEvent{
|
||||||
final String source;
|
final String source;
|
||||||
const EligibiltyViewAttachmentEvent({required this.source});
|
final String filename;
|
||||||
|
const EligibiltyViewAttachmentEvent({required this.source, required this.filename});
|
||||||
|
}
|
||||||
|
class ShareAttachment extends EligibilityEvent{
|
||||||
|
final String fileName;
|
||||||
|
final String source;
|
||||||
|
const ShareAttachment({required this.fileName, required this.source});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,12 @@ class EligibilitytAttachmentDeletedState extends EligibilityState {
|
||||||
}
|
}
|
||||||
|
|
||||||
class EligibilityAttachmentViewState extends EligibilityState {
|
class EligibilityAttachmentViewState extends EligibilityState {
|
||||||
|
final String fileName;
|
||||||
final String fileUrl;
|
final String fileUrl;
|
||||||
const EligibilityAttachmentViewState({required this.fileUrl});
|
const EligibilityAttachmentViewState({required this.fileUrl, required this.fileName});
|
||||||
}
|
}
|
||||||
|
class EligibilityAttachmentShareState extends EligibilityState{
|
||||||
|
final bool success;
|
||||||
|
const EligibilityAttachmentShareState({required this.success,});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:share_plus/share_plus.dart';
|
||||||
import 'package:unit2/model/location/country.dart';
|
import 'package:unit2/model/location/country.dart';
|
||||||
import 'package:unit2/model/location/region.dart';
|
import 'package:unit2/model/location/region.dart';
|
||||||
import 'package:unit2/sevices/profile/learningDevelopment_service.dart';
|
import 'package:unit2/sevices/profile/learningDevelopment_service.dart';
|
||||||
|
@ -13,6 +19,7 @@ import '../../../model/utils/category.dart';
|
||||||
import '../../../utils/attachment_services.dart';
|
import '../../../utils/attachment_services.dart';
|
||||||
import '../../../utils/location_utilities.dart';
|
import '../../../utils/location_utilities.dart';
|
||||||
import '../../../utils/profile_utilities.dart';
|
import '../../../utils/profile_utilities.dart';
|
||||||
|
import '../../../utils/request_permission.dart';
|
||||||
import '../../../utils/urls.dart';
|
import '../../../utils/urls.dart';
|
||||||
part 'learning_development_event.dart';
|
part 'learning_development_event.dart';
|
||||||
part 'learning_development_state.dart';
|
part 'learning_development_state.dart';
|
||||||
|
@ -328,7 +335,40 @@ class LearningDevelopmentBloc
|
||||||
});
|
});
|
||||||
on<LearningDevelopmentViewAttachmentEvent>((event,emit){
|
on<LearningDevelopmentViewAttachmentEvent>((event,emit){
|
||||||
String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}';
|
String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}';
|
||||||
emit(LearningAndDevelopmentAttachmentViewState(fileUrl: fileUrl));
|
emit(LearningAndDevelopmentAttachmentViewState(fileUrl: fileUrl, filename: event.filename));
|
||||||
|
});
|
||||||
|
on<ShareAttachment>((event, emit) async {
|
||||||
|
emit(LearningDevelopmentLoadingState());
|
||||||
|
Directory directory;
|
||||||
|
String? appDocumentPath;
|
||||||
|
if (await requestPermission(Permission.storage)) {
|
||||||
|
directory = await getApplicationDocumentsDirectory();
|
||||||
|
appDocumentPath = directory.path;
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
final bool success = await AttachmentServices.instance.downloadAttachment(
|
||||||
|
filename: event.fileName,
|
||||||
|
source: event.source,
|
||||||
|
downLoadDir: appDocumentPath!);
|
||||||
|
if (success) {
|
||||||
|
final result = await Share.shareXFiles(
|
||||||
|
[XFile("$appDocumentPath/${event.fileName}")]);
|
||||||
|
if (result.status == ShareResultStatus.success) {
|
||||||
|
Fluttertoast.showToast(msg: "Attachment shared successful");
|
||||||
|
emit(LearningAndDevelopmentAttachmentViewState(
|
||||||
|
fileUrl: event.source, filename: event.fileName));
|
||||||
|
} else {
|
||||||
|
Fluttertoast.showToast(msg: "Attachment shared unsuccessful");
|
||||||
|
emit(LearningAndDevelopmentAttachmentViewState(
|
||||||
|
fileUrl: event.source, filename: event.fileName));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
emit(LearningAndDevelopmentAttachmentViewState(
|
||||||
|
fileUrl: event.source, filename: event.fileName));
|
||||||
|
}
|
||||||
|
}catch(e){
|
||||||
|
emit(LearningDevelopmentErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,15 @@ class DeleteLearningDevAttachment extends LearningDevelopmentEvent{
|
||||||
}
|
}
|
||||||
|
|
||||||
class LearningDevelopmentViewAttachmentEvent extends LearningDevelopmentEvent{
|
class LearningDevelopmentViewAttachmentEvent extends LearningDevelopmentEvent{
|
||||||
|
final String filename;
|
||||||
final String source;
|
final String source;
|
||||||
const LearningDevelopmentViewAttachmentEvent({required this.source});
|
const LearningDevelopmentViewAttachmentEvent({required this.source, required this.filename});
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShareAttachment extends LearningDevelopmentEvent{
|
||||||
|
final String fileName;
|
||||||
|
final String source;
|
||||||
|
const ShareAttachment({required this.fileName, required this.source});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,11 @@ class LearningDevAttachmentDeletedState extends LearningDevelopmentState {
|
||||||
|
|
||||||
|
|
||||||
class LearningAndDevelopmentAttachmentViewState extends LearningDevelopmentState {
|
class LearningAndDevelopmentAttachmentViewState extends LearningDevelopmentState {
|
||||||
|
final String filename;
|
||||||
final String fileUrl;
|
final String fileUrl;
|
||||||
const LearningAndDevelopmentAttachmentViewState({required this.fileUrl});
|
const LearningAndDevelopmentAttachmentViewState({required this.fileUrl, required this.filename});
|
||||||
}
|
}
|
||||||
|
class LearningDevelopmentAttachmentShareState extends LearningDevelopmentState{
|
||||||
|
final bool success;
|
||||||
|
const LearningDevelopmentAttachmentShareState({required this.success,});
|
||||||
|
}
|
||||||
|
|
|
@ -46,24 +46,25 @@ class ContactBloc extends Bloc<ContactEvent, ContactState> {
|
||||||
ServiceType serviceType;
|
ServiceType serviceType;
|
||||||
List<CommService> commServiceProvivers;
|
List<CommService> commServiceProvivers;
|
||||||
CommService serviceProvider;
|
CommService serviceProvider;
|
||||||
try{
|
try {
|
||||||
if (serviceTypes.isEmpty) {
|
if (serviceTypes.isEmpty) {
|
||||||
serviceTypes = await ProfileUtilities.instance.getServiceType();
|
serviceTypes = await ProfileUtilities.instance.getServiceType();
|
||||||
}
|
}
|
||||||
serviceType = serviceTypes.firstWhere((ServiceType element) {
|
serviceType = serviceTypes.firstWhere((ServiceType element) {
|
||||||
return element.id == event.contactInfo.commService!.serviceType!.id;
|
return element.id == event.contactInfo.commService!.serviceType!.id;
|
||||||
});
|
});
|
||||||
commServiceProvivers = await ContactService.instance
|
commServiceProvivers = await ContactService.instance
|
||||||
.getServiceProvider(serviceTypeId: serviceType.id!);
|
.getServiceProvider(serviceTypeId: serviceType.id!);
|
||||||
serviceProvider = commServiceProvivers.firstWhere((CommService element) =>
|
serviceProvider = commServiceProvivers.firstWhere(
|
||||||
element.id == event.contactInfo.commService!.id);
|
(CommService element) =>
|
||||||
emit(ContactEditingState(
|
element.id == event.contactInfo.commService!.id);
|
||||||
serviceTypes: serviceTypes,
|
emit(ContactEditingState(
|
||||||
selectedServiceType: serviceType,
|
serviceTypes: serviceTypes,
|
||||||
commServiceProviders: commServiceProvivers,
|
selectedServiceType: serviceType,
|
||||||
selectedProvider: serviceProvider,
|
commServiceProviders: commServiceProvivers,
|
||||||
contactInfo: event.contactInfo));
|
selectedProvider: serviceProvider,
|
||||||
}catch(e){
|
contactInfo: event.contactInfo));
|
||||||
|
} catch (e) {
|
||||||
emit(ContactErrorState(message: e.toString()));
|
emit(ContactErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -81,18 +82,17 @@ class ContactBloc extends Bloc<ContactEvent, ContactState> {
|
||||||
contactInformations.removeWhere(
|
contactInformations.removeWhere(
|
||||||
(ContactInfo element) => element.id == event.contactInfo.id);
|
(ContactInfo element) => element.id == event.contactInfo.id);
|
||||||
contactInformations.add(contactInfo);
|
contactInformations.add(contactInfo);
|
||||||
emit(ContactEditedState(
|
emit(ContactEditedState(response: responseStatus));
|
||||||
|
|
||||||
response: responseStatus));
|
|
||||||
} else {
|
} else {
|
||||||
emit(ContactEditedState(
|
emit(ContactEditedState(response: responseStatus));
|
||||||
|
|
||||||
response: responseStatus));
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(ContactErrorState(message: e.toString()));
|
emit(ContactErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
on<CallErrorEvent>((event, emit) {
|
||||||
|
emit(ContactErrorState(message: event.message));
|
||||||
|
});
|
||||||
|
|
||||||
//// add contact
|
//// add contact
|
||||||
|
|
||||||
|
@ -107,13 +107,9 @@ class ContactBloc extends Bloc<ContactEvent, ContactState> {
|
||||||
ContactInfo contactInfo =
|
ContactInfo contactInfo =
|
||||||
ContactInfo.fromJson(responseStatus['data']['contact_info']);
|
ContactInfo.fromJson(responseStatus['data']['contact_info']);
|
||||||
contactInformations.add(contactInfo);
|
contactInformations.add(contactInfo);
|
||||||
emit(ContactAddedState(
|
emit(ContactAddedState(response: responseStatus));
|
||||||
|
|
||||||
response: responseStatus));
|
|
||||||
} else {
|
} else {
|
||||||
emit(ContactAddedState(
|
emit(ContactAddedState(response: responseStatus));
|
||||||
|
|
||||||
response: responseStatus));
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(ContactErrorState(message: e.toString()));
|
emit(ContactErrorState(message: e.toString()));
|
||||||
|
@ -129,11 +125,9 @@ class ContactBloc extends Bloc<ContactEvent, ContactState> {
|
||||||
if (success) {
|
if (success) {
|
||||||
contactInformations
|
contactInformations
|
||||||
.removeWhere((element) => element.id == event.contactInfo.id);
|
.removeWhere((element) => element.id == event.contactInfo.id);
|
||||||
emit(ContactDeletedState(
|
emit(ContactDeletedState(succcess: success));
|
||||||
succcess: success));
|
|
||||||
} else {
|
} else {
|
||||||
emit(ContactDeletedState(
|
emit(ContactDeletedState(succcess: success));
|
||||||
succcess: success));
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(ContactErrorState(message: e.toString()));
|
emit(ContactErrorState(message: e.toString()));
|
||||||
|
|
|
@ -8,63 +8,71 @@ abstract class ContactEvent extends Equatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
////get contacts
|
////get contacts
|
||||||
class GetContacts extends ContactEvent{
|
class GetContacts extends ContactEvent {
|
||||||
final List<ContactInfo> contactInformations;
|
final List<ContactInfo> contactInformations;
|
||||||
const GetContacts({required this.contactInformations});
|
const GetContacts({required this.contactInformations});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
|
||||||
//// load contacts
|
//// load contacts
|
||||||
class LoadContacts extends ContactEvent{
|
class LoadContacts extends ContactEvent {
|
||||||
|
@override
|
||||||
@override
|
|
||||||
List<Object> get props => [];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
|
||||||
//// show add form
|
//// show add form
|
||||||
class ShowAddForm extends ContactEvent{
|
class ShowAddForm extends ContactEvent {}
|
||||||
|
|
||||||
|
class CallErrorEvent extends ContactEvent {
|
||||||
|
final String message;
|
||||||
|
const CallErrorEvent({required this.message});
|
||||||
}
|
}
|
||||||
|
|
||||||
//// show edit form
|
//// show edit form
|
||||||
class ShowEditForm extends ContactEvent{
|
class ShowEditForm extends ContactEvent {
|
||||||
final ContactInfo contactInfo;
|
final ContactInfo contactInfo;
|
||||||
const ShowEditForm({required this.contactInfo});
|
const ShowEditForm({required this.contactInfo});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [contactInfo];
|
List<Object> get props => [contactInfo];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////add event
|
////add event
|
||||||
class AddContactInformation extends ContactEvent{
|
class AddContactInformation extends ContactEvent {
|
||||||
final int profileId;
|
final int profileId;
|
||||||
final String token;
|
final String token;
|
||||||
final ContactInfo contactInfo;
|
final ContactInfo contactInfo;
|
||||||
const AddContactInformation({required this.contactInfo, required this.profileId, required this.token});
|
const AddContactInformation(
|
||||||
@override
|
{required this.contactInfo,
|
||||||
List<Object> get props => [profileId,token,contactInfo];
|
required this.profileId,
|
||||||
|
required this.token});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [profileId, token, contactInfo];
|
||||||
}
|
}
|
||||||
|
|
||||||
////edit event
|
////edit event
|
||||||
class EditContactInformation extends ContactEvent{
|
class EditContactInformation extends ContactEvent {
|
||||||
final int profileId;
|
final int profileId;
|
||||||
final String token;
|
final String token;
|
||||||
final ContactInfo contactInfo;
|
final ContactInfo contactInfo;
|
||||||
const EditContactInformation({required this.contactInfo, required this.profileId, required this.token});
|
const EditContactInformation(
|
||||||
@override
|
{required this.contactInfo,
|
||||||
List<Object> get props => [profileId,token,contactInfo];
|
required this.profileId,
|
||||||
|
required this.token});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [profileId, token, contactInfo];
|
||||||
}
|
}
|
||||||
|
|
||||||
//// delete event
|
//// delete event
|
||||||
|
|
||||||
class DeleteContactInformation extends ContactEvent{
|
class DeleteContactInformation extends ContactEvent {
|
||||||
final int profileId;
|
final int profileId;
|
||||||
final String token;
|
final String token;
|
||||||
final ContactInfo contactInfo;
|
final ContactInfo contactInfo;
|
||||||
const DeleteContactInformation({required this.contactInfo, required this.profileId, required this.token});
|
const DeleteContactInformation(
|
||||||
@override
|
{required this.contactInfo,
|
||||||
List<Object> get props => [profileId,token,contactInfo];
|
required this.profileId,
|
||||||
|
required this.token});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [profileId, token, contactInfo];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ class WorkHistoryBloc extends Bloc<WorkHistorytEvent, WorkHistoryState> {
|
||||||
});
|
});
|
||||||
//// ADD WORK HISTORIES
|
//// ADD WORK HISTORIES
|
||||||
on<AddWorkHostory>((event, emit) async {
|
on<AddWorkHostory>((event, emit) async {
|
||||||
// try {
|
try {
|
||||||
Map<dynamic, dynamic> status = await WorkHistoryService.instance.add(
|
Map<dynamic, dynamic> status = await WorkHistoryService.instance.add(
|
||||||
accomplishment: event.accomplishment,
|
accomplishment: event.accomplishment,
|
||||||
actualDuties: event.actualDuties,
|
actualDuties: event.actualDuties,
|
||||||
|
@ -83,36 +83,36 @@ class WorkHistoryBloc extends Bloc<WorkHistorytEvent, WorkHistoryState> {
|
||||||
} else {
|
} else {
|
||||||
emit(WorkHistoryAddedState(response: status));
|
emit(WorkHistoryAddedState(response: status));
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(WorkHistoryErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
////UPDATE WORK HISTORY
|
||||||
|
on<UpdateWorkHistory>((event, emit) async {
|
||||||
|
// try {
|
||||||
|
Map<dynamic, dynamic> status = await WorkHistoryService.instance.update(
|
||||||
|
isPrivate: event.isPrivate,
|
||||||
|
workHistory: event.workHistory,
|
||||||
|
token: event.token,
|
||||||
|
profileId: event.profileId);
|
||||||
|
if (status['success']) {
|
||||||
|
WorkHistory workHistory = WorkHistory.fromJson(status['data']);
|
||||||
|
// workExperiences.removeWhere((WorkHistory work) {
|
||||||
|
// return work.id == event.workHistory.id;
|
||||||
|
// });
|
||||||
|
workExperiences.add(workHistory);
|
||||||
|
emit(WorkHistoryEditedState(response: status));
|
||||||
|
} else {
|
||||||
|
emit(WorkHistoryEditedState(
|
||||||
|
response: status,
|
||||||
|
));
|
||||||
|
}
|
||||||
// } catch (e) {
|
// } catch (e) {
|
||||||
// emit(WorkHistoryErrorState(message: e.toString()));
|
// emit(WorkHistoryErrorState(message: e.toString()));
|
||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
////UPDATE WORK HISTORY
|
|
||||||
// on<UpdateWorkHistory>((event, emit) async {
|
|
||||||
// try {
|
|
||||||
// Map<dynamic, dynamic> status = await WorkHistoryService.instance.update(
|
|
||||||
// oldWorkHistory: event.oldWorkHistory,
|
|
||||||
// newWorkHistory: event.workHistory,
|
|
||||||
// token: event.token,
|
|
||||||
// profileId: event.profileId);
|
|
||||||
// if (status['success']) {
|
|
||||||
// WorkHistory workHistory = WorkHistory.fromJson(status['data']);
|
|
||||||
// workExperiences.removeWhere((WorkHistory work) {
|
|
||||||
// return work.id == event.oldWorkHistory.id;
|
|
||||||
// });
|
|
||||||
// workExperiences.add(workHistory);
|
|
||||||
// emit(WorkHistoryEditedState(response: status));
|
|
||||||
// } else {
|
|
||||||
// emit(WorkHistoryEditedState(
|
|
||||||
// response: status,
|
|
||||||
// ));
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// emit(WorkHistoryErrorState(message: e.toString()));
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
////SHOW EDIT WORK HISTORIES
|
////SHOW EDIT WORK HISTORIES
|
||||||
on<ShowEditWorkHistoryForm>((event, emit) async {
|
on<ShowEditWorkHistoryForm>((event, emit) async {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -46,9 +46,8 @@ class UpdateWorkHistory extends WorkHistorytEvent{
|
||||||
final bool isPrivate;
|
final bool isPrivate;
|
||||||
final int profileId;
|
final int profileId;
|
||||||
final String token;
|
final String token;
|
||||||
final String? actualDuties;
|
|
||||||
final String? accomplishment;
|
const UpdateWorkHistory({required this.profileId, required this.token, required this.workHistory, required this.isPrivate});
|
||||||
const UpdateWorkHistory({required this.profileId, required this.token, required this.workHistory, required this.accomplishment, required this.actualDuties, required this.isPrivate});
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [profileId,token,workHistory,];
|
List<Object> get props => [profileId,token,workHistory,];
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,348 +77,341 @@ class _AddAddressScreenState extends State<AddAddressScreen> {
|
||||||
const EdgeInsets.symmetric(vertical: 32, horizontal: 24),
|
const EdgeInsets.symmetric(vertical: 32, horizontal: 24),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: screenHeight * 88,
|
height: screenHeight * 88,
|
||||||
child: Column(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
FormBuilderDropdown(
|
||||||
child: ListView(
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Category*", "Category"),
|
||||||
|
name: "category",
|
||||||
|
onChanged: (AddressCategory? category) {
|
||||||
|
selectedAddressCategory = category;
|
||||||
|
},
|
||||||
|
items: category
|
||||||
|
.map<DropdownMenuItem<AddressCategory>>(
|
||||||
|
(AddressCategory category) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: category, child: Text(category.name!));
|
||||||
|
}).toList()),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////Area Class
|
||||||
|
FormBuilderDropdown(
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Area class *", "Area class"),
|
||||||
|
name: "area_class",
|
||||||
|
onChanged: (Area? area) {
|
||||||
|
selectedAreaClass = area!.value;
|
||||||
|
},
|
||||||
|
items: areaClass
|
||||||
|
.map<DropdownMenuItem<Area>>((Area area) {
|
||||||
|
return area.group == 0
|
||||||
|
? DropdownMenuItem(
|
||||||
|
enabled: false,
|
||||||
|
value: area,
|
||||||
|
child: Text(area.value.toUpperCase(),
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black38)))
|
||||||
|
: DropdownMenuItem(
|
||||||
|
value: area,
|
||||||
|
enabled: true,
|
||||||
|
child: Text(
|
||||||
|
" ${area.value.toUpperCase()}"));
|
||||||
|
}).toList()),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////stateful builder
|
||||||
|
StatefulBuilder(builder: (context, setState) {
|
||||||
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
//// category
|
////with block & Lot Switch
|
||||||
FormBuilderDropdown(
|
FormBuilderSwitch(
|
||||||
validator: FormBuilderValidators.required(
|
initialValue: hasLotandBlock,
|
||||||
errorText: "This field is required"),
|
activeColor: second,
|
||||||
decoration:
|
onChanged: (value) {
|
||||||
normalTextFieldStyle("Category*", "Category"),
|
setState(() {
|
||||||
name: "category",
|
hasLotandBlock = value!;
|
||||||
onChanged: (AddressCategory? category) {
|
});
|
||||||
selectedAddressCategory = category;
|
},
|
||||||
},
|
|
||||||
items: category
|
|
||||||
.map<DropdownMenuItem<AddressCategory>>(
|
|
||||||
(AddressCategory category) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: category, child: Text(category.name!));
|
|
||||||
}).toList()),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
////Area Class
|
|
||||||
FormBuilderDropdown(
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Area class *", "Area class"),
|
|
||||||
name: "area_class",
|
|
||||||
onChanged: (Area? area) {
|
|
||||||
selectedAreaClass = area!.value;
|
|
||||||
},
|
|
||||||
items: areaClass
|
|
||||||
.map<DropdownMenuItem<Area>>((Area area) {
|
|
||||||
return area.group == 0
|
|
||||||
? DropdownMenuItem(
|
|
||||||
enabled: false,
|
|
||||||
value: area,
|
|
||||||
child: Text(area.value.toUpperCase(),
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.black38)))
|
|
||||||
: DropdownMenuItem(
|
|
||||||
value: area,
|
|
||||||
enabled: true,
|
|
||||||
child: Text(
|
|
||||||
" ${area.value.toUpperCase()}"));
|
|
||||||
}).toList()),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
////stateful builder
|
|
||||||
StatefulBuilder(builder: (context, setState) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
////with block & Lot Switch
|
|
||||||
FormBuilderSwitch(
|
|
||||||
initialValue: hasLotandBlock,
|
|
||||||
activeColor: second,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
hasLotandBlock = value!;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"With Lot and Block?", 'Graduated?'),
|
|
||||||
name: 'graudated',
|
|
||||||
title: Text(hasLotandBlock ? "YES" : "NO"),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: hasLotandBlock ? 12 : 0,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: screenWidth,
|
|
||||||
child: hasLotandBlock
|
|
||||||
? Row(
|
|
||||||
children: [
|
|
||||||
////block #
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.compose([numericRequired]),
|
|
||||||
keyboardType:
|
|
||||||
TextInputType.number,
|
|
||||||
name: "block_number",
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Block #*", "Block #"),
|
|
||||||
)),
|
|
||||||
const SizedBox(
|
|
||||||
width: 8,
|
|
||||||
),
|
|
||||||
//// lot #
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.compose([numericRequired]),
|
|
||||||
name: "lot_number",
|
|
||||||
keyboardType:
|
|
||||||
TextInputType.number,
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Lot #*", "Lot #"),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: Container(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
//// Address Line
|
|
||||||
FormBuilderTextField(
|
|
||||||
name: "address_line",
|
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"Address Line ", "Address Line"),
|
"With Lot and Block?", 'Graduated?'),
|
||||||
|
name: 'graudated',
|
||||||
|
title: Text(hasLotandBlock ? "YES" : "NO"),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
SizedBox(
|
||||||
height: 12,
|
height: hasLotandBlock ? 12 : 0,
|
||||||
),
|
),
|
||||||
StatefulBuilder(builder: (context, setState) {
|
SizedBox(
|
||||||
return Column(
|
width: screenWidth,
|
||||||
children: [
|
child: hasLotandBlock
|
||||||
FormBuilderSwitch(
|
? Row(
|
||||||
initialValue: overseas,
|
children: [
|
||||||
activeColor: second,
|
////block #
|
||||||
onChanged: (value) {
|
Flexible(
|
||||||
setState(() {
|
flex: 1,
|
||||||
overseas = value!;
|
child: FormBuilderTextField(
|
||||||
});
|
validator: FormBuilderValidators
|
||||||
},
|
.compose([numericRequired]),
|
||||||
decoration: normalTextFieldStyle(
|
keyboardType:
|
||||||
"Overseas Address?", ''),
|
TextInputType.number,
|
||||||
name: 'overseas',
|
name: "block_number",
|
||||||
title: Text(overseas ? "YES" : "NO"),
|
decoration:
|
||||||
),
|
normalTextFieldStyle(
|
||||||
SizedBox(
|
"Block #*", "Block #"),
|
||||||
height: overseas == true ? 8 : 0,
|
)),
|
||||||
),
|
const SizedBox(
|
||||||
SizedBox(
|
width: 8,
|
||||||
child: overseas == false
|
),
|
||||||
? Column(
|
//// lot #
|
||||||
children: [
|
Flexible(
|
||||||
const SizedBox(
|
flex: 1,
|
||||||
height: 12,
|
child: FormBuilderTextField(
|
||||||
),
|
validator: FormBuilderValidators
|
||||||
////REGION DROPDOWN
|
.compose([numericRequired]),
|
||||||
FormBuilderDropdown<Region?>(
|
name: "lot_number",
|
||||||
autovalidateMode: AutovalidateMode
|
keyboardType:
|
||||||
.onUserInteraction,
|
TextInputType.number,
|
||||||
validator:
|
decoration:
|
||||||
FormBuilderValidators.required(
|
normalTextFieldStyle(
|
||||||
errorText:
|
"Lot #*", "Lot #"),
|
||||||
"This field is required"),
|
)),
|
||||||
onChanged: (Region? region) async {
|
],
|
||||||
if (selectedRegion != region) {
|
)
|
||||||
|
: Container(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
//// Address Line
|
||||||
|
FormBuilderTextField(
|
||||||
|
name: "address_line",
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Address Line ", "Address Line"),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
StatefulBuilder(builder: (context, setState) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
FormBuilderSwitch(
|
||||||
|
initialValue: overseas,
|
||||||
|
activeColor: second,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
overseas = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Overseas Address?", ''),
|
||||||
|
name: 'overseas',
|
||||||
|
title: Text(overseas ? "YES" : "NO"),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: overseas == true ? 8 : 0,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
child: overseas == false
|
||||||
|
? Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////REGION DROPDOWN
|
||||||
|
FormBuilderDropdown<Region?>(
|
||||||
|
autovalidateMode: AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
onChanged: (Region? region) async {
|
||||||
|
if (selectedRegion != region) {
|
||||||
|
setState(() {
|
||||||
|
provinceCall = true;
|
||||||
|
});
|
||||||
|
selectedRegion = region;
|
||||||
|
getProvinces();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initialValue: null,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Region*", "Region"),
|
||||||
|
name: 'region',
|
||||||
|
items: state.regions
|
||||||
|
.map<DropdownMenuItem<Region>>(
|
||||||
|
(Region region) {
|
||||||
|
return DropdownMenuItem<Region>(
|
||||||
|
value: region,
|
||||||
|
child: Text(
|
||||||
|
region.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
//// PROVINCE DROPDOWN
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.transparent,
|
||||||
|
inAsyncCall: provinceCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
Province?>(
|
||||||
|
autovalidateMode:
|
||||||
|
AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator: (value) =>
|
||||||
|
value == null
|
||||||
|
? 'required'
|
||||||
|
: null,
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedProvince,
|
||||||
|
onChanged:
|
||||||
|
(Province? province) {
|
||||||
|
if (selectedProvince !=
|
||||||
|
province) {
|
||||||
setState(() {
|
setState(() {
|
||||||
provinceCall = true;
|
cityCall = true;
|
||||||
});
|
});
|
||||||
selectedRegion = region;
|
selectedProvince =
|
||||||
getProvinces();
|
province;
|
||||||
|
getCities();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
initialValue: null,
|
items: provinces == null
|
||||||
decoration: normalTextFieldStyle(
|
? []
|
||||||
"Region*", "Region"),
|
: provinces!.map<
|
||||||
name: 'region',
|
DropdownMenuItem<
|
||||||
items: state.regions
|
Province>>(
|
||||||
.map<DropdownMenuItem<Region>>(
|
(Province province) {
|
||||||
(Region region) {
|
return DropdownMenuItem(
|
||||||
return DropdownMenuItem<Region>(
|
value: province,
|
||||||
value: region,
|
child: FittedBox(
|
||||||
child: Text(
|
child: Text(province
|
||||||
region.description!));
|
.description!),
|
||||||
}).toList(),
|
));
|
||||||
),
|
}).toList(),
|
||||||
const SizedBox(
|
decoration:
|
||||||
height: 8,
|
normalTextFieldStyle(
|
||||||
),
|
"Province*",
|
||||||
//// PROVINCE DROPDOWN
|
"Province")),
|
||||||
SizedBox(
|
),
|
||||||
height: 60,
|
),
|
||||||
child: ModalProgressHUD(
|
////CITY MUNICIPALITY
|
||||||
color: Colors.transparent,
|
SizedBox(
|
||||||
inAsyncCall: provinceCall,
|
height: 60,
|
||||||
child: DropdownButtonFormField<
|
child: ModalProgressHUD(
|
||||||
Province?>(
|
color: Colors.white,
|
||||||
autovalidateMode:
|
inAsyncCall: cityCall,
|
||||||
AutovalidateMode
|
child: DropdownButtonFormField<
|
||||||
.onUserInteraction,
|
CityMunicipality>(
|
||||||
validator: (value) =>
|
validator: FormBuilderValidators
|
||||||
value == null
|
.required(
|
||||||
? 'required'
|
|
||||||
: null,
|
|
||||||
isExpanded: true,
|
|
||||||
value: selectedProvince,
|
|
||||||
onChanged:
|
|
||||||
(Province? province) {
|
|
||||||
if (selectedProvince !=
|
|
||||||
province) {
|
|
||||||
setState(() {
|
|
||||||
cityCall = true;
|
|
||||||
});
|
|
||||||
selectedProvince =
|
|
||||||
province;
|
|
||||||
getCities();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
items: provinces == null
|
|
||||||
? []
|
|
||||||
: provinces!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Province>>(
|
|
||||||
(Province province) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: province,
|
|
||||||
child: FittedBox(
|
|
||||||
child: Text(province
|
|
||||||
.description!),
|
|
||||||
));
|
|
||||||
}).toList(),
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Province*",
|
|
||||||
"Province")),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
////CITY MUNICIPALITY
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: cityCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
CityMunicipality>(
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged:
|
|
||||||
(CityMunicipality? city) {
|
|
||||||
if (selectedMunicipality !=
|
|
||||||
city) {
|
|
||||||
setState(() {
|
|
||||||
barangayCall = true;
|
|
||||||
});
|
|
||||||
selectedMunicipality = city;
|
|
||||||
getBarangays();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Municipality*",
|
|
||||||
"Municipality"),
|
|
||||||
value: selectedMunicipality,
|
|
||||||
items: citymuns == null
|
|
||||||
? []
|
|
||||||
: citymuns!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
CityMunicipality>>(
|
|
||||||
(CityMunicipality c) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: c,
|
|
||||||
child: Text(c
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
//// BARANGAY
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: barangayCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
Barangay>(
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged: (Barangay? baragay) {
|
|
||||||
selectedBarangay = baragay;
|
|
||||||
},
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Barangay*",
|
|
||||||
"Barangay"),
|
|
||||||
value: selectedBarangay,
|
|
||||||
items: barangays == null
|
|
||||||
? []
|
|
||||||
: barangays!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Barangay>>(
|
|
||||||
(Barangay barangay) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: barangay,
|
|
||||||
child: Text(barangay
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
//// COUNTRY DROPDOWN
|
|
||||||
: SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: FormBuilderDropdown<Country>(
|
|
||||||
initialValue: null,
|
|
||||||
validator:
|
|
||||||
FormBuilderValidators.required(
|
|
||||||
errorText:
|
errorText:
|
||||||
"This field is required"),
|
"This field is required"),
|
||||||
items: state.countries
|
isExpanded: true,
|
||||||
.map<DropdownMenuItem<Country>>(
|
onChanged:
|
||||||
(Country country) {
|
(CityMunicipality? city) {
|
||||||
return DropdownMenuItem<Country>(
|
if (selectedMunicipality !=
|
||||||
value: country,
|
city) {
|
||||||
child: FittedBox(
|
setState(() {
|
||||||
child:
|
barangayCall = true;
|
||||||
Text(country.name!)));
|
});
|
||||||
}).toList(),
|
selectedMunicipality = city;
|
||||||
name: 'country',
|
getBarangays();
|
||||||
decoration: normalTextFieldStyle(
|
}
|
||||||
"Country*", "Country"),
|
|
||||||
onChanged: (Country? value) {
|
|
||||||
selectedCountry = value;
|
|
||||||
},
|
},
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Municipality*",
|
||||||
|
"Municipality"),
|
||||||
|
value: selectedMunicipality,
|
||||||
|
items: citymuns == null
|
||||||
|
? []
|
||||||
|
: citymuns!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
CityMunicipality>>(
|
||||||
|
(CityMunicipality c) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: c,
|
||||||
|
child: Text(c
|
||||||
|
.description!));
|
||||||
|
}).toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
//// BARANGAY
|
||||||
);
|
SizedBox(
|
||||||
}),
|
height: 60,
|
||||||
////sumit button
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.white,
|
||||||
|
inAsyncCall: barangayCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
Barangay>(
|
||||||
|
isExpanded: true,
|
||||||
|
onChanged: (Barangay? baragay) {
|
||||||
|
selectedBarangay = baragay;
|
||||||
|
},
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Barangay*",
|
||||||
|
"Barangay"),
|
||||||
|
value: selectedBarangay,
|
||||||
|
items: barangays == null
|
||||||
|
? []
|
||||||
|
: barangays!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
Barangay>>(
|
||||||
|
(Barangay barangay) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: barangay,
|
||||||
|
child: Text(barangay
|
||||||
|
.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
//// COUNTRY DROPDOWN
|
||||||
|
: SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: FormBuilderDropdown<Country>(
|
||||||
|
initialValue: null,
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
items: state.countries
|
||||||
|
.map<DropdownMenuItem<Country>>(
|
||||||
|
(Country country) {
|
||||||
|
return DropdownMenuItem<Country>(
|
||||||
|
value: country,
|
||||||
|
child: FittedBox(
|
||||||
|
child:
|
||||||
|
Text(country.name!)));
|
||||||
|
}).toList(),
|
||||||
|
name: 'country',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Country*", "Country"),
|
||||||
|
onChanged: (Country? value) {
|
||||||
|
selectedCountry = value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
),
|
}),
|
||||||
SizedBox(
|
const SizedBox(height: 24,),
|
||||||
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 60,
|
height: 60,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
@ -464,12 +457,13 @@ class _AddAddressScreenState extends State<AddAddressScreen> {
|
||||||
},
|
},
|
||||||
child: const Text(submit)),
|
child: const Text(submit)),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return Placeholder();
|
return const Placeholder();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,208 +106,313 @@ class _EditAddressScreenState extends State<EditAddressScreen> {
|
||||||
vertical: 32, horizontal: 24),
|
vertical: 32, horizontal: 24),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: screenHeight * 88,
|
height: screenHeight * 88,
|
||||||
child: Column(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
//// category
|
||||||
child: ListView(
|
FormBuilderDropdown(
|
||||||
|
initialValue: selectedAddressCategory,
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Category*", "Category"),
|
||||||
|
name: "category",
|
||||||
|
onChanged: (AddressCategory? category) {
|
||||||
|
selectedAddressCategory = category;
|
||||||
|
},
|
||||||
|
items: category
|
||||||
|
.map<DropdownMenuItem<AddressCategory>>(
|
||||||
|
(AddressCategory category) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: category, child: Text(category.name!));
|
||||||
|
}).toList()),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////Area Class
|
||||||
|
FormBuilderDropdown(
|
||||||
|
initialValue: selectedAreaClass,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Area class *", "Area class"),
|
||||||
|
name: "area_class",
|
||||||
|
onChanged: (Area? area) {
|
||||||
|
selectedAreaClass = area;
|
||||||
|
},
|
||||||
|
items: areaClass
|
||||||
|
.map<DropdownMenuItem<Area>>((Area area) {
|
||||||
|
return area.group == 0
|
||||||
|
? DropdownMenuItem(
|
||||||
|
enabled: false,
|
||||||
|
value: area,
|
||||||
|
child: Text(area.value.toUpperCase(),
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black38)))
|
||||||
|
: DropdownMenuItem(
|
||||||
|
value: area,
|
||||||
|
enabled: true,
|
||||||
|
child: Text(
|
||||||
|
" ${area.value.toUpperCase()}"));
|
||||||
|
}).toList()),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////stateful builder
|
||||||
|
StatefulBuilder(builder: (context, setState) {
|
||||||
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
//// category
|
////with block & Lot Switch
|
||||||
FormBuilderDropdown(
|
FormBuilderSwitch(
|
||||||
initialValue: selectedAddressCategory,
|
initialValue: hasLotandBlock,
|
||||||
validator: FormBuilderValidators.required(
|
activeColor: second,
|
||||||
errorText: "This field is required"),
|
onChanged: (value) {
|
||||||
decoration:
|
setState(() {
|
||||||
normalTextFieldStyle("Category*", "Category"),
|
hasLotandBlock = value!;
|
||||||
name: "category",
|
});
|
||||||
onChanged: (AddressCategory? category) {
|
},
|
||||||
selectedAddressCategory = category;
|
|
||||||
},
|
|
||||||
items: category
|
|
||||||
.map<DropdownMenuItem<AddressCategory>>(
|
|
||||||
(AddressCategory category) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: category, child: Text(category.name!));
|
|
||||||
}).toList()),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
////Area Class
|
|
||||||
FormBuilderDropdown(
|
|
||||||
initialValue: selectedAreaClass,
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Area class *", "Area class"),
|
|
||||||
name: "area_class",
|
|
||||||
onChanged: (Area? area) {
|
|
||||||
selectedAreaClass = area;
|
|
||||||
},
|
|
||||||
items: areaClass
|
|
||||||
.map<DropdownMenuItem<Area>>((Area area) {
|
|
||||||
return area.group == 0
|
|
||||||
? DropdownMenuItem(
|
|
||||||
enabled: false,
|
|
||||||
value: area,
|
|
||||||
child: Text(area.value.toUpperCase(),
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.black38)))
|
|
||||||
: DropdownMenuItem(
|
|
||||||
value: area,
|
|
||||||
enabled: true,
|
|
||||||
child: Text(
|
|
||||||
" ${area.value.toUpperCase()}"));
|
|
||||||
}).toList()),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
////stateful builder
|
|
||||||
StatefulBuilder(builder: (context, setState) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
////with block & Lot Switch
|
|
||||||
FormBuilderSwitch(
|
|
||||||
initialValue: hasLotandBlock,
|
|
||||||
activeColor: second,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
hasLotandBlock = value!;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"With Lot and Block?", 'Graduated?'),
|
|
||||||
name: 'graudated',
|
|
||||||
title: Text(hasLotandBlock ? "YES" : "NO"),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: hasLotandBlock ? 12 : 0,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: screenWidth,
|
|
||||||
child: hasLotandBlock
|
|
||||||
? Row(
|
|
||||||
children: [
|
|
||||||
////block #
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
initialValue: state.address
|
|
||||||
.subdivision?.blockNo
|
|
||||||
?.toString(),
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.compose([numericRequired]),
|
|
||||||
keyboardType:
|
|
||||||
TextInputType.number,
|
|
||||||
name: "block_number",
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Block #*", "Block #"),
|
|
||||||
)),
|
|
||||||
const SizedBox(
|
|
||||||
width: 8,
|
|
||||||
),
|
|
||||||
//// lot #
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
initialValue: state
|
|
||||||
.address.subdivision?.lotNo
|
|
||||||
?.toString(),
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.compose([numericRequired]),
|
|
||||||
name: "lot_number",
|
|
||||||
keyboardType:
|
|
||||||
TextInputType.number,
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Lot #*", "Lot #"),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: Container(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
//// Address Line
|
|
||||||
FormBuilderTextField(
|
|
||||||
initialValue: state.address.details,
|
|
||||||
name: "address_line",
|
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"Address Line *", "Address Line"),
|
"With Lot and Block?", 'Graduated?'),
|
||||||
|
name: 'graudated',
|
||||||
|
title: Text(hasLotandBlock ? "YES" : "NO"),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
SizedBox(
|
||||||
height: 12,
|
height: hasLotandBlock ? 12 : 0,
|
||||||
),
|
),
|
||||||
StatefulBuilder(builder: (context, setState) {
|
SizedBox(
|
||||||
return Column(
|
width: screenWidth,
|
||||||
children: [
|
child: hasLotandBlock
|
||||||
FormBuilderSwitch(
|
? Row(
|
||||||
initialValue: overseas,
|
children: [
|
||||||
activeColor: second,
|
////block #
|
||||||
onChanged: (value) {
|
Flexible(
|
||||||
setState(() {
|
flex: 1,
|
||||||
overseas = value!;
|
child: FormBuilderTextField(
|
||||||
});
|
initialValue: state.address
|
||||||
},
|
.subdivision?.blockNo
|
||||||
decoration: normalTextFieldStyle(
|
?.toString(),
|
||||||
"Overseas Address?", ''),
|
validator: FormBuilderValidators
|
||||||
name: 'overseas',
|
.compose([numericRequired]),
|
||||||
title: Text(overseas ? "YES" : "NO"),
|
keyboardType:
|
||||||
),
|
TextInputType.number,
|
||||||
SizedBox(
|
name: "block_number",
|
||||||
height: overseas == true ? 8 : 0,
|
decoration:
|
||||||
),
|
normalTextFieldStyle(
|
||||||
SizedBox(
|
"Block #*", "Block #"),
|
||||||
child: overseas == false
|
)),
|
||||||
? Column(
|
const SizedBox(
|
||||||
children: [
|
width: 8,
|
||||||
const SizedBox(
|
),
|
||||||
height: 12,
|
//// lot #
|
||||||
),
|
Flexible(
|
||||||
////REGION DROPDOWN
|
flex: 1,
|
||||||
DropdownButtonFormField<Region?>(
|
child: FormBuilderTextField(
|
||||||
|
initialValue: state
|
||||||
|
.address.subdivision?.lotNo
|
||||||
|
?.toString(),
|
||||||
|
validator: FormBuilderValidators
|
||||||
|
.compose([numericRequired]),
|
||||||
|
name: "lot_number",
|
||||||
|
keyboardType:
|
||||||
|
TextInputType.number,
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Lot #*", "Lot #"),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
//// Address Line
|
||||||
|
FormBuilderTextField(
|
||||||
|
initialValue: state.address.details,
|
||||||
|
name: "address_line",
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Address Line *", "Address Line"),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
StatefulBuilder(builder: (context, setState) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
FormBuilderSwitch(
|
||||||
|
initialValue: overseas,
|
||||||
|
activeColor: second,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
overseas = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Overseas Address?", ''),
|
||||||
|
name: 'overseas',
|
||||||
|
title: Text(overseas ? "YES" : "NO"),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: overseas == true ? 8 : 0,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
child: overseas == false
|
||||||
|
? Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////REGION DROPDOWN
|
||||||
|
DropdownButtonFormField<Region?>(
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedRegion,
|
||||||
|
autovalidateMode: AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
onChanged: (Region? region) async {
|
||||||
|
if (selectedRegion != region) {
|
||||||
|
setState(() {
|
||||||
|
provinceCall = true;
|
||||||
|
});
|
||||||
|
selectedRegion = region;
|
||||||
|
//// GET PROVINCES
|
||||||
|
try{
|
||||||
|
provinces = await LocationUtils
|
||||||
|
.instance
|
||||||
|
.getProvinces(
|
||||||
|
regionCode:
|
||||||
|
selectedRegion!.code
|
||||||
|
.toString());
|
||||||
|
}catch(e){
|
||||||
|
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
||||||
|
}
|
||||||
|
selectedProvince =
|
||||||
|
provinces![0];
|
||||||
|
setState(() {
|
||||||
|
provinceCall = false;
|
||||||
|
cityCall = true;
|
||||||
|
});
|
||||||
|
//// GET CITIES
|
||||||
|
try{
|
||||||
|
citymuns = await LocationUtils
|
||||||
|
.instance
|
||||||
|
.getCities(
|
||||||
|
code: selectedProvince!
|
||||||
|
.code!);
|
||||||
|
}catch(e){
|
||||||
|
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
||||||
|
}
|
||||||
|
selectedMunicipality =
|
||||||
|
citymuns![0];
|
||||||
|
setState(() {
|
||||||
|
cityCall = false;
|
||||||
|
barangayCall = true;
|
||||||
|
});
|
||||||
|
//// GET BARANGAY
|
||||||
|
try{
|
||||||
|
barangays = await LocationUtils
|
||||||
|
.instance
|
||||||
|
.getBarangay(
|
||||||
|
code:
|
||||||
|
selectedMunicipality!
|
||||||
|
.code!);
|
||||||
|
}catch(e){
|
||||||
|
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
||||||
|
}
|
||||||
|
selectedBarangay =
|
||||||
|
barangays![0];
|
||||||
|
setState(() {
|
||||||
|
barangayCall = false;
|
||||||
|
});
|
||||||
|
////GET CITY MUNICIPALITY
|
||||||
|
try{
|
||||||
|
citymuns = await LocationUtils
|
||||||
|
.instance
|
||||||
|
.getCities(
|
||||||
|
code: selectedProvince!
|
||||||
|
.code!);
|
||||||
|
}catch(e){
|
||||||
|
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
||||||
|
}
|
||||||
|
selectedMunicipality =
|
||||||
|
citymuns![0];
|
||||||
|
setState(() {
|
||||||
|
cityCall = false;
|
||||||
|
barangayCall = true;
|
||||||
|
});
|
||||||
|
//// GET BARANGAYS
|
||||||
|
try{
|
||||||
|
barangays = await LocationUtils
|
||||||
|
.instance
|
||||||
|
.getBarangay(
|
||||||
|
code:
|
||||||
|
selectedMunicipality!
|
||||||
|
.code!);
|
||||||
|
}catch(e){
|
||||||
|
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
||||||
|
}
|
||||||
|
selectedBarangay =
|
||||||
|
barangays![0];
|
||||||
|
setState(() {
|
||||||
|
barangayCall = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Region*", "Region"),
|
||||||
|
items: state.regions
|
||||||
|
.map<DropdownMenuItem<Region>>(
|
||||||
|
(Region region) {
|
||||||
|
return DropdownMenuItem<Region>(
|
||||||
|
value: region,
|
||||||
|
child: Text(
|
||||||
|
region.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
//// PROVINCE DROPDOWN
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.transparent,
|
||||||
|
inAsyncCall: provinceCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
Province?>(
|
||||||
|
autovalidateMode:
|
||||||
|
AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator: (value) =>
|
||||||
|
value == null
|
||||||
|
? 'required'
|
||||||
|
: null,
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
value: selectedRegion,
|
value: selectedProvince,
|
||||||
autovalidateMode: AutovalidateMode
|
onChanged: (Province?
|
||||||
.onUserInteraction,
|
province) async {
|
||||||
validator:
|
if (selectedProvince !=
|
||||||
FormBuilderValidators.required(
|
province) {
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
onChanged: (Region? region) async {
|
|
||||||
if (selectedRegion != region) {
|
|
||||||
setState(() {
|
|
||||||
provinceCall = true;
|
|
||||||
});
|
|
||||||
selectedRegion = region;
|
|
||||||
//// GET PROVINCES
|
|
||||||
try{
|
|
||||||
provinces = await LocationUtils
|
|
||||||
.instance
|
|
||||||
.getProvinces(
|
|
||||||
regionCode:
|
|
||||||
selectedRegion!.code
|
|
||||||
.toString());
|
|
||||||
}catch(e){
|
|
||||||
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
|
||||||
}
|
|
||||||
selectedProvince =
|
selectedProvince =
|
||||||
provinces![0];
|
province;
|
||||||
setState(() {
|
setState(() {
|
||||||
provinceCall = false;
|
|
||||||
cityCall = true;
|
cityCall = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
//// GET CITIES
|
//// GET CITIES
|
||||||
try{
|
try{
|
||||||
citymuns = await LocationUtils
|
citymuns = await LocationUtils
|
||||||
.instance
|
.instance
|
||||||
.getCities(
|
.getCities(
|
||||||
code: selectedProvince!
|
code:
|
||||||
.code!);
|
selectedProvince!
|
||||||
|
.code!);
|
||||||
}catch(e){
|
}catch(e){
|
||||||
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
||||||
}
|
}
|
||||||
selectedMunicipality =
|
selectedMunicipality =
|
||||||
citymuns![0];
|
citymuns![0];
|
||||||
setState(() {
|
setState(() {
|
||||||
|
@ -323,40 +428,8 @@ class _EditAddressScreenState extends State<EditAddressScreen> {
|
||||||
selectedMunicipality!
|
selectedMunicipality!
|
||||||
.code!);
|
.code!);
|
||||||
}catch(e){
|
}catch(e){
|
||||||
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
||||||
}
|
}
|
||||||
selectedBarangay =
|
|
||||||
barangays![0];
|
|
||||||
setState(() {
|
|
||||||
barangayCall = false;
|
|
||||||
});
|
|
||||||
////GET CITY MUNICIPALITY
|
|
||||||
try{
|
|
||||||
citymuns = await LocationUtils
|
|
||||||
.instance
|
|
||||||
.getCities(
|
|
||||||
code: selectedProvince!
|
|
||||||
.code!);
|
|
||||||
}catch(e){
|
|
||||||
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
|
||||||
}
|
|
||||||
selectedMunicipality =
|
|
||||||
citymuns![0];
|
|
||||||
setState(() {
|
|
||||||
cityCall = false;
|
|
||||||
barangayCall = true;
|
|
||||||
});
|
|
||||||
//// GET BARANGAYS
|
|
||||||
try{
|
|
||||||
barangays = await LocationUtils
|
|
||||||
.instance
|
|
||||||
.getBarangay(
|
|
||||||
code:
|
|
||||||
selectedMunicipality!
|
|
||||||
.code!);
|
|
||||||
}catch(e){
|
|
||||||
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
|
||||||
}
|
|
||||||
selectedBarangay =
|
selectedBarangay =
|
||||||
barangays![0];
|
barangays![0];
|
||||||
setState(() {
|
setState(() {
|
||||||
|
@ -364,231 +437,151 @@ class _EditAddressScreenState extends State<EditAddressScreen> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
decoration: normalTextFieldStyle(
|
items: provinces == null
|
||||||
"Region*", "Region"),
|
? []
|
||||||
items: state.regions
|
: provinces!.map<
|
||||||
.map<DropdownMenuItem<Region>>(
|
DropdownMenuItem<
|
||||||
(Region region) {
|
Province>>(
|
||||||
return DropdownMenuItem<Region>(
|
(Province province) {
|
||||||
value: region,
|
return DropdownMenuItem(
|
||||||
child: Text(
|
value: province,
|
||||||
region.description!));
|
child: FittedBox(
|
||||||
}).toList(),
|
child: Text(province
|
||||||
),
|
.description!),
|
||||||
const SizedBox(
|
));
|
||||||
height: 8,
|
}).toList(),
|
||||||
),
|
decoration:
|
||||||
//// PROVINCE DROPDOWN
|
normalTextFieldStyle(
|
||||||
SizedBox(
|
"Province*",
|
||||||
height: 60,
|
"Province")),
|
||||||
child: ModalProgressHUD(
|
),
|
||||||
color: Colors.transparent,
|
),
|
||||||
inAsyncCall: provinceCall,
|
////CITY MUNICIPALITY
|
||||||
child: DropdownButtonFormField<
|
SizedBox(
|
||||||
Province?>(
|
height: 60,
|
||||||
autovalidateMode:
|
child: ModalProgressHUD(
|
||||||
AutovalidateMode
|
color: Colors.white,
|
||||||
.onUserInteraction,
|
inAsyncCall: cityCall,
|
||||||
validator: (value) =>
|
child: DropdownButtonFormField<
|
||||||
value == null
|
CityMunicipality>(
|
||||||
? 'required'
|
validator: FormBuilderValidators
|
||||||
: null,
|
.required(
|
||||||
isExpanded: true,
|
|
||||||
value: selectedProvince,
|
|
||||||
onChanged: (Province?
|
|
||||||
province) async {
|
|
||||||
if (selectedProvince !=
|
|
||||||
province) {
|
|
||||||
selectedProvince =
|
|
||||||
province;
|
|
||||||
setState(() {
|
|
||||||
cityCall = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
//// GET CITIES
|
|
||||||
try{
|
|
||||||
citymuns = await LocationUtils
|
|
||||||
.instance
|
|
||||||
.getCities(
|
|
||||||
code:
|
|
||||||
selectedProvince!
|
|
||||||
.code!);
|
|
||||||
}catch(e){
|
|
||||||
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
|
||||||
}
|
|
||||||
selectedMunicipality =
|
|
||||||
citymuns![0];
|
|
||||||
setState(() {
|
|
||||||
cityCall = false;
|
|
||||||
barangayCall = true;
|
|
||||||
});
|
|
||||||
//// GET BARANGAY
|
|
||||||
try{
|
|
||||||
barangays = await LocationUtils
|
|
||||||
.instance
|
|
||||||
.getBarangay(
|
|
||||||
code:
|
|
||||||
selectedMunicipality!
|
|
||||||
.code!);
|
|
||||||
}catch(e){
|
|
||||||
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
|
||||||
}
|
|
||||||
selectedBarangay =
|
|
||||||
barangays![0];
|
|
||||||
setState(() {
|
|
||||||
barangayCall = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
items: provinces == null
|
|
||||||
? []
|
|
||||||
: provinces!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Province>>(
|
|
||||||
(Province province) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: province,
|
|
||||||
child: FittedBox(
|
|
||||||
child: Text(province
|
|
||||||
.description!),
|
|
||||||
));
|
|
||||||
}).toList(),
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Province*",
|
|
||||||
"Province")),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
////CITY MUNICIPALITY
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: cityCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
CityMunicipality>(
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged: (CityMunicipality?
|
|
||||||
city) async {
|
|
||||||
if (selectedMunicipality !=
|
|
||||||
city) {
|
|
||||||
setState(() {
|
|
||||||
barangayCall = true;
|
|
||||||
});
|
|
||||||
selectedMunicipality = city;
|
|
||||||
selectedMunicipality = city;
|
|
||||||
//// GET BARANGAYS
|
|
||||||
try{
|
|
||||||
barangays = await LocationUtils
|
|
||||||
.instance
|
|
||||||
.getBarangay(
|
|
||||||
code:
|
|
||||||
selectedMunicipality!
|
|
||||||
.code!);
|
|
||||||
}catch(e){
|
|
||||||
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
|
||||||
}
|
|
||||||
selectedBarangay =
|
|
||||||
barangays![0];
|
|
||||||
setState(() {
|
|
||||||
barangayCall = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Municipality*",
|
|
||||||
"Municipality"),
|
|
||||||
value: selectedMunicipality,
|
|
||||||
items: citymuns == null
|
|
||||||
? []
|
|
||||||
: citymuns!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
CityMunicipality>>(
|
|
||||||
(CityMunicipality c) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: c,
|
|
||||||
child: Text(c
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
//// BARANGAY
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: barangayCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
Barangay>(
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged: (Barangay? baragay) {
|
|
||||||
selectedBarangay = baragay;
|
|
||||||
},
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Barangay*",
|
|
||||||
"Barangay"),
|
|
||||||
value: selectedBarangay,
|
|
||||||
items: barangays == null
|
|
||||||
? []
|
|
||||||
: barangays!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Barangay>>(
|
|
||||||
(Barangay barangay) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: barangay,
|
|
||||||
child: Text(barangay
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
//// COUNTRY DROPDOWN
|
|
||||||
: SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: FormBuilderDropdown<Country>(
|
|
||||||
initialValue:selectedCountry!.id == 175?null:selectedCountry,
|
|
||||||
validator:
|
|
||||||
FormBuilderValidators.required(
|
|
||||||
errorText:
|
errorText:
|
||||||
"This field is required"),
|
"This field is required"),
|
||||||
items: state.countries
|
isExpanded: true,
|
||||||
.map<DropdownMenuItem<Country>>(
|
onChanged: (CityMunicipality?
|
||||||
(Country country) {
|
city) async {
|
||||||
return DropdownMenuItem<Country>(
|
if (selectedMunicipality !=
|
||||||
value: country,
|
city) {
|
||||||
child: FittedBox(
|
setState(() {
|
||||||
child:
|
barangayCall = true;
|
||||||
Text(country.name!)));
|
});
|
||||||
}).toList(),
|
selectedMunicipality = city;
|
||||||
name: 'country',
|
selectedMunicipality = city;
|
||||||
decoration: normalTextFieldStyle(
|
//// GET BARANGAYS
|
||||||
"Country*", "Country"),
|
try{
|
||||||
onChanged: (Country? value) {
|
barangays = await LocationUtils
|
||||||
setState((){
|
.instance
|
||||||
selectedCountry = value;
|
.getBarangay(
|
||||||
});
|
code:
|
||||||
|
selectedMunicipality!
|
||||||
|
.code!);
|
||||||
|
}catch(e){
|
||||||
|
NavigationService.navigatorKey.currentContext?.read<AddressBloc>().add(CallErrorState());
|
||||||
|
}
|
||||||
|
selectedBarangay =
|
||||||
|
barangays![0];
|
||||||
|
setState(() {
|
||||||
|
barangayCall = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Municipality*",
|
||||||
|
"Municipality"),
|
||||||
|
value: selectedMunicipality,
|
||||||
|
items: citymuns == null
|
||||||
|
? []
|
||||||
|
: citymuns!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
CityMunicipality>>(
|
||||||
|
(CityMunicipality c) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: c,
|
||||||
|
child: Text(c
|
||||||
|
.description!));
|
||||||
|
}).toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
//// BARANGAY
|
||||||
);
|
SizedBox(
|
||||||
}),
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.white,
|
||||||
|
inAsyncCall: barangayCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
Barangay>(
|
||||||
|
isExpanded: true,
|
||||||
|
onChanged: (Barangay? baragay) {
|
||||||
|
selectedBarangay = baragay;
|
||||||
|
},
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Barangay*",
|
||||||
|
"Barangay"),
|
||||||
|
value: selectedBarangay,
|
||||||
|
items: barangays == null
|
||||||
|
? []
|
||||||
|
: barangays!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
Barangay>>(
|
||||||
|
(Barangay barangay) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: barangay,
|
||||||
|
child: Text(barangay
|
||||||
|
.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
//// COUNTRY DROPDOWN
|
||||||
|
: SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: FormBuilderDropdown<Country>(
|
||||||
|
initialValue:selectedCountry!.id == 175?null:selectedCountry,
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
items: state.countries
|
||||||
|
.map<DropdownMenuItem<Country>>(
|
||||||
|
(Country country) {
|
||||||
|
return DropdownMenuItem<Country>(
|
||||||
|
value: country,
|
||||||
|
child: FittedBox(
|
||||||
|
child:
|
||||||
|
Text(country.name!)));
|
||||||
|
}).toList(),
|
||||||
|
name: 'country',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Country*", "Country"),
|
||||||
|
onChanged: (Country? value) {
|
||||||
|
setState((){
|
||||||
|
selectedCountry = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
),
|
}),
|
||||||
SizedBox(
|
const SizedBox(height: 8,),
|
||||||
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 60,
|
height: 60,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
@ -645,13 +638,13 @@ class _EditAddressScreenState extends State<EditAddressScreen> {
|
||||||
},
|
},
|
||||||
child: const Text(submit)),
|
child: const Text(submit)),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return Placeholder();
|
return const Placeholder();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ class AddressScreen extends StatelessWidget {
|
||||||
int? profileId;
|
int? profileId;
|
||||||
String? token;
|
String? token;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: context.watch<AddressBloc>().state is AddAddressState?const Text("Add Address"):context.watch<AddressBloc>().state is EditAddressState?const Text("Edit Address"):const Text("Addresses"),
|
title: context.watch<AddressBloc>().state is AddAddressState?const Text("Add Address"):context.watch<AddressBloc>().state is EditAddressState?const Text("Edit Address"):const Text("Addresses"),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
|
|
|
@ -50,210 +50,206 @@ class _AddContactInformationScreenState
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is ContactAddingState) {
|
if (state is ContactAddingState) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 32, horizontal: 24),
|
padding: const EdgeInsets.symmetric(vertical: 24, horizontal: 24),
|
||||||
child: FormBuilder(
|
child: FormBuilder(
|
||||||
key: formKey,
|
key: formKey,
|
||||||
child: StatefulBuilder(builder: (context, setState) {
|
child: StatefulBuilder(builder: (context, setState) {
|
||||||
return SizedBox(
|
return ListView(
|
||||||
height: screenHeight * 90,
|
children: [
|
||||||
child: Column(
|
////Service Type
|
||||||
children: [
|
FormBuilderDropdown<ServiceType>(
|
||||||
Flexible(
|
validator: FormBuilderValidators.required(
|
||||||
child: ListView(
|
errorText: "This field is required"),
|
||||||
children: [
|
name: "service_type",
|
||||||
|
items: state.serviceTypes
|
||||||
////Service Type
|
.map<DropdownMenuItem<ServiceType>>(
|
||||||
FormBuilderDropdown<ServiceType>(
|
(ServiceType e) {
|
||||||
|
return DropdownMenuItem<ServiceType>(
|
||||||
|
value: e, child: Text(e.name!));
|
||||||
|
}).toList(),
|
||||||
|
decoration: normalTextFieldStyle("Service Type*", ""),
|
||||||
|
onChanged: (var service) async {
|
||||||
|
if (selectedServiceType != service) {
|
||||||
|
selectedServiceType = service;
|
||||||
|
setState(() {
|
||||||
|
callServiceType = true;
|
||||||
|
selectedCommServiceProvider = null;
|
||||||
|
numberMailController.text = "";
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
commServiceProviders = await ContactService
|
||||||
|
.instance
|
||||||
|
.getServiceProvider(
|
||||||
|
serviceTypeId:
|
||||||
|
selectedServiceType!.id!);
|
||||||
|
} catch (e) {
|
||||||
|
context
|
||||||
|
.read<ContactBloc>()
|
||||||
|
.add(CallErrorEvent(message: e.toString()));
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
setState(() {
|
||||||
|
callServiceType = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////Service Provider
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.transparent,
|
||||||
|
inAsyncCall: callServiceType,
|
||||||
|
child: DropdownButtonFormField<CommService>(
|
||||||
|
isExpanded: true,
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
items: commServiceProviders.isEmpty
|
||||||
|
? []
|
||||||
|
: commServiceProviders
|
||||||
|
.map<DropdownMenuItem<CommService>>(
|
||||||
|
(CommService e) {
|
||||||
|
return DropdownMenuItem<CommService>(
|
||||||
|
value: e,
|
||||||
|
child: Text(e
|
||||||
|
.serviceProvider!.agency!.name!));
|
||||||
|
}).toList(),
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Communication Service *", ""),
|
||||||
|
onChanged: (var serviceProvider) {
|
||||||
|
selectedCommServiceProvider = serviceProvider;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
selectedServiceType != null
|
||||||
|
? selectedServiceType?.id == 2
|
||||||
|
//// Landline
|
||||||
|
? FormBuilderTextField(
|
||||||
|
controller: numberMailController,
|
||||||
|
inputFormatters: [landLineFormatter],
|
||||||
|
name: 'number-mail',
|
||||||
validator: FormBuilderValidators.required(
|
validator: FormBuilderValidators.required(
|
||||||
errorText: "This field is required"),
|
errorText: "This field is required"),
|
||||||
name: "service_type",
|
decoration: normalTextFieldStyle(
|
||||||
items: state.serviceTypes
|
"Landline number *",
|
||||||
.map<DropdownMenuItem<ServiceType>>(
|
"(area code) xxx - xxxx"),
|
||||||
(ServiceType e) {
|
)
|
||||||
return DropdownMenuItem<ServiceType>(
|
: selectedServiceType!.id == 1 ||
|
||||||
value: e, child: Text(e.name!));
|
selectedServiceType!.id == 19
|
||||||
}).toList(),
|
//// Mobile number
|
||||||
decoration: normalTextFieldStyle("Service Type*", ""),
|
? FormBuilderTextField(
|
||||||
onChanged: (var service) async {
|
keyboardType: TextInputType.number,
|
||||||
if (selectedServiceType != service) {
|
controller: numberMailController,
|
||||||
selectedServiceType = service;
|
name: 'number-mail',
|
||||||
setState(() {
|
inputFormatters: [mobileFormatter],
|
||||||
callServiceType = true;
|
|
||||||
selectedCommServiceProvider = null;
|
|
||||||
numberMailController.text = "";
|
|
||||||
});
|
|
||||||
|
|
||||||
commServiceProviders = await ContactService
|
|
||||||
.instance
|
|
||||||
.getServiceProvider(
|
|
||||||
serviceTypeId: selectedServiceType!.id!);
|
|
||||||
setState(() {
|
|
||||||
setState(() {
|
|
||||||
callServiceType = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
////Service Provider
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.transparent,
|
|
||||||
inAsyncCall: callServiceType,
|
|
||||||
child: DropdownButtonFormField<CommService>(
|
|
||||||
isExpanded: true,
|
|
||||||
validator: FormBuilderValidators.required(
|
validator: FormBuilderValidators.required(
|
||||||
errorText: "This field is required"),
|
errorText: "This field is required"),
|
||||||
items: commServiceProviders.isEmpty
|
|
||||||
? []
|
|
||||||
: commServiceProviders
|
|
||||||
.map<DropdownMenuItem<CommService>>(
|
|
||||||
(CommService e) {
|
|
||||||
return DropdownMenuItem<CommService>(
|
|
||||||
value: e,
|
|
||||||
child: Text(e
|
|
||||||
.serviceProvider!.agency!.name!));
|
|
||||||
}).toList(),
|
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"Communication Service *", ""),
|
"Mobile number *",
|
||||||
onChanged: (var serviceProvider) {
|
"+63 (9xx) xxx - xxxx"),
|
||||||
selectedCommServiceProvider = serviceProvider;
|
)
|
||||||
}),
|
: selectedServiceType!.id == 4
|
||||||
),
|
////Social Media
|
||||||
),
|
|
||||||
selectedServiceType != null
|
|
||||||
? selectedServiceType?.id == 2
|
|
||||||
//// Landline
|
|
||||||
? FormBuilderTextField(
|
? FormBuilderTextField(
|
||||||
controller: numberMailController,
|
controller: numberMailController,
|
||||||
inputFormatters: [landLineFormatter],
|
|
||||||
name: 'number-mail',
|
name: 'number-mail',
|
||||||
validator: FormBuilderValidators.required(
|
validator:
|
||||||
errorText: "This field is required"),
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"Landline number *",
|
"Account ID / Username *", ""),
|
||||||
"(area code) xxx - xxxx"),
|
|
||||||
)
|
)
|
||||||
: selectedServiceType!.id == 1 ||
|
: selectedServiceType!.id == 3
|
||||||
selectedServiceType!.id == 19
|
////Email Address
|
||||||
//// Mobile number
|
|
||||||
? FormBuilderTextField(
|
? FormBuilderTextField(
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
controller: numberMailController,
|
controller: numberMailController,
|
||||||
name: 'number-mail',
|
name: 'number-mail',
|
||||||
inputFormatters: [mobileFormatter],
|
validator: FormBuilderValidators
|
||||||
validator: FormBuilderValidators.required(
|
.compose([
|
||||||
errorText: "This field is required"),
|
FormBuilderValidators.email(
|
||||||
|
errorText:
|
||||||
|
"Input vaild email"),
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required")
|
||||||
|
]),
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"Mobile number *",
|
"Email Address*", ""),
|
||||||
"+63 (9xx) xxx - xxxx"),
|
|
||||||
)
|
)
|
||||||
: selectedServiceType!.id == 4
|
: Container()
|
||||||
////Social Media
|
: const SizedBox(),
|
||||||
? FormBuilderTextField(
|
SizedBox(
|
||||||
controller: numberMailController,
|
height: selectedServiceType != null ? 12 : 0,
|
||||||
name: 'number-mail',
|
),
|
||||||
validator:
|
//// Primary
|
||||||
FormBuilderValidators.required(
|
FormBuilderSwitch(
|
||||||
errorText:
|
initialValue: primaryaContact,
|
||||||
"This field is required"),
|
activeColor: second,
|
||||||
decoration: normalTextFieldStyle(
|
onChanged: (value) {
|
||||||
"Account ID / Username *", ""),
|
setState(() {
|
||||||
)
|
primaryaContact = value!;
|
||||||
: selectedServiceType!.id == 3
|
});
|
||||||
////Email Address
|
},
|
||||||
? FormBuilderTextField(
|
decoration:
|
||||||
controller: numberMailController,
|
normalTextFieldStyle("Primary?", 'Primary?'),
|
||||||
name: 'number-mail',
|
name: 'overseas',
|
||||||
validator: FormBuilderValidators
|
title: Text(primaryaContact ? "YES" : "NO"),
|
||||||
.compose([
|
),
|
||||||
FormBuilderValidators.email(
|
//// Active
|
||||||
errorText:
|
const SizedBox(
|
||||||
"Input vaild email"),
|
height: 12,
|
||||||
FormBuilderValidators.required(
|
),
|
||||||
errorText:
|
FormBuilderSwitch(
|
||||||
"This field is required")
|
initialValue: primaryaContact,
|
||||||
]),
|
activeColor: second,
|
||||||
decoration: normalTextFieldStyle(
|
onChanged: (value) {
|
||||||
"Email Address*", ""),
|
setState(() {
|
||||||
)
|
active = value!;
|
||||||
: Container()
|
});
|
||||||
: const SizedBox(),
|
},
|
||||||
SizedBox(
|
decoration: normalTextFieldStyle("Active?", ''),
|
||||||
height: selectedServiceType != null ? 12 : 0,
|
name: 'overseas',
|
||||||
),
|
title: Text(active ? "YES" : "NO"),
|
||||||
//// Primary
|
),
|
||||||
FormBuilderSwitch(
|
const SizedBox(
|
||||||
initialValue: primaryaContact,
|
height: 24,
|
||||||
activeColor: second,
|
),
|
||||||
onChanged: (value) {
|
SizedBox(
|
||||||
setState(() {
|
height: 60,
|
||||||
primaryaContact = value!;
|
width: double.infinity,
|
||||||
});
|
child: ElevatedButton(
|
||||||
},
|
onPressed: () {
|
||||||
decoration:
|
if (formKey.currentState!.saveAndValidate()) {
|
||||||
normalTextFieldStyle("Primary?", 'Primary?'),
|
numberMail =
|
||||||
name: 'overseas',
|
formKey.currentState!.value['number-mail'];
|
||||||
title: Text(primaryaContact ? "YES" : "NO"),
|
CommService commService =
|
||||||
),
|
selectedCommServiceProvider!;
|
||||||
//// Active
|
ContactInfo contactInfo = ContactInfo(
|
||||||
const SizedBox(
|
id: null,
|
||||||
height: 12,
|
active: active,
|
||||||
),
|
primary: primaryaContact,
|
||||||
FormBuilderSwitch(
|
numbermail: numberMail,
|
||||||
initialValue: primaryaContact,
|
commService: commService);
|
||||||
activeColor: second,
|
final progress = ProgressHUD.of(context);
|
||||||
onChanged: (value) {
|
progress!.showWithText("Loading...");
|
||||||
setState(() {
|
context.read<ContactBloc>().add(
|
||||||
active = value!;
|
AddContactInformation(
|
||||||
});
|
contactInfo: contactInfo,
|
||||||
},
|
profileId: widget.profileId,
|
||||||
decoration: normalTextFieldStyle("Active?", ''),
|
token: widget.token));
|
||||||
name: 'overseas',
|
}
|
||||||
title: Text(active ? "YES" : "NO"),
|
},
|
||||||
),
|
style:
|
||||||
|
mainBtnStyle(primary, Colors.transparent, second),
|
||||||
|
child: const Text(submit),
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
),
|
),
|
||||||
SizedBox(
|
),
|
||||||
height: 60,
|
],
|
||||||
width: double.infinity,
|
|
||||||
child: ElevatedButton(
|
|
||||||
onPressed: () {
|
|
||||||
if (formKey.currentState!.saveAndValidate()) {
|
|
||||||
numberMail =
|
|
||||||
formKey.currentState!.value['number-mail'];
|
|
||||||
CommService commService =
|
|
||||||
selectedCommServiceProvider!;
|
|
||||||
ContactInfo contactInfo = ContactInfo(
|
|
||||||
id: null,
|
|
||||||
active: active,
|
|
||||||
primary: primaryaContact,
|
|
||||||
numbermail: numberMail,
|
|
||||||
commService: commService);
|
|
||||||
final progress = ProgressHUD.of(context);
|
|
||||||
progress!.showWithText("Loading...");
|
|
||||||
context.read<ContactBloc>().add(
|
|
||||||
AddContactInformation(
|
|
||||||
contactInfo: contactInfo,
|
|
||||||
profileId: widget.profileId,
|
|
||||||
token: widget.token));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
style:
|
|
||||||
mainBtnStyle(primary, Colors.transparent, second),
|
|
||||||
child: const Text(submit),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|
|
@ -35,7 +35,6 @@ class _EditContactInformationScreenState
|
||||||
bool? primaryaContact;
|
bool? primaryaContact;
|
||||||
bool? active;
|
bool? active;
|
||||||
|
|
||||||
|
|
||||||
var mobileFormatter = MaskTextInputFormatter(
|
var mobileFormatter = MaskTextInputFormatter(
|
||||||
mask: "+63 (###) ###-####",
|
mask: "+63 (###) ###-####",
|
||||||
filter: {"#": RegExp(r"^[1-9][0-9]*$")},
|
filter: {"#": RegExp(r"^[1-9][0-9]*$")},
|
||||||
|
@ -51,9 +50,10 @@ class _EditContactInformationScreenState
|
||||||
final numberMailController = TextEditingController();
|
final numberMailController = TextEditingController();
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
numberMailController.dispose();
|
numberMailController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<ContactBloc, ContactState>(
|
return BlocBuilder<ContactBloc, ContactState>(
|
||||||
|
@ -64,221 +64,218 @@ class _EditContactInformationScreenState
|
||||||
commServiceProviders = state.commServiceProviders;
|
commServiceProviders = state.commServiceProviders;
|
||||||
primaryaContact = state.contactInfo.primary;
|
primaryaContact = state.contactInfo.primary;
|
||||||
active = state.contactInfo.active;
|
active = state.contactInfo.active;
|
||||||
numberMailController.text = state.contactInfo.numbermail!;
|
numberMailController.text = state.contactInfo.numbermail!;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 24, horizontal: 24),
|
padding: const EdgeInsets.symmetric(vertical: 24, horizontal: 24),
|
||||||
child: FormBuilder(
|
child: FormBuilder(
|
||||||
key: formKey,
|
key: formKey,
|
||||||
child: Column(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
StatefulBuilder(builder: (context, setState) {
|
||||||
child: ListView(
|
return Column(children: [
|
||||||
children: [
|
////Service Type
|
||||||
StatefulBuilder(builder: (context, setState) {
|
DropdownButtonFormField<ServiceType>(
|
||||||
return Column(children: [
|
isExpanded: true,
|
||||||
////Service Type
|
validator: FormBuilderValidators.required(
|
||||||
DropdownButtonFormField<ServiceType>(
|
errorText: "This field is required"),
|
||||||
isExpanded: true,
|
value: selectedServiceType,
|
||||||
validator: FormBuilderValidators.required(
|
items: state.serviceTypes
|
||||||
errorText: "This field is required"),
|
.map<DropdownMenuItem<ServiceType>>(
|
||||||
value: selectedServiceType,
|
(ServiceType e) {
|
||||||
items: state.serviceTypes
|
return DropdownMenuItem<ServiceType>(
|
||||||
.map<DropdownMenuItem<ServiceType>>(
|
value: e, child: Text(e.name!));
|
||||||
(ServiceType e) {
|
}).toList(),
|
||||||
return DropdownMenuItem<ServiceType>(
|
decoration:
|
||||||
value: e, child: Text(e.name!));
|
normalTextFieldStyle("Service Type*", ""),
|
||||||
}).toList(),
|
onChanged: (var service) async {
|
||||||
decoration:
|
if (selectedServiceType!.id != service!.id) {
|
||||||
normalTextFieldStyle("Service Type*", ""),
|
selectedServiceType = service;
|
||||||
onChanged: (var service) async {
|
setState(() {
|
||||||
if (selectedServiceType!.id != service!.id) {
|
callServiceType = true;
|
||||||
selectedServiceType = service;
|
callServiceType = true;
|
||||||
setState(() {
|
|
||||||
callServiceType = true;
|
numberMailController.text = "";
|
||||||
callServiceType = true;
|
});
|
||||||
|
try {
|
||||||
numberMailController.text = "";
|
commServiceProviders = await ContactService
|
||||||
});
|
.instance
|
||||||
commServiceProviders = await ContactService
|
.getServiceProvider(
|
||||||
.instance
|
serviceTypeId:
|
||||||
.getServiceProvider(
|
selectedServiceType!.id!);
|
||||||
serviceTypeId:
|
} catch (e) {
|
||||||
selectedServiceType!.id!);
|
context.read<ContactBloc>().add(
|
||||||
selectedCommProvider = null;
|
CallErrorEvent(message: e.toString()));
|
||||||
setState(() {
|
}
|
||||||
setState(() {
|
selectedCommProvider = null;
|
||||||
callServiceType = false;
|
setState(() {
|
||||||
});
|
setState(() {
|
||||||
});
|
callServiceType = false;
|
||||||
}
|
});
|
||||||
}),
|
});
|
||||||
const SizedBox(
|
}
|
||||||
height: 12,
|
}),
|
||||||
),
|
const SizedBox(
|
||||||
////Service Provider
|
height: 12,
|
||||||
SizedBox(
|
),
|
||||||
height: 60,
|
////Service Provider
|
||||||
child: ModalProgressHUD(
|
SizedBox(
|
||||||
color: Colors.transparent,
|
height: 60,
|
||||||
inAsyncCall: callServiceType,
|
child: ModalProgressHUD(
|
||||||
child: DropdownButtonFormField<CommService>(
|
color: Colors.transparent,
|
||||||
isExpanded: true,
|
inAsyncCall: callServiceType,
|
||||||
value: selectedCommProvider,
|
child: DropdownButtonFormField<CommService>(
|
||||||
validator: FormBuilderValidators.required(
|
isExpanded: true,
|
||||||
errorText: "This field is required"),
|
value: selectedCommProvider,
|
||||||
items: commServiceProviders.isEmpty
|
validator: FormBuilderValidators.required(
|
||||||
? []
|
errorText: "This field is required"),
|
||||||
: commServiceProviders
|
items: commServiceProviders.isEmpty
|
||||||
.map<DropdownMenuItem<CommService>>(
|
? []
|
||||||
(CommService e) {
|
: commServiceProviders
|
||||||
return DropdownMenuItem<CommService>(
|
.map<DropdownMenuItem<CommService>>(
|
||||||
value: e,
|
(CommService e) {
|
||||||
child: Text(e.serviceProvider!
|
return DropdownMenuItem<CommService>(
|
||||||
.agency!.name!));
|
value: e,
|
||||||
}).toList(),
|
child: Text(e.serviceProvider!
|
||||||
decoration: normalTextFieldStyle(
|
.agency!.name!));
|
||||||
"Communication Service *", ""),
|
}).toList(),
|
||||||
onChanged: (var commServiceProvider) {
|
decoration: normalTextFieldStyle(
|
||||||
selectedCommProvider = commServiceProvider;
|
"Communication Service *", ""),
|
||||||
}),
|
onChanged: (var commServiceProvider) {
|
||||||
),
|
selectedCommProvider = commServiceProvider;
|
||||||
),
|
}),
|
||||||
selectedServiceType != null
|
),
|
||||||
? selectedServiceType?.id == 2
|
),
|
||||||
//// Landline
|
selectedServiceType != null
|
||||||
? FormBuilderTextField(
|
? selectedServiceType?.id == 2
|
||||||
controller: numberMailController,
|
//// Landline
|
||||||
name: 'number-mail',
|
? FormBuilderTextField(
|
||||||
|
controller: numberMailController,
|
||||||
inputFormatters: [landLineFormatter],
|
name: 'number-mail',
|
||||||
validator: FormBuilderValidators.required(
|
inputFormatters: [landLineFormatter],
|
||||||
errorText: "This field is required"),
|
validator: FormBuilderValidators.required(
|
||||||
decoration: normalTextFieldStyle(
|
errorText: "This field is required"),
|
||||||
"Landline number *",
|
decoration: normalTextFieldStyle(
|
||||||
"(area code) xxx - xxxx"),
|
"Landline number *",
|
||||||
)
|
"(area code) xxx - xxxx"),
|
||||||
: selectedServiceType!.id == 1 ||
|
)
|
||||||
selectedServiceType!.id == 19
|
: selectedServiceType!.id == 1 ||
|
||||||
//// Mobile number
|
selectedServiceType!.id == 19
|
||||||
? FormBuilderTextField(
|
//// Mobile number
|
||||||
controller: numberMailController,
|
? FormBuilderTextField(
|
||||||
name: 'number-mail',
|
controller: numberMailController,
|
||||||
inputFormatters: [mobileFormatter],
|
name: 'number-mail',
|
||||||
|
inputFormatters: [mobileFormatter],
|
||||||
validator:
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Mobile number *",
|
||||||
|
"+63 (9xx) xxx - xxxx"),
|
||||||
|
)
|
||||||
|
: selectedServiceType!.id == 4
|
||||||
|
////Social Media
|
||||||
|
? FormBuilderTextField(
|
||||||
|
controller: numberMailController,
|
||||||
|
name: 'number-mail',
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Account ID / Username *", ""),
|
||||||
|
)
|
||||||
|
: selectedServiceType!.id == 3
|
||||||
|
////Email Address
|
||||||
|
? FormBuilderTextField(
|
||||||
|
controller:
|
||||||
|
numberMailController,
|
||||||
|
name: 'number-mail',
|
||||||
|
validator: FormBuilderValidators
|
||||||
|
.compose([
|
||||||
|
FormBuilderValidators.email(
|
||||||
|
errorText:
|
||||||
|
"Input vaild email"),
|
||||||
FormBuilderValidators.required(
|
FormBuilderValidators.required(
|
||||||
errorText:
|
errorText:
|
||||||
"This field is required"),
|
"This field is required")
|
||||||
decoration: normalTextFieldStyle(
|
]),
|
||||||
"Mobile number *",
|
decoration:
|
||||||
"+63 (9xx) xxx - xxxx"),
|
normalTextFieldStyle(
|
||||||
)
|
"Email Address*", ""),
|
||||||
: selectedServiceType!.id == 4
|
)
|
||||||
////Social Media
|
: Container()
|
||||||
? FormBuilderTextField(
|
: const SizedBox(),
|
||||||
controller: numberMailController,
|
]);
|
||||||
name: 'number-mail',
|
}),
|
||||||
|
SizedBox(
|
||||||
validator:
|
height: selectedServiceType != null ? 12 : 0,
|
||||||
FormBuilderValidators.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Account ID / Username *", ""),
|
|
||||||
)
|
|
||||||
: selectedServiceType!.id == 3
|
|
||||||
////Email Address
|
|
||||||
? FormBuilderTextField(
|
|
||||||
controller: numberMailController,
|
|
||||||
name: 'number-mail',
|
|
||||||
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.compose([
|
|
||||||
FormBuilderValidators.email(
|
|
||||||
errorText:
|
|
||||||
"Input vaild email"),
|
|
||||||
FormBuilderValidators.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required")
|
|
||||||
]),
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Email Address*", ""),
|
|
||||||
)
|
|
||||||
: Container()
|
|
||||||
: const SizedBox(),
|
|
||||||
]);
|
|
||||||
}),
|
|
||||||
SizedBox(
|
|
||||||
height: selectedServiceType != null ? 12 : 0,
|
|
||||||
),
|
|
||||||
//// Primary
|
|
||||||
StatefulBuilder(builder: (context, setState) {
|
|
||||||
return FormBuilderSwitch(
|
|
||||||
initialValue: primaryaContact,
|
|
||||||
activeColor: second,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
primaryaContact = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
decoration: normalTextFieldStyle("", ''),
|
|
||||||
name: 'primary',
|
|
||||||
title: const Text("Primary ?"),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
//// Active
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
StatefulBuilder(builder: (context, setState) {
|
|
||||||
return FormBuilderSwitch(
|
|
||||||
initialValue: active,
|
|
||||||
activeColor: second,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
active = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
decoration: normalTextFieldStyle("", ''),
|
|
||||||
name: 'active',
|
|
||||||
title: const Text("Active ?"),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(
|
//// Primary
|
||||||
height: 60,
|
StatefulBuilder(builder: (context, setState) {
|
||||||
width: double.infinity,
|
return FormBuilderSwitch(
|
||||||
child: ElevatedButton(
|
initialValue: primaryaContact,
|
||||||
onPressed: () {
|
activeColor: second,
|
||||||
if (formKey.currentState!.saveAndValidate()) {
|
onChanged: (value) {
|
||||||
numberMail =
|
setState(() {
|
||||||
formKey.currentState!.value['number-mail'];
|
primaryaContact = value;
|
||||||
CommService commService = selectedCommProvider!;
|
});
|
||||||
ContactInfo contactInfo = ContactInfo(
|
},
|
||||||
id: state.contactInfo.id,
|
decoration: normalTextFieldStyle("", ''),
|
||||||
active: active,
|
name: 'primary',
|
||||||
primary: primaryaContact,
|
title: const Text("Primary ?"),
|
||||||
numbermail: numberMail,
|
);
|
||||||
commService: commService);
|
}),
|
||||||
final progress = ProgressHUD.of(context);
|
//// Active
|
||||||
progress!.showWithText("Loading...");
|
const SizedBox(
|
||||||
context.read<ContactBloc>().add(
|
height: 12,
|
||||||
EditContactInformation(
|
),
|
||||||
contactInfo: contactInfo,
|
StatefulBuilder(builder: (context, setState) {
|
||||||
profileId: widget.profileId,
|
return FormBuilderSwitch(
|
||||||
token: widget.token));
|
initialValue: active,
|
||||||
}
|
activeColor: second,
|
||||||
},
|
onChanged: (value) {
|
||||||
style:
|
setState(() {
|
||||||
mainBtnStyle(primary, Colors.transparent, second),
|
active = value;
|
||||||
child: const Text(submit),
|
});
|
||||||
),
|
},
|
||||||
)
|
decoration: normalTextFieldStyle("", ''),
|
||||||
|
name: 'active',
|
||||||
|
title: const Text("Active ?"),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
width: double.infinity,
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
if (formKey.currentState!.saveAndValidate()) {
|
||||||
|
numberMail =
|
||||||
|
formKey.currentState!.value['number-mail'];
|
||||||
|
CommService commService = selectedCommProvider!;
|
||||||
|
ContactInfo contactInfo = ContactInfo(
|
||||||
|
id: state.contactInfo.id,
|
||||||
|
active: active,
|
||||||
|
primary: primaryaContact,
|
||||||
|
numbermail: numberMail,
|
||||||
|
commService: commService);
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.showWithText("Loading...");
|
||||||
|
context.read<ContactBloc>().add(
|
||||||
|
EditContactInformation(
|
||||||
|
contactInfo: contactInfo,
|
||||||
|
profileId: widget.profileId,
|
||||||
|
token: widget.token));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
style:
|
||||||
|
mainBtnStyle(primary, Colors.transparent, second),
|
||||||
|
child: const Text(submit),
|
||||||
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|
|
@ -28,7 +28,7 @@ class ContactInformationScreen extends StatelessWidget {
|
||||||
String token;
|
String token;
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: context.watch<ContactBloc>().state is ContactAddingState
|
title: context.watch<ContactBloc>().state is ContactAddingState
|
||||||
? const Text("Add Contact")
|
? const Text("Add Contact")
|
||||||
|
|
|
@ -131,7 +131,7 @@ class _ChildAlertState extends State<ChildAlert> {
|
||||||
Icons.date_range,
|
Icons.date_range,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
)),
|
)),
|
||||||
firstDate: DateTime(1970),
|
firstDate: DateTime(1900),
|
||||||
lastDate: DateTime(2100),
|
lastDate: DateTime(2100),
|
||||||
icon: const Icon(Icons.date_range),
|
icon: const Icon(Icons.date_range),
|
||||||
),
|
),
|
||||||
|
|
|
@ -7,7 +7,6 @@ import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
import 'package:unit2/bloc/profile/family/family_bloc.dart';
|
import 'package:unit2/bloc/profile/family/family_bloc.dart';
|
||||||
import 'package:unit2/model/profile/family_backround.dart';
|
import 'package:unit2/model/profile/family_backround.dart';
|
||||||
|
|
||||||
import '../../../../../model/utils/position.dart';
|
import '../../../../../model/utils/position.dart';
|
||||||
import '../../../../../theme-data.dart/btn-style.dart';
|
import '../../../../../theme-data.dart/btn-style.dart';
|
||||||
import '../../../../../theme-data.dart/colors.dart';
|
import '../../../../../theme-data.dart/colors.dart';
|
||||||
|
@ -15,7 +14,6 @@ import '../../../../../theme-data.dart/form-style.dart';
|
||||||
import '../../../../../utils/formatters.dart';
|
import '../../../../../utils/formatters.dart';
|
||||||
import '../../../../../utils/global.dart';
|
import '../../../../../utils/global.dart';
|
||||||
import '../../../../../utils/text_container.dart';
|
import '../../../../../utils/text_container.dart';
|
||||||
import '../../../../../utils/validators.dart';
|
|
||||||
|
|
||||||
class ChildEditAlert extends StatefulWidget {
|
class ChildEditAlert extends StatefulWidget {
|
||||||
final FamilyBackground familyBackground;
|
final FamilyBackground familyBackground;
|
||||||
|
@ -150,7 +148,7 @@ class _ChildEditAlertState extends State<ChildEditAlert> {
|
||||||
Icons.date_range,
|
Icons.date_range,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
)),
|
)),
|
||||||
firstDate: DateTime(1970),
|
firstDate: DateTime(1900),
|
||||||
lastDate: DateTime(2100),
|
lastDate: DateTime(2100),
|
||||||
icon: const Icon(Icons.date_range),
|
icon: const Icon(Icons.date_range),
|
||||||
),
|
),
|
||||||
|
|
|
@ -129,7 +129,7 @@ class _FatherAlertState extends State<FatherAlert> {
|
||||||
Icons.date_range,
|
Icons.date_range,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
)),
|
)),
|
||||||
firstDate: DateTime(1970),
|
firstDate: DateTime(1900),
|
||||||
lastDate: DateTime(2100),
|
lastDate: DateTime(2100),
|
||||||
icon: const Icon(Icons.date_range),
|
icon: const Icon(Icons.date_range),
|
||||||
),
|
),
|
||||||
|
|
|
@ -149,7 +149,7 @@ class _FatherEditAlertState extends State<FatherEditAlert> {
|
||||||
Icons.date_range,
|
Icons.date_range,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
)),
|
)),
|
||||||
firstDate: DateTime(1970),
|
firstDate: DateTime(1900),
|
||||||
lastDate: DateTime(2100),
|
lastDate: DateTime(2100),
|
||||||
icon: const Icon(Icons.date_range),
|
icon: const Icon(Icons.date_range),
|
||||||
),
|
),
|
||||||
|
|
|
@ -129,7 +129,7 @@ class _MotherAlertState extends State<MotherAlert> {
|
||||||
Icons.date_range,
|
Icons.date_range,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
)),
|
)),
|
||||||
firstDate: DateTime(1970),
|
firstDate: DateTime(1900),
|
||||||
lastDate: DateTime(2100),
|
lastDate: DateTime(2100),
|
||||||
icon: const Icon(Icons.date_range),
|
icon: const Icon(Icons.date_range),
|
||||||
),
|
),
|
||||||
|
|
|
@ -139,7 +139,7 @@ class _MotherEditAlertState extends State<MotherEditAlert> {
|
||||||
Icons.date_range,
|
Icons.date_range,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
)),
|
)),
|
||||||
firstDate: DateTime(1970),
|
firstDate: DateTime(1900),
|
||||||
lastDate: DateTime(2100),
|
lastDate: DateTime(2100),
|
||||||
icon: const Icon(Icons.date_range),
|
icon: const Icon(Icons.date_range),
|
||||||
),
|
),
|
||||||
|
|
|
@ -154,7 +154,7 @@ bdayController.dispose();
|
||||||
Icons.date_range,
|
Icons.date_range,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
)),
|
)),
|
||||||
firstDate: DateTime(1970),
|
firstDate: DateTime(1900),
|
||||||
lastDate: DateTime(2100),
|
lastDate: DateTime(2100),
|
||||||
icon: const Icon(Icons.date_range),
|
icon: const Icon(Icons.date_range),
|
||||||
),
|
),
|
||||||
|
|
|
@ -172,7 +172,7 @@ class _RelatedEditAlertState extends State<RelatedEditAlert> {
|
||||||
Icons.date_range,
|
Icons.date_range,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
)),
|
)),
|
||||||
firstDate: DateTime(1970),
|
firstDate: DateTime(1900),
|
||||||
lastDate: DateTime(2100),
|
lastDate: DateTime(2100),
|
||||||
icon: const Icon(Icons.date_range),
|
icon: const Icon(Icons.date_range),
|
||||||
),
|
),
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -87,381 +87,375 @@ class _EditIdentificationScreenState extends State<EditIdentificationScreen> {
|
||||||
key: formKey,
|
key: formKey,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: screenHeight * 90,
|
height: screenHeight * 90,
|
||||||
child: Column(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
FormBuilderTextField(
|
||||||
child: ListView(
|
initialValue: state.identification.agency!.name,
|
||||||
children: [
|
enabled: false,
|
||||||
FormBuilderTextField(
|
name: "",
|
||||||
initialValue: state.identification.agency!.name,
|
decoration: normalTextFieldStyle("", "").copyWith(
|
||||||
enabled: false,
|
filled: true, fillColor: Colors.black12),
|
||||||
name: "",
|
),
|
||||||
decoration: normalTextFieldStyle("", "").copyWith(
|
SizedBox(
|
||||||
filled: true, fillColor: Colors.black12),
|
height: otherAgency ? 8 : 0,
|
||||||
),
|
),
|
||||||
SizedBox(
|
|
||||||
height: otherAgency ? 8 : 0,
|
const SizedBox(
|
||||||
),
|
height: 12,
|
||||||
|
),
|
||||||
const SizedBox(
|
//// Identification numner
|
||||||
height: 12,
|
FormBuilderTextField(
|
||||||
),
|
initialValue:
|
||||||
//// Identification numner
|
state.identification.identificationNumber,
|
||||||
FormBuilderTextField(
|
validator: FormBuilderValidators.required(
|
||||||
initialValue:
|
errorText: "This field is required"),
|
||||||
state.identification.identificationNumber,
|
name: "identification_number",
|
||||||
validator: FormBuilderValidators.required(
|
decoration: normalTextFieldStyle(
|
||||||
errorText: "This field is required"),
|
"Identification Number *", ""),
|
||||||
name: "identification_number",
|
),
|
||||||
decoration: normalTextFieldStyle(
|
const SizedBox(
|
||||||
"Identification Number *", ""),
|
height: 12,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
StatefulBuilder(
|
||||||
height: 12,
|
builder: (context,setState) {
|
||||||
),
|
return Row(
|
||||||
StatefulBuilder(
|
children: [
|
||||||
builder: (context,setState) {
|
//// Date Issued
|
||||||
return Row(
|
Flexible(
|
||||||
children: [
|
flex: 1,
|
||||||
//// Date Issued
|
child: DateTimePicker(
|
||||||
Flexible(
|
controller: dateIssuedController,
|
||||||
flex: 1,
|
use24HourFormat: false,
|
||||||
child: DateTimePicker(
|
icon: const Icon(Icons.date_range),
|
||||||
controller: dateIssuedController,
|
firstDate: DateTime(1990),
|
||||||
use24HourFormat: false,
|
lastDate: DateTime(2100),
|
||||||
icon: const Icon(Icons.date_range),
|
timeHintText: "Date Issued",
|
||||||
firstDate: DateTime(1990),
|
decoration: normalTextFieldStyle(
|
||||||
lastDate: DateTime(2100),
|
"Date Issued ", "Date Issued *")
|
||||||
timeHintText: "Date Issued",
|
.copyWith(
|
||||||
decoration: normalTextFieldStyle(
|
prefixIcon: const Icon(
|
||||||
"Date Issued ", "Date Issued *")
|
Icons.date_range,
|
||||||
.copyWith(
|
color: Colors.black87,
|
||||||
prefixIcon: const Icon(
|
)),
|
||||||
Icons.date_range,
|
onChanged: (value){
|
||||||
color: Colors.black87,
|
setState((){
|
||||||
)),
|
issuedDate = value;
|
||||||
onChanged: (value){
|
});
|
||||||
setState((){
|
},
|
||||||
issuedDate = value;
|
selectableDayPredicate: (date) {
|
||||||
});
|
if ((expDate != "null" && expDate != null) &&
|
||||||
},
|
DateTime.tryParse(expDate!)!
|
||||||
selectableDayPredicate: (date) {
|
.microsecondsSinceEpoch <=
|
||||||
if ((expDate != "null" && expDate != null) &&
|
date.microsecondsSinceEpoch) {
|
||||||
DateTime.tryParse(expDate!)!
|
return false;
|
||||||
.microsecondsSinceEpoch <=
|
}
|
||||||
date.microsecondsSinceEpoch) {
|
return true;
|
||||||
return false;
|
},
|
||||||
}
|
initialDate: expDate == "null" || expDate == null
|
||||||
return true;
|
? DateTime.now()
|
||||||
},
|
: DateTime.tryParse(expDate!)?.subtract(
|
||||||
initialDate: expDate == "null" || expDate == null
|
const Duration(days: 1)),
|
||||||
? DateTime.now()
|
)),
|
||||||
: DateTime.tryParse(expDate!)?.subtract(
|
|
||||||
const Duration(days: 1)),
|
const SizedBox(
|
||||||
)),
|
width: 12,
|
||||||
|
),
|
||||||
const SizedBox(
|
//// Expiration Date
|
||||||
width: 12,
|
Flexible(
|
||||||
),
|
flex: 1,
|
||||||
//// Expiration Date
|
child: DateTimePicker(
|
||||||
Flexible(
|
controller: expirationController,
|
||||||
flex: 1,
|
use24HourFormat: false,
|
||||||
child: DateTimePicker(
|
icon: const Icon(Icons.date_range),
|
||||||
controller: expirationController,
|
firstDate: DateTime(1990),
|
||||||
use24HourFormat: false,
|
lastDate: DateTime(2100),
|
||||||
icon: const Icon(Icons.date_range),
|
timeHintText: "Expiration date",
|
||||||
firstDate: DateTime(1990),
|
onChanged: (value){
|
||||||
lastDate: DateTime(2100),
|
setState((){
|
||||||
timeHintText: "Expiration date",
|
expDate = value;
|
||||||
onChanged: (value){
|
|
||||||
setState((){
|
|
||||||
expDate = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Expiration Date",
|
|
||||||
"Expiration Date")
|
|
||||||
.copyWith(
|
|
||||||
prefixIcon: const Icon(
|
|
||||||
Icons.date_range,
|
|
||||||
color: Colors.black87,
|
|
||||||
)),
|
|
||||||
selectableDayPredicate: (date) {
|
|
||||||
if ((issuedDate != "null" && issuedDate != null) &&
|
|
||||||
DateTime.tryParse(issuedDate!)!
|
|
||||||
.microsecondsSinceEpoch >=
|
|
||||||
date.microsecondsSinceEpoch) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
initialDate: issuedDate == null && issuedDate == "null"
|
|
||||||
? DateTime.now()
|
|
||||||
: DateTime.tryParse(issuedDate!)?.add(
|
|
||||||
const Duration(days: 1)),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
|
|
||||||
//// OVERSEAS
|
|
||||||
StatefulBuilder(builder: (context, setState) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
FormBuilderSwitch(
|
|
||||||
initialValue: overseas,
|
|
||||||
activeColor: second,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
overseas = value!;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"Overseas Address?", ''),
|
"Expiration Date",
|
||||||
name: 'overseas',
|
"Expiration Date")
|
||||||
title: Text(overseas ? "YES" : "NO"),
|
.copyWith(
|
||||||
),
|
prefixIcon: const Icon(
|
||||||
SizedBox(
|
Icons.date_range,
|
||||||
height: overseas == true ? 12 : 0,
|
color: Colors.black87,
|
||||||
),
|
)),
|
||||||
SizedBox(
|
selectableDayPredicate: (date) {
|
||||||
child: overseas == false
|
if ((issuedDate != "null" && issuedDate != null) &&
|
||||||
? Column(
|
DateTime.tryParse(issuedDate!)!
|
||||||
children: [
|
.microsecondsSinceEpoch >=
|
||||||
const SizedBox(
|
date.microsecondsSinceEpoch) {
|
||||||
height: 12,
|
return false;
|
||||||
),
|
}
|
||||||
////REGION DROPDOWN
|
return true;
|
||||||
DropdownButtonFormField<Region?>(
|
},
|
||||||
|
initialDate: issuedDate == null && issuedDate == "null"
|
||||||
|
? DateTime.now()
|
||||||
|
: DateTime.tryParse(issuedDate!)?.add(
|
||||||
|
const Duration(days: 1)),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
|
||||||
|
//// OVERSEAS
|
||||||
|
StatefulBuilder(builder: (context, setState) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
FormBuilderSwitch(
|
||||||
|
initialValue: overseas,
|
||||||
|
activeColor: second,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
overseas = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Overseas Address?", ''),
|
||||||
|
name: 'overseas',
|
||||||
|
title: Text(overseas ? "YES" : "NO"),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: overseas == true ? 12 : 0,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
child: overseas == false
|
||||||
|
? Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////REGION DROPDOWN
|
||||||
|
DropdownButtonFormField<Region?>(
|
||||||
|
isExpanded: true,
|
||||||
|
autovalidateMode: AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator: FormBuilderValidators
|
||||||
|
.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
onChanged:
|
||||||
|
(Region? region) async {
|
||||||
|
if (selectedRegion != region) {
|
||||||
|
setState(() {
|
||||||
|
provinceCall = true;
|
||||||
|
});
|
||||||
|
selectedRegion = region;
|
||||||
|
try {
|
||||||
|
provinces = await LocationUtils
|
||||||
|
.instance
|
||||||
|
.getProvinces(
|
||||||
|
regionCode:
|
||||||
|
selectedRegion!
|
||||||
|
.code
|
||||||
|
.toString());
|
||||||
|
} catch (e) {
|
||||||
|
context
|
||||||
|
.read<
|
||||||
|
IdentificationBloc>()
|
||||||
|
.add(ShowErrorState(
|
||||||
|
message:
|
||||||
|
e.toString()));
|
||||||
|
}
|
||||||
|
selectedProvince =
|
||||||
|
provinces![0];
|
||||||
|
setState(() {
|
||||||
|
provinceCall = false;
|
||||||
|
cityCall = true;
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
citymuns = await LocationUtils
|
||||||
|
.instance
|
||||||
|
.getCities(
|
||||||
|
code: selectedProvince!
|
||||||
|
.code
|
||||||
|
.toString());
|
||||||
|
selectedMunicipality =
|
||||||
|
citymuns![0];
|
||||||
|
setState(() {
|
||||||
|
cityCall = false;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
NavigationService
|
||||||
|
.navigatorKey
|
||||||
|
.currentContext
|
||||||
|
?.read<
|
||||||
|
IdentificationBloc>()
|
||||||
|
.add(ShowErrorState(
|
||||||
|
message: e
|
||||||
|
.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
value: selectedRegion,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Region*", "Region"),
|
||||||
|
items: state.regions.map<
|
||||||
|
DropdownMenuItem<Region>>(
|
||||||
|
(Region region) {
|
||||||
|
return DropdownMenuItem<Region>(
|
||||||
|
value: region,
|
||||||
|
child: Text(
|
||||||
|
region.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
//// PROVINCE DROPDOWN
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.transparent,
|
||||||
|
inAsyncCall: provinceCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
Province?>(
|
||||||
|
value: selectedProvince,
|
||||||
|
autovalidateMode:
|
||||||
|
AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator: (value) =>
|
||||||
|
value == null
|
||||||
|
? 'required'
|
||||||
|
: null,
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
autovalidateMode: AutovalidateMode
|
onChanged: (Province?
|
||||||
.onUserInteraction,
|
province) async {
|
||||||
validator: FormBuilderValidators
|
if (selectedProvince !=
|
||||||
.required(
|
province) {
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
onChanged:
|
|
||||||
(Region? region) async {
|
|
||||||
if (selectedRegion != region) {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
provinceCall = true;
|
cityCall = true;
|
||||||
});
|
});
|
||||||
selectedRegion = region;
|
selectedProvince =
|
||||||
|
province;
|
||||||
try {
|
try {
|
||||||
provinces = await LocationUtils
|
citymuns = await LocationUtils
|
||||||
.instance
|
.instance
|
||||||
.getProvinces(
|
.getCities(
|
||||||
regionCode:
|
code: selectedProvince!
|
||||||
selectedRegion!
|
.code
|
||||||
.code
|
.toString());
|
||||||
.toString());
|
selectedMunicipality =
|
||||||
} catch (e) {
|
citymuns![0];
|
||||||
|
setState(() {
|
||||||
|
cityCall = false;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
context
|
context
|
||||||
.read<
|
.read<
|
||||||
IdentificationBloc>()
|
IdentificationBloc>()
|
||||||
.add(ShowErrorState(
|
.add(ShowErrorState(
|
||||||
message:
|
message: e
|
||||||
e.toString()));
|
.toString()));
|
||||||
}
|
}
|
||||||
selectedProvince =
|
|
||||||
provinces![0];
|
|
||||||
setState(() {
|
|
||||||
provinceCall = false;
|
|
||||||
cityCall = true;
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
citymuns = await LocationUtils
|
|
||||||
.instance
|
|
||||||
.getCities(
|
|
||||||
code: selectedProvince!
|
|
||||||
.code
|
|
||||||
.toString());
|
|
||||||
selectedMunicipality =
|
|
||||||
citymuns![0];
|
|
||||||
setState(() {
|
|
||||||
cityCall = false;
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
NavigationService
|
|
||||||
.navigatorKey
|
|
||||||
.currentContext
|
|
||||||
?.read<
|
|
||||||
IdentificationBloc>()
|
|
||||||
.add(ShowErrorState(
|
|
||||||
message: e
|
|
||||||
.toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
value: selectedRegion,
|
items: provinces == null
|
||||||
decoration: normalTextFieldStyle(
|
? []
|
||||||
"Region*", "Region"),
|
: provinces!.map<
|
||||||
items: state.regions.map<
|
DropdownMenuItem<
|
||||||
DropdownMenuItem<Region>>(
|
Province>>(
|
||||||
(Region region) {
|
(Province
|
||||||
return DropdownMenuItem<Region>(
|
|
||||||
value: region,
|
|
||||||
child: Text(
|
|
||||||
region.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
//// PROVINCE DROPDOWN
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.transparent,
|
|
||||||
inAsyncCall: provinceCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
Province?>(
|
|
||||||
value: selectedProvince,
|
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode
|
|
||||||
.onUserInteraction,
|
|
||||||
validator: (value) =>
|
|
||||||
value == null
|
|
||||||
? 'required'
|
|
||||||
: null,
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged: (Province?
|
|
||||||
province) async {
|
|
||||||
if (selectedProvince !=
|
|
||||||
province) {
|
province) {
|
||||||
setState(() {
|
return DropdownMenuItem(
|
||||||
cityCall = true;
|
value: province,
|
||||||
});
|
child:
|
||||||
selectedProvince =
|
FittedBox(
|
||||||
province;
|
child: Text(
|
||||||
try {
|
province
|
||||||
citymuns = await LocationUtils
|
.description!),
|
||||||
.instance
|
));
|
||||||
.getCities(
|
}).toList(),
|
||||||
code: selectedProvince!
|
decoration:
|
||||||
.code
|
normalTextFieldStyle(
|
||||||
.toString());
|
"Province *",
|
||||||
selectedMunicipality =
|
"Province")),
|
||||||
citymuns![0];
|
),
|
||||||
setState(() {
|
),
|
||||||
cityCall = false;
|
////CITY MUNICIPALITY
|
||||||
});
|
SizedBox(
|
||||||
} catch (e) {
|
height: 60,
|
||||||
context
|
child: ModalProgressHUD(
|
||||||
.read<
|
color: Colors.white,
|
||||||
IdentificationBloc>()
|
inAsyncCall: cityCall,
|
||||||
.add(ShowErrorState(
|
child: DropdownButtonFormField<
|
||||||
message: e
|
CityMunicipality>(
|
||||||
.toString()));
|
validator: FormBuilderValidators
|
||||||
}
|
.required(
|
||||||
}
|
|
||||||
},
|
|
||||||
items: provinces == null
|
|
||||||
? []
|
|
||||||
: provinces!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Province>>(
|
|
||||||
(Province
|
|
||||||
province) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: province,
|
|
||||||
child:
|
|
||||||
FittedBox(
|
|
||||||
child: Text(
|
|
||||||
province
|
|
||||||
.description!),
|
|
||||||
));
|
|
||||||
}).toList(),
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Province *",
|
|
||||||
"Province")),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
////CITY MUNICIPALITY
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: cityCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
CityMunicipality>(
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged:
|
|
||||||
(CityMunicipality? city) {
|
|
||||||
if (selectedMunicipality !=
|
|
||||||
city) {
|
|
||||||
selectedMunicipality =
|
|
||||||
city;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Municipality *",
|
|
||||||
"Municipality"),
|
|
||||||
value: selectedMunicipality,
|
|
||||||
items: citymuns == null
|
|
||||||
? []
|
|
||||||
: citymuns!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
CityMunicipality>>(
|
|
||||||
(CityMunicipality c) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: c,
|
|
||||||
child: Text(c
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
//// COUNTRY DROPDOWN
|
|
||||||
: SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child:
|
|
||||||
DropdownButtonFormField<Country>(
|
|
||||||
isExpanded: true,
|
|
||||||
validator:
|
|
||||||
FormBuilderValidators.required(
|
|
||||||
errorText:
|
errorText:
|
||||||
"This field is required"),
|
"This field is required"),
|
||||||
items: state.countries
|
isExpanded: true,
|
||||||
.map<DropdownMenuItem<Country>>(
|
onChanged:
|
||||||
(Country country) {
|
(CityMunicipality? city) {
|
||||||
return DropdownMenuItem<Country>(
|
if (selectedMunicipality !=
|
||||||
value: country,
|
city) {
|
||||||
child: FittedBox(
|
selectedMunicipality =
|
||||||
child:
|
city;
|
||||||
Text(country.name!)));
|
}
|
||||||
}).toList(),
|
|
||||||
value: selectedCountry?.id==175?null:selectedCountry,
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Country *", "Country"),
|
|
||||||
onChanged: (Country? value) {
|
|
||||||
selectedCountry = value;
|
|
||||||
},
|
},
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Municipality *",
|
||||||
|
"Municipality"),
|
||||||
|
value: selectedMunicipality,
|
||||||
|
items: citymuns == null
|
||||||
|
? []
|
||||||
|
: citymuns!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
CityMunicipality>>(
|
||||||
|
(CityMunicipality c) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: c,
|
||||||
|
child: Text(c
|
||||||
|
.description!));
|
||||||
|
}).toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
)
|
||||||
}),
|
//// COUNTRY DROPDOWN
|
||||||
|
: SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child:
|
||||||
|
DropdownButtonFormField<Country>(
|
||||||
|
isExpanded: true,
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
items: state.countries
|
||||||
|
.map<DropdownMenuItem<Country>>(
|
||||||
|
(Country country) {
|
||||||
|
return DropdownMenuItem<Country>(
|
||||||
|
value: country,
|
||||||
|
child: FittedBox(
|
||||||
|
child:
|
||||||
|
Text(country.name!)));
|
||||||
|
}).toList(),
|
||||||
|
value: selectedCountry?.id==175?null:selectedCountry,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Country *", "Country"),
|
||||||
|
onChanged: (Country? value) {
|
||||||
|
selectedCountry = value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
),
|
}),
|
||||||
SizedBox(
|
|
||||||
|
const SizedBox(height: 8,),
|
||||||
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 60,
|
height: 60,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
@ -522,7 +516,6 @@ class _EditIdentificationScreenState extends State<EditIdentificationScreen> {
|
||||||
},
|
},
|
||||||
child: const Text(submit)),
|
child: const Text(submit)),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 24,),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
|
|
@ -3,20 +3,16 @@ 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:fluttericon/font_awesome_icons.dart';
|
|
||||||
import 'package:unit2/bloc/profile/primary_information/identification/identification_bloc.dart';
|
import 'package:unit2/bloc/profile/primary_information/identification/identification_bloc.dart';
|
||||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||||
import 'package:unit2/model/profile/basic_information/identification_information.dart';
|
|
||||||
import 'package:unit2/screens/profile/components/basic_information/identification/add_modal.dart';
|
import 'package:unit2/screens/profile/components/basic_information/identification/add_modal.dart';
|
||||||
import 'package:unit2/screens/profile/components/basic_information/identification/edit_modal.dart';
|
import 'package:unit2/screens/profile/components/basic_information/identification/edit_modal.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/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';
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
|
|
||||||
import '../../../../bloc/user/user_bloc.dart';
|
import '../../../../bloc/user/user_bloc.dart';
|
||||||
import '../../../../utils/alerts.dart';
|
import '../../../../utils/alerts.dart';
|
||||||
import '../../../../widgets/Leadings/close_leading.dart';
|
import '../../../../widgets/Leadings/close_leading.dart';
|
||||||
|
@ -29,7 +25,7 @@ class IdentificationsScreen extends StatelessWidget {
|
||||||
String? token;
|
String? token;
|
||||||
int? profileId;
|
int? profileId;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: context.watch<IdentificationBloc>().state is IdentificationAddingState ? const Text("Add Identification"):context.watch<IdentificationBloc>().state is IdentificationEditingState?const Text("Edit Identification"):const Text("Identifications"),
|
title: context.watch<IdentificationBloc>().state is IdentificationAddingState ? const Text("Add Identification"):context.watch<IdentificationBloc>().state is IdentificationEditingState?const Text("Edit Identification"):const Text("Identifications"),
|
||||||
|
|
||||||
|
|
|
@ -88,379 +88,369 @@ class _AddEducationScreenState extends State<AddEducationScreen> {
|
||||||
child: FormBuilder(
|
child: FormBuilder(
|
||||||
key: formKey,
|
key: formKey,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: blockSizeVertical * 85,
|
child: ListView(children: [
|
||||||
child: Column(
|
//// LEVEL
|
||||||
children: [
|
StatefulBuilder(builder: (context, setState) {
|
||||||
Flexible(
|
return Column(
|
||||||
child: ListView(children: [
|
children: [
|
||||||
//// LEVEL
|
FormBuilderDropdown(
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("level*", "level"),
|
||||||
|
name: "education_level",
|
||||||
|
onChanged: (EducationLevel? level) {
|
||||||
|
setState(() {
|
||||||
|
selectedLevel = level;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
items: educationLevel
|
||||||
|
.map<DropdownMenuItem<EducationLevel>>(
|
||||||
|
(EducationLevel level) {
|
||||||
|
return level.type == "label"
|
||||||
|
? DropdownMenuItem(
|
||||||
|
enabled: false,
|
||||||
|
value: level,
|
||||||
|
child: Text(level.value.toUpperCase(),
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black38)))
|
||||||
|
: DropdownMenuItem(
|
||||||
|
value: level,
|
||||||
|
enabled: true,
|
||||||
|
child: Text(
|
||||||
|
" ${level.value.toUpperCase()}"));
|
||||||
|
}).toList()),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////school
|
||||||
StatefulBuilder(builder: (context, setState) {
|
StatefulBuilder(builder: (context, setState) {
|
||||||
return Column(
|
return SearchField(
|
||||||
children: [
|
inputFormatters: [UpperCaseTextFormatter()],
|
||||||
FormBuilderDropdown(
|
itemHeight: 70,
|
||||||
validator: FormBuilderValidators.required(
|
suggestionsDecoration: box1(),
|
||||||
errorText: "This field is required"),
|
suggestions: state.schools
|
||||||
decoration:
|
.map((School school) =>
|
||||||
normalTextFieldStyle("level*", "level"),
|
SearchFieldListItem(school.name!,
|
||||||
name: "education_level",
|
item: school,
|
||||||
onChanged: (EducationLevel? level) {
|
child: Padding(
|
||||||
setState(() {
|
padding: const EdgeInsets.symmetric(
|
||||||
selectedLevel = level;
|
horizontal: 10),
|
||||||
});
|
child: ListTile(
|
||||||
},
|
title: Text(school.name!,overflow: TextOverflow.visible,)),
|
||||||
items: educationLevel
|
)))
|
||||||
.map<DropdownMenuItem<EducationLevel>>(
|
.toList(),
|
||||||
(EducationLevel level) {
|
validator: (agency) {
|
||||||
return level.type == "label"
|
if (agency!.isEmpty) {
|
||||||
? DropdownMenuItem(
|
return "This field is required";
|
||||||
enabled: false,
|
}
|
||||||
value: level,
|
return null;
|
||||||
child: Text(level.value.toUpperCase(),
|
},
|
||||||
style: const TextStyle(
|
focusNode: schoolFocusNode,
|
||||||
color: Colors.black38)))
|
searchInputDecoration:
|
||||||
: DropdownMenuItem(
|
normalTextFieldStyle("School *", "").copyWith(
|
||||||
value: level,
|
suffixIcon: IconButton(
|
||||||
enabled: true,
|
icon: const Icon(Icons.arrow_drop_down),
|
||||||
child: Text(
|
onPressed: () {
|
||||||
" ${level.value.toUpperCase()}"));
|
schoolFocusNode.unfocus();
|
||||||
}).toList()),
|
},
|
||||||
const SizedBox(
|
)),
|
||||||
height: 12,
|
onSuggestionTap: (school) {
|
||||||
),
|
setState(() {
|
||||||
////school
|
selectedSchool = school.item;
|
||||||
StatefulBuilder(builder: (context, setState) {
|
schoolFocusNode.unfocus();
|
||||||
return SearchField(
|
});
|
||||||
inputFormatters: [UpperCaseTextFormatter()],
|
},
|
||||||
itemHeight: 70,
|
emptyWidget: EmptyWidget(
|
||||||
suggestionsDecoration: box1(),
|
title: "Add School",
|
||||||
suggestions: state.schools
|
controller: addSchoolController,
|
||||||
.map((School school) =>
|
onpressed: () {
|
||||||
SearchFieldListItem(school.name!,
|
setState(() {
|
||||||
item: school,
|
School newSchool = School(
|
||||||
child: Padding(
|
id: null,
|
||||||
padding: const EdgeInsets.symmetric(
|
name: addSchoolController.text
|
||||||
horizontal: 10),
|
.toUpperCase());
|
||||||
child: ListTile(
|
state.schools.insert(0, newSchool);
|
||||||
title: Text(school.name!,overflow: TextOverflow.visible,)),
|
addSchoolController.text = "";
|
||||||
)))
|
|
||||||
.toList(),
|
Navigator.pop(context);
|
||||||
validator: (agency) {
|
});
|
||||||
if (agency!.isEmpty) {
|
}),
|
||||||
return "This field is required";
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
focusNode: schoolFocusNode,
|
|
||||||
searchInputDecoration:
|
|
||||||
normalTextFieldStyle("School *", "").copyWith(
|
|
||||||
suffixIcon: IconButton(
|
|
||||||
icon: const Icon(Icons.arrow_drop_down),
|
|
||||||
onPressed: () {
|
|
||||||
schoolFocusNode.unfocus();
|
|
||||||
},
|
|
||||||
)),
|
|
||||||
onSuggestionTap: (school) {
|
|
||||||
setState(() {
|
|
||||||
selectedSchool = school.item;
|
|
||||||
schoolFocusNode.unfocus();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
emptyWidget: EmptyWidget(
|
|
||||||
title: "Add School",
|
|
||||||
controller: addSchoolController,
|
|
||||||
onpressed: () {
|
|
||||||
setState(() {
|
|
||||||
School newSchool = School(
|
|
||||||
id: null,
|
|
||||||
name: addSchoolController.text
|
|
||||||
.toUpperCase());
|
|
||||||
state.schools.insert(0, newSchool);
|
|
||||||
addSchoolController.text = "";
|
|
||||||
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
////Programs
|
|
||||||
Container(
|
|
||||||
child: selectedLevel != null &&
|
|
||||||
selectedLevel!.group != 1
|
|
||||||
? SearchField(
|
|
||||||
inputFormatters: [
|
|
||||||
UpperCaseTextFormatter()
|
|
||||||
],
|
|
||||||
itemHeight: 100,
|
|
||||||
suggestionsDecoration: box1(),
|
|
||||||
suggestions: state.programs
|
|
||||||
.map((Course program) =>
|
|
||||||
SearchFieldListItem(
|
|
||||||
program.program!,
|
|
||||||
item: program,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets
|
|
||||||
.symmetric(
|
|
||||||
horizontal: 10),
|
|
||||||
child: ListTile(
|
|
||||||
title: Text(
|
|
||||||
program.program!,overflow: TextOverflow.visible,)),
|
|
||||||
)))
|
|
||||||
.toList(),
|
|
||||||
validator: (agency) {
|
|
||||||
if (agency!.isEmpty) {
|
|
||||||
return "This field is required";
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
focusNode: programFocusNode,
|
|
||||||
searchInputDecoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Course/Programs *", "")
|
|
||||||
.copyWith(
|
|
||||||
suffixIcon: GestureDetector(
|
|
||||||
onTap: () => programFocusNode.unfocus(),
|
|
||||||
child: const Icon(
|
|
||||||
Icons.arrow_drop_down),
|
|
||||||
)),
|
|
||||||
onSuggestionTap: (position) {
|
|
||||||
setState(() {
|
|
||||||
selectedProgram = position.item;
|
|
||||||
programFocusNode.unfocus();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
emptyWidget: EmptyWidget(
|
|
||||||
title: "Add Program",
|
|
||||||
controller: addProgramController,
|
|
||||||
onpressed: () {
|
|
||||||
setState(() {
|
|
||||||
Course newProgram = Course(
|
|
||||||
id: null,
|
|
||||||
program: addProgramController
|
|
||||||
.text
|
|
||||||
.toUpperCase());
|
|
||||||
state.programs
|
|
||||||
.insert(0, newProgram);
|
|
||||||
addProgramController.text = "";
|
|
||||||
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
: Container())
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
StatefulBuilder(builder: (context, setState) {
|
////Programs
|
||||||
return Column(
|
Container(
|
||||||
|
child: selectedLevel != null &&
|
||||||
|
selectedLevel!.group != 1
|
||||||
|
? SearchField(
|
||||||
|
inputFormatters: [
|
||||||
|
UpperCaseTextFormatter()
|
||||||
|
],
|
||||||
|
itemHeight: 100,
|
||||||
|
suggestionsDecoration: box1(),
|
||||||
|
suggestions: state.programs
|
||||||
|
.map((Course program) =>
|
||||||
|
SearchFieldListItem(
|
||||||
|
program.program!,
|
||||||
|
item: program,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets
|
||||||
|
.symmetric(
|
||||||
|
horizontal: 10),
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(
|
||||||
|
program.program!,overflow: TextOverflow.visible,)),
|
||||||
|
)))
|
||||||
|
.toList(),
|
||||||
|
validator: (agency) {
|
||||||
|
if (agency!.isEmpty) {
|
||||||
|
return "This field is required";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
focusNode: programFocusNode,
|
||||||
|
searchInputDecoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Course/Programs *", "")
|
||||||
|
.copyWith(
|
||||||
|
suffixIcon: GestureDetector(
|
||||||
|
onTap: () => programFocusNode.unfocus(),
|
||||||
|
child: const Icon(
|
||||||
|
Icons.arrow_drop_down),
|
||||||
|
)),
|
||||||
|
onSuggestionTap: (position) {
|
||||||
|
setState(() {
|
||||||
|
selectedProgram = position.item;
|
||||||
|
programFocusNode.unfocus();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
emptyWidget: EmptyWidget(
|
||||||
|
title: "Add Program",
|
||||||
|
controller: addProgramController,
|
||||||
|
onpressed: () {
|
||||||
|
setState(() {
|
||||||
|
Course newProgram = Course(
|
||||||
|
id: null,
|
||||||
|
program: addProgramController
|
||||||
|
.text
|
||||||
|
.toUpperCase());
|
||||||
|
state.programs
|
||||||
|
.insert(0, newProgram);
|
||||||
|
addProgramController.text = "";
|
||||||
|
|
||||||
|
Navigator.pop(context);
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
: Container())
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
StatefulBuilder(builder: (context, setState) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
//// GRADUATED SWITCH
|
||||||
|
FormBuilderSwitch(
|
||||||
|
initialValue: graduated,
|
||||||
|
activeColor: second,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
graduated = value!;
|
||||||
|
if (graduated) {
|
||||||
|
unitsEarned = null;
|
||||||
|
} else {
|
||||||
|
yearGraduated.text = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Graduated?", 'Graduated?'),
|
||||||
|
name: 'graudated',
|
||||||
|
title: Text(graduated ? "YES" : "NO"),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////FROM
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
//// GRADUATED SWITCH
|
Flexible(
|
||||||
FormBuilderSwitch(
|
flex: 1,
|
||||||
initialValue: graduated,
|
child: FormBuilderTextField(
|
||||||
activeColor: second,
|
validator: FormBuilderValidators.required(
|
||||||
onChanged: (value) {
|
errorText: "This fied is required"),
|
||||||
setState(() {
|
decoration:
|
||||||
graduated = value!;
|
normalTextFieldStyle("from *", "from"),
|
||||||
if (graduated) {
|
name: "",
|
||||||
unitsEarned = null;
|
controller: fromController,
|
||||||
} else {
|
onTap: () {
|
||||||
yearGraduated.text = "";
|
showDialog(
|
||||||
}
|
context: context,
|
||||||
});
|
builder: (BuildContext context) {
|
||||||
},
|
return AlertDialog(
|
||||||
decoration: normalTextFieldStyle(
|
content: SizedBox(
|
||||||
"Graduated?", 'Graduated?'),
|
width: 300,
|
||||||
name: 'graudated',
|
height: 300,
|
||||||
title: Text(graduated ? "YES" : "NO"),
|
child: YearPicker(
|
||||||
),
|
firstDate: DateTime(
|
||||||
const SizedBox(
|
DateTime.now().year - 100,
|
||||||
height: 12,
|
1),
|
||||||
),
|
lastDate: DateTime(
|
||||||
////FROM
|
DateTime.now().year + 100,
|
||||||
SizedBox(
|
1),
|
||||||
width: screenWidth,
|
initialDate: DateTime.now(),
|
||||||
child: Row(
|
selectedDate: DateTime.now(),
|
||||||
children: [
|
onChanged: (DateTime dateTime) {
|
||||||
Flexible(
|
fromController.text =
|
||||||
flex: 1,
|
dateTime.year.toString();
|
||||||
child: FormBuilderTextField(
|
Navigator.pop(context);
|
||||||
validator: FormBuilderValidators.required(
|
},
|
||||||
errorText: "This fied is required"),
|
),
|
||||||
decoration:
|
),
|
||||||
normalTextFieldStyle("from *", "from"),
|
);
|
||||||
name: "",
|
},
|
||||||
controller: fromController,
|
);
|
||||||
onTap: () {
|
},
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
content: SizedBox(
|
|
||||||
width: 300,
|
|
||||||
height: 300,
|
|
||||||
child: YearPicker(
|
|
||||||
firstDate: DateTime(
|
|
||||||
DateTime.now().year - 100,
|
|
||||||
1),
|
|
||||||
lastDate: DateTime(
|
|
||||||
DateTime.now().year + 100,
|
|
||||||
1),
|
|
||||||
initialDate: DateTime.now(),
|
|
||||||
selectedDate: DateTime.now(),
|
|
||||||
onChanged: (DateTime dateTime) {
|
|
||||||
fromController.text =
|
|
||||||
dateTime.year.toString();
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 8,
|
|
||||||
),
|
|
||||||
////UNTIL
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
validator: FormBuilderValidators.required(
|
|
||||||
errorText: "This fied is required"),
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"until *", "until"),
|
|
||||||
name: "",
|
|
||||||
controller: untilController,
|
|
||||||
onTap: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
content: SizedBox(
|
|
||||||
width: 300,
|
|
||||||
height: 300,
|
|
||||||
child: YearPicker(
|
|
||||||
firstDate: DateTime(
|
|
||||||
DateTime.now().year - 100,
|
|
||||||
1),
|
|
||||||
lastDate: DateTime(
|
|
||||||
DateTime.now().year + 100,
|
|
||||||
1),
|
|
||||||
initialDate: DateTime.now(),
|
|
||||||
selectedDate: DateTime.now(),
|
|
||||||
onChanged: (DateTime dateTime) {
|
|
||||||
untilController.text =
|
|
||||||
dateTime.year.toString();
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 8,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
width: 8,
|
||||||
),
|
),
|
||||||
SizedBox(
|
////UNTIL
|
||||||
child: graduated
|
Flexible(
|
||||||
////GRADUATED YEAR
|
flex: 1,
|
||||||
? FormBuilderTextField(
|
child: FormBuilderTextField(
|
||||||
validator: FormBuilderValidators.required(
|
validator: FormBuilderValidators.required(
|
||||||
errorText: "This fied is required"),
|
errorText: "This fied is required"),
|
||||||
onTap: () {
|
decoration: normalTextFieldStyle(
|
||||||
showDialog(
|
"until *", "until"),
|
||||||
context: context,
|
name: "",
|
||||||
builder: (BuildContext context) {
|
controller: untilController,
|
||||||
return AlertDialog(
|
onTap: () {
|
||||||
content: SizedBox(
|
showDialog(
|
||||||
width: 300,
|
context: context,
|
||||||
height: 300,
|
builder: (BuildContext context) {
|
||||||
child: YearPicker(
|
return AlertDialog(
|
||||||
firstDate: DateTime(
|
content: SizedBox(
|
||||||
DateTime.now().year - 100,
|
width: 300,
|
||||||
1),
|
height: 300,
|
||||||
lastDate: DateTime(
|
child: YearPicker(
|
||||||
DateTime.now().year + 100,
|
firstDate: DateTime(
|
||||||
1),
|
DateTime.now().year - 100,
|
||||||
initialDate: DateTime.now(),
|
1),
|
||||||
selectedDate: DateTime.now(),
|
lastDate: DateTime(
|
||||||
onChanged: (DateTime dateTime) {
|
DateTime.now().year + 100,
|
||||||
yearGraduated.text =
|
1),
|
||||||
dateTime.year.toString();
|
initialDate: DateTime.now(),
|
||||||
Navigator.pop(context);
|
selectedDate: DateTime.now(),
|
||||||
},
|
onChanged: (DateTime dateTime) {
|
||||||
),
|
untilController.text =
|
||||||
),
|
dateTime.year.toString();
|
||||||
);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
name: "year_graduated",
|
);
|
||||||
controller: yearGraduated,
|
},
|
||||||
decoration: normalTextFieldStyle(
|
);
|
||||||
"Year Graduated *", "Year Graduated *"),
|
},
|
||||||
)
|
),
|
||||||
//// HIGHEST UNITS EARNED
|
),
|
||||||
: FormBuilderTextField(
|
const SizedBox(
|
||||||
validator: FormBuilderValidators.required(
|
width: 8,
|
||||||
errorText: "This fied is required"),
|
|
||||||
name: "units_earned",
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Highest Level/Units Earned *",
|
|
||||||
"Highest Level/Units Earned *")),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
),
|
||||||
}),
|
),
|
||||||
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
//// HONORS
|
SizedBox(
|
||||||
MultiSelectDropDown(
|
child: graduated
|
||||||
onOptionSelected: (List<ValueItem> selectedOptions) {
|
////GRADUATED YEAR
|
||||||
selectedValueItem = selectedOptions;
|
? FormBuilderTextField(
|
||||||
},
|
validator: FormBuilderValidators.required(
|
||||||
borderColor: Colors.grey,
|
errorText: "This fied is required"),
|
||||||
borderWidth: 1,
|
onTap: () {
|
||||||
borderRadius: 5,
|
showDialog(
|
||||||
hint: "Honors",
|
context: context,
|
||||||
padding: const EdgeInsets.all(8),
|
builder: (BuildContext context) {
|
||||||
options: valueItemHonorList,
|
return AlertDialog(
|
||||||
selectionType: SelectionType.multi,
|
content: SizedBox(
|
||||||
chipConfig: const ChipConfig(wrapType: WrapType.wrap),
|
width: 300,
|
||||||
dropdownHeight: 300,
|
height: 300,
|
||||||
optionTextStyle: const TextStyle(fontSize: 16),
|
child: YearPicker(
|
||||||
selectedOptionIcon: const Icon(Icons.check_circle),
|
firstDate: DateTime(
|
||||||
|
DateTime.now().year - 100,
|
||||||
|
1),
|
||||||
|
lastDate: DateTime(
|
||||||
|
DateTime.now().year + 100,
|
||||||
|
1),
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
selectedDate: DateTime.now(),
|
||||||
|
onChanged: (DateTime dateTime) {
|
||||||
|
yearGraduated.text =
|
||||||
|
dateTime.year.toString();
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
name: "year_graduated",
|
||||||
|
controller: yearGraduated,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Year Graduated *", "Year Graduated *"),
|
||||||
|
)
|
||||||
|
//// HIGHEST UNITS EARNED
|
||||||
|
: FormBuilderTextField(
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This fied is required"),
|
||||||
|
name: "units_earned",
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Highest Level/Units Earned *",
|
||||||
|
"Highest Level/Units Earned *")),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
],
|
||||||
height: 25,
|
);
|
||||||
),
|
}),
|
||||||
////sumit button
|
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
const SizedBox(
|
),
|
||||||
height: 20,
|
//// HONORS
|
||||||
),
|
MultiSelectDropDown(
|
||||||
]),
|
onOptionSelected: (List<ValueItem> selectedOptions) {
|
||||||
),
|
selectedValueItem = selectedOptions;
|
||||||
SizedBox(
|
},
|
||||||
|
borderColor: Colors.grey,
|
||||||
|
borderWidth: 1,
|
||||||
|
borderRadius: 5,
|
||||||
|
hint: "Honors",
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
options: valueItemHonorList,
|
||||||
|
selectionType: SelectionType.multi,
|
||||||
|
chipConfig: const ChipConfig(wrapType: WrapType.wrap),
|
||||||
|
dropdownHeight: 300,
|
||||||
|
optionTextStyle: const TextStyle(fontSize: 16),
|
||||||
|
selectedOptionIcon: const Icon(Icons.check_circle),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 25,
|
||||||
|
),
|
||||||
|
////sumit button
|
||||||
|
|
||||||
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 60,
|
height: 60,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
@ -520,9 +510,8 @@ class _AddEducationScreenState extends State<AddEducationScreen> {
|
||||||
child: const Text(submit)),
|
child: const Text(submit)),
|
||||||
|
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
]),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -115,403 +115,398 @@ class _EditEducationScreenState extends State<EditEducationScreen> {
|
||||||
key: formKey,
|
key: formKey,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: blockSizeVertical * 85,
|
height: blockSizeVertical * 85,
|
||||||
child: Column(
|
child: ListView(children: [
|
||||||
children: [
|
|
||||||
Flexible(
|
//// LEVEL
|
||||||
child: ListView(children: [
|
StatefulBuilder(builder: (context, setState) {
|
||||||
|
return Column(
|
||||||
//// LEVEL
|
children: [
|
||||||
|
FormBuilderDropdown(
|
||||||
|
initialValue: selectedLevel,
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("level*", "level"),
|
||||||
|
name: "education_level",
|
||||||
|
onChanged: (EducationLevel? level) {
|
||||||
|
setState(() {
|
||||||
|
selectedLevel = level;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
items: educationLevel
|
||||||
|
.map<DropdownMenuItem<EducationLevel>>(
|
||||||
|
(EducationLevel level) {
|
||||||
|
return level.type == "label"
|
||||||
|
? DropdownMenuItem(
|
||||||
|
enabled: false,
|
||||||
|
value: level,
|
||||||
|
child: Text(level.value.toUpperCase(),
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black38)))
|
||||||
|
: DropdownMenuItem(
|
||||||
|
value: level,
|
||||||
|
enabled: true,
|
||||||
|
child: Text(
|
||||||
|
" ${level.value.toUpperCase()}"));
|
||||||
|
}).toList()),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////school
|
||||||
StatefulBuilder(builder: (context, setState) {
|
StatefulBuilder(builder: (context, setState) {
|
||||||
return Column(
|
return SearchField(
|
||||||
children: [
|
inputFormatters: [
|
||||||
FormBuilderDropdown(
|
UpperCaseTextFormatter()
|
||||||
initialValue: selectedLevel,
|
],
|
||||||
validator: FormBuilderValidators.required(
|
|
||||||
errorText: "This field is required"),
|
suggestionAction: SuggestionAction.next,
|
||||||
decoration:
|
onSubmit: (p0) {
|
||||||
normalTextFieldStyle("level*", "level"),
|
schoolFocusNode.unfocus();
|
||||||
name: "education_level",
|
},
|
||||||
onChanged: (EducationLevel? level) {
|
controller: currentSchoolController,
|
||||||
setState(() {
|
itemHeight: 70,
|
||||||
selectedLevel = level;
|
suggestionsDecoration: box1(),
|
||||||
});
|
suggestions: state.schools
|
||||||
},
|
.map((School school) =>
|
||||||
items: educationLevel
|
SearchFieldListItem(school.name!,
|
||||||
.map<DropdownMenuItem<EducationLevel>>(
|
item: school,
|
||||||
(EducationLevel level) {
|
child: Padding(
|
||||||
return level.type == "label"
|
padding: const EdgeInsets.symmetric(
|
||||||
? DropdownMenuItem(
|
horizontal: 10),
|
||||||
enabled: false,
|
child: ListTile(
|
||||||
value: level,
|
title: Text(school.name!,overflow: TextOverflow.visible,)),
|
||||||
child: Text(level.value.toUpperCase(),
|
)))
|
||||||
style: const TextStyle(
|
.toList(),
|
||||||
color: Colors.black38)))
|
validator: (agency) {
|
||||||
: DropdownMenuItem(
|
if (agency!.isEmpty) {
|
||||||
value: level,
|
return "This field is required";
|
||||||
enabled: true,
|
}
|
||||||
child: Text(
|
return null;
|
||||||
" ${level.value.toUpperCase()}"));
|
},
|
||||||
}).toList()),
|
focusNode: schoolFocusNode,
|
||||||
const SizedBox(
|
searchInputDecoration:
|
||||||
height: 12,
|
normalTextFieldStyle("School *", "").copyWith(
|
||||||
),
|
suffixIcon: GestureDetector(
|
||||||
////school
|
child: const Icon(Icons.arrow_drop_down),
|
||||||
StatefulBuilder(builder: (context, setState) {
|
onTap: () {
|
||||||
return SearchField(
|
schoolFocusNode.unfocus();
|
||||||
inputFormatters: [
|
},
|
||||||
UpperCaseTextFormatter()
|
)),
|
||||||
],
|
onSuggestionTap: (school) {
|
||||||
|
setState(() {
|
||||||
suggestionAction: SuggestionAction.next,
|
selectedSchool = school.item;
|
||||||
onSubmit: (p0) {
|
schoolFocusNode.unfocus();
|
||||||
schoolFocusNode.unfocus();
|
});
|
||||||
},
|
},
|
||||||
controller: currentSchoolController,
|
emptyWidget: EmptyWidget(
|
||||||
itemHeight: 70,
|
title: "Add School",
|
||||||
suggestionsDecoration: box1(),
|
controller: addSchoolController,
|
||||||
suggestions: state.schools
|
onpressed: () {
|
||||||
.map((School school) =>
|
|
||||||
SearchFieldListItem(school.name!,
|
|
||||||
item: school,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 10),
|
|
||||||
child: ListTile(
|
|
||||||
title: Text(school.name!,overflow: TextOverflow.visible,)),
|
|
||||||
)))
|
|
||||||
.toList(),
|
|
||||||
validator: (agency) {
|
|
||||||
if (agency!.isEmpty) {
|
|
||||||
return "This field is required";
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
focusNode: schoolFocusNode,
|
|
||||||
searchInputDecoration:
|
|
||||||
normalTextFieldStyle("School *", "").copyWith(
|
|
||||||
suffixIcon: GestureDetector(
|
|
||||||
child: const Icon(Icons.arrow_drop_down),
|
|
||||||
onTap: () {
|
|
||||||
schoolFocusNode.unfocus();
|
|
||||||
},
|
|
||||||
)),
|
|
||||||
onSuggestionTap: (school) {
|
|
||||||
setState(() {
|
|
||||||
selectedSchool = school.item;
|
|
||||||
schoolFocusNode.unfocus();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
emptyWidget: EmptyWidget(
|
|
||||||
title: "Add School",
|
|
||||||
controller: addSchoolController,
|
|
||||||
onpressed: () {
|
|
||||||
setState(() {
|
|
||||||
School newSchool = School(
|
|
||||||
id: null,
|
|
||||||
name: addSchoolController.text
|
|
||||||
.toUpperCase());
|
|
||||||
state.schools.insert(0, newSchool);
|
|
||||||
addSchoolController.text = "";
|
|
||||||
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
|
|
||||||
////Programs
|
|
||||||
|
|
||||||
Container(
|
|
||||||
child: selectedLevel != null &&
|
|
||||||
selectedLevel!.group != 1
|
|
||||||
? SearchField(
|
|
||||||
inputFormatters: [UpperCaseTextFormatter()],
|
|
||||||
suggestionAction:
|
|
||||||
SuggestionAction.unfocus,
|
|
||||||
controller: currentProgramController,
|
|
||||||
itemHeight: 70,
|
|
||||||
suggestionsDecoration: box1(),
|
|
||||||
suggestions: state.programs
|
|
||||||
.map((Course program) =>
|
|
||||||
SearchFieldListItem(
|
|
||||||
program.program!,
|
|
||||||
item: program,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets
|
|
||||||
.symmetric(
|
|
||||||
horizontal: 10),
|
|
||||||
child: ListTile(
|
|
||||||
title: Text(
|
|
||||||
program.program!,overflow: TextOverflow.visible,)),
|
|
||||||
)))
|
|
||||||
.toList(),
|
|
||||||
validator: (agency) {
|
|
||||||
if (agency!.isEmpty) {
|
|
||||||
return "This field is required";
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
focusNode: programFocusNode,
|
|
||||||
searchInputDecoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Course/Programs *", "")
|
|
||||||
.copyWith(
|
|
||||||
suffixIcon: IconButton(
|
|
||||||
icon:const Icon(
|
|
||||||
Icons.arrow_drop_down), onPressed: () { programFocusNode.unfocus(); },),),
|
|
||||||
onSuggestionTap: (position) {
|
|
||||||
setState(() {
|
|
||||||
selectedProgram = position.item;
|
|
||||||
programFocusNode.unfocus();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
emptyWidget: EmptyWidget(
|
|
||||||
title: "Add Program",
|
|
||||||
controller: addProgramController,
|
|
||||||
onpressed: () {
|
|
||||||
setState(() {
|
|
||||||
Course newProgram = Course(
|
|
||||||
id: null,
|
|
||||||
program: addProgramController
|
|
||||||
.text
|
|
||||||
.toUpperCase());
|
|
||||||
state.programs
|
|
||||||
.insert(0, newProgram);
|
|
||||||
addProgramController.text = "";
|
|
||||||
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
: Container()),
|
|
||||||
SizedBox(height: selectedLevel != null &&
|
|
||||||
selectedLevel!.group != 1?12:0,),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
|
|
||||||
StatefulBuilder(builder: (context, setState) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
//// GRADUATED SWITCH
|
|
||||||
FormBuilderSwitch(
|
|
||||||
initialValue: graduated,
|
|
||||||
activeColor: second,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
graduated = value!;
|
School newSchool = School(
|
||||||
if (graduated) {
|
id: null,
|
||||||
unitsController.text = "";
|
name: addSchoolController.text
|
||||||
} else {
|
.toUpperCase());
|
||||||
yearGraduated.text = "";
|
state.schools.insert(0, newSchool);
|
||||||
}
|
addSchoolController.text = "";
|
||||||
|
|
||||||
|
Navigator.pop(context);
|
||||||
});
|
});
|
||||||
},
|
}),
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Graduated?", 'Graduated?'),
|
|
||||||
name: 'graudated',
|
|
||||||
title: Text(graduated ? "YES" : "NO"),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
////FROM
|
|
||||||
SizedBox(
|
|
||||||
width: screenWidth,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
validator: FormBuilderValidators.required(
|
|
||||||
errorText: "This fied is required"),
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle("from *", "from"),
|
|
||||||
name: "",
|
|
||||||
controller: fromController,
|
|
||||||
onTap: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
content: SizedBox(
|
|
||||||
width: 300,
|
|
||||||
height: 300,
|
|
||||||
child: YearPicker(
|
|
||||||
firstDate: DateTime(
|
|
||||||
DateTime.now().year - 100,
|
|
||||||
1),
|
|
||||||
lastDate: DateTime(
|
|
||||||
DateTime.now().year + 100,
|
|
||||||
1),
|
|
||||||
initialDate: DateTime.now(),
|
|
||||||
selectedDate: DateTime.now(),
|
|
||||||
onChanged: (DateTime dateTime) {
|
|
||||||
fromController.text =
|
|
||||||
dateTime.year.toString();
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 8,
|
|
||||||
),
|
|
||||||
////UNTIL
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
validator: FormBuilderValidators.required(
|
|
||||||
errorText: "This fied is required"),
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"until *", "until"),
|
|
||||||
name: "",
|
|
||||||
controller: untilController,
|
|
||||||
onTap: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
content: SizedBox(
|
|
||||||
width: 300,
|
|
||||||
height: 300,
|
|
||||||
child: YearPicker(
|
|
||||||
firstDate: DateTime(
|
|
||||||
DateTime.now().year - 100,
|
|
||||||
1),
|
|
||||||
lastDate: DateTime(
|
|
||||||
DateTime.now().year + 100,
|
|
||||||
1),
|
|
||||||
initialDate: DateTime.now(),
|
|
||||||
selectedDate: DateTime.now(),
|
|
||||||
onChanged: (DateTime dateTime) {
|
|
||||||
untilController.text =
|
|
||||||
dateTime.year.toString();
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
), const SizedBox(height: 20,),
|
|
||||||
SizedBox(
|
|
||||||
|
|
||||||
child: graduated
|
|
||||||
////GRADUATED YEAR
|
|
||||||
? FormBuilderTextField(
|
|
||||||
validator:
|
|
||||||
FormBuilderValidators.required(
|
|
||||||
errorText:
|
|
||||||
"This fied is required"),
|
|
||||||
onTap: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
content: SizedBox(
|
|
||||||
width: 300,
|
|
||||||
height: 300,
|
|
||||||
child: YearPicker(
|
|
||||||
firstDate: DateTime(
|
|
||||||
DateTime.now().year -
|
|
||||||
100,
|
|
||||||
1),
|
|
||||||
lastDate: DateTime(
|
|
||||||
DateTime.now().year +
|
|
||||||
100,
|
|
||||||
1),
|
|
||||||
initialDate:
|
|
||||||
DateTime.now(),
|
|
||||||
selectedDate:
|
|
||||||
DateTime.now(),
|
|
||||||
onChanged:
|
|
||||||
(DateTime dateTime) {
|
|
||||||
yearGraduated.text =
|
|
||||||
dateTime.year
|
|
||||||
.toString();
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
name: "year_graduated",
|
|
||||||
controller: yearGraduated,
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Year Graduated *",
|
|
||||||
"Year Graduated *"),
|
|
||||||
)
|
|
||||||
//// HIGHEST UNITS EARNED
|
|
||||||
: FormBuilderTextField(
|
|
||||||
validator:
|
|
||||||
FormBuilderValidators.required(
|
|
||||||
errorText:
|
|
||||||
"This fied is required"),
|
|
||||||
controller: unitsController,
|
|
||||||
name: "units_earned",
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Highest Level/Units Earned *",
|
|
||||||
"Highest Level/Units Earned *")),
|
|
||||||
)
|
|
||||||
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
//// HONORS
|
|
||||||
|
////Programs
|
||||||
StatefulBuilder(builder: (context, setState) {
|
|
||||||
return MultiSelectDropDown(
|
Container(
|
||||||
onOptionSelected: (List<ValueItem> selectedOptions) {
|
child: selectedLevel != null &&
|
||||||
selectedValueItem = selectedOptions;
|
selectedLevel!.group != 1
|
||||||
},
|
? SearchField(
|
||||||
borderColor: Colors.grey,
|
inputFormatters: [UpperCaseTextFormatter()],
|
||||||
borderWidth: 1,
|
suggestionAction:
|
||||||
borderRadius: 5,
|
SuggestionAction.unfocus,
|
||||||
hint: "Honors",
|
controller: currentProgramController,
|
||||||
padding: const EdgeInsets.all(8),
|
itemHeight: 70,
|
||||||
options: valueItemHonorList,
|
suggestionsDecoration: box1(),
|
||||||
selectionType: SelectionType.multi,
|
suggestions: state.programs
|
||||||
chipConfig: const ChipConfig(wrapType: WrapType.wrap),
|
.map((Course program) =>
|
||||||
dropdownHeight: 300,
|
SearchFieldListItem(
|
||||||
optionTextStyle: const TextStyle(fontSize: 16),
|
program.program!,
|
||||||
selectedOptionIcon: const Icon(Icons.check_circle),
|
item: program,
|
||||||
selectedOptions:
|
child: Padding(
|
||||||
(state.educationalBackground.honors!.isNotEmpty &&
|
padding: const EdgeInsets
|
||||||
state.educationalBackground.honors != null)
|
.symmetric(
|
||||||
? selectedValueItem = state
|
horizontal: 10),
|
||||||
.educationalBackground.honors!
|
child: ListTile(
|
||||||
.map((Honor honor) => ValueItem(
|
title: Text(
|
||||||
label: honor.name!, value: honor.name))
|
program.program!,overflow: TextOverflow.visible,)),
|
||||||
.toList()
|
)))
|
||||||
: [],
|
.toList(),
|
||||||
);
|
validator: (agency) {
|
||||||
}),
|
if (agency!.isEmpty) {
|
||||||
|
return "This field is required";
|
||||||
]),
|
}
|
||||||
),
|
return null;
|
||||||
////sumit button
|
},
|
||||||
|
focusNode: programFocusNode,
|
||||||
|
searchInputDecoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Course/Programs *", "")
|
||||||
|
.copyWith(
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon:const Icon(
|
||||||
|
Icons.arrow_drop_down), onPressed: () { programFocusNode.unfocus(); },),),
|
||||||
|
onSuggestionTap: (position) {
|
||||||
|
setState(() {
|
||||||
|
selectedProgram = position.item;
|
||||||
|
programFocusNode.unfocus();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
emptyWidget: EmptyWidget(
|
||||||
|
title: "Add Program",
|
||||||
|
controller: addProgramController,
|
||||||
|
onpressed: () {
|
||||||
|
setState(() {
|
||||||
|
Course newProgram = Course(
|
||||||
|
id: null,
|
||||||
|
program: addProgramController
|
||||||
|
.text
|
||||||
|
.toUpperCase());
|
||||||
|
state.programs
|
||||||
|
.insert(0, newProgram);
|
||||||
|
addProgramController.text = "";
|
||||||
|
|
||||||
|
Navigator.pop(context);
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
: Container()),
|
||||||
|
SizedBox(height: selectedLevel != null &&
|
||||||
|
selectedLevel!.group != 1?12:0,),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
|
||||||
|
StatefulBuilder(builder: (context, setState) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
//// GRADUATED SWITCH
|
||||||
|
FormBuilderSwitch(
|
||||||
|
initialValue: graduated,
|
||||||
|
activeColor: second,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
graduated = value!;
|
||||||
|
if (graduated) {
|
||||||
|
unitsController.text = "";
|
||||||
|
} else {
|
||||||
|
yearGraduated.text = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Graduated?", 'Graduated?'),
|
||||||
|
name: 'graudated',
|
||||||
|
title: Text(graduated ? "YES" : "NO"),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////FROM
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This fied is required"),
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("from *", "from"),
|
||||||
|
name: "",
|
||||||
|
controller: fromController,
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
content: SizedBox(
|
||||||
|
width: 300,
|
||||||
|
height: 300,
|
||||||
|
child: YearPicker(
|
||||||
|
firstDate: DateTime(
|
||||||
|
DateTime.now().year - 100,
|
||||||
|
1),
|
||||||
|
lastDate: DateTime(
|
||||||
|
DateTime.now().year + 100,
|
||||||
|
1),
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
selectedDate: DateTime.now(),
|
||||||
|
onChanged: (DateTime dateTime) {
|
||||||
|
fromController.text =
|
||||||
|
dateTime.year.toString();
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 8,
|
||||||
|
),
|
||||||
|
////UNTIL
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This fied is required"),
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"until *", "until"),
|
||||||
|
name: "",
|
||||||
|
controller: untilController,
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
content: SizedBox(
|
||||||
|
width: 300,
|
||||||
|
height: 300,
|
||||||
|
child: YearPicker(
|
||||||
|
firstDate: DateTime(
|
||||||
|
DateTime.now().year - 100,
|
||||||
|
1),
|
||||||
|
lastDate: DateTime(
|
||||||
|
DateTime.now().year + 100,
|
||||||
|
1),
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
selectedDate: DateTime.now(),
|
||||||
|
onChanged: (DateTime dateTime) {
|
||||||
|
untilController.text =
|
||||||
|
dateTime.year.toString();
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
), const SizedBox(height: 20,),
|
||||||
|
SizedBox(
|
||||||
|
|
||||||
|
child: graduated
|
||||||
|
////GRADUATED YEAR
|
||||||
|
? FormBuilderTextField(
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This fied is required"),
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
content: SizedBox(
|
||||||
|
width: 300,
|
||||||
|
height: 300,
|
||||||
|
child: YearPicker(
|
||||||
|
firstDate: DateTime(
|
||||||
|
DateTime.now().year -
|
||||||
|
100,
|
||||||
|
1),
|
||||||
|
lastDate: DateTime(
|
||||||
|
DateTime.now().year +
|
||||||
|
100,
|
||||||
|
1),
|
||||||
|
initialDate:
|
||||||
|
DateTime.now(),
|
||||||
|
selectedDate:
|
||||||
|
DateTime.now(),
|
||||||
|
onChanged:
|
||||||
|
(DateTime dateTime) {
|
||||||
|
yearGraduated.text =
|
||||||
|
dateTime.year
|
||||||
|
.toString();
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
name: "year_graduated",
|
||||||
|
controller: yearGraduated,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Year Graduated *",
|
||||||
|
"Year Graduated *"),
|
||||||
|
)
|
||||||
|
//// HIGHEST UNITS EARNED
|
||||||
|
: FormBuilderTextField(
|
||||||
|
initialValue: state.educationalBackground.unitsEarned?.toString(),
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This fied is required"),
|
||||||
|
|
||||||
|
name: "units_earned",
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Highest Level/Units Earned *",
|
||||||
|
"Highest Level/Units Earned *")),
|
||||||
|
)
|
||||||
|
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
//// HONORS
|
||||||
|
StatefulBuilder(builder: (context, setState) {
|
||||||
|
return MultiSelectDropDown(
|
||||||
|
onOptionSelected: (List<ValueItem> selectedOptions) {
|
||||||
|
selectedValueItem = selectedOptions;
|
||||||
|
},
|
||||||
|
borderColor: Colors.grey,
|
||||||
|
borderWidth: 1,
|
||||||
|
borderRadius: 5,
|
||||||
|
hint: "Honors",
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
options: valueItemHonorList,
|
||||||
|
selectionType: SelectionType.multi,
|
||||||
|
chipConfig: const ChipConfig(wrapType: WrapType.wrap),
|
||||||
|
dropdownHeight: 300,
|
||||||
|
optionTextStyle: const TextStyle(fontSize: 16),
|
||||||
|
selectedOptionIcon: const Icon(Icons.check_circle),
|
||||||
|
selectedOptions:
|
||||||
|
(state.educationalBackground.honors!.isNotEmpty &&
|
||||||
|
state.educationalBackground.honors != null)
|
||||||
|
? selectedValueItem = state
|
||||||
|
.educationalBackground.honors!
|
||||||
|
.map((Honor honor) => ValueItem(
|
||||||
|
label: honor.name!, value: honor.name))
|
||||||
|
.toList()
|
||||||
|
: [],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(height: 14,),
|
||||||
|
////sumit button
|
||||||
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
|
@ -558,7 +553,7 @@ class _EditEducationScreenState extends State<EditEducationScreen> {
|
||||||
yearGraduated:
|
yearGraduated:
|
||||||
graduated ? yearGraduated.text : null,
|
graduated ? yearGraduated.text : null,
|
||||||
unitsEarned: !graduated
|
unitsEarned: !graduated
|
||||||
? int.tryParse(unitsController.text)
|
? int.tryParse(formKey.currentState!.value['units_earned'])
|
||||||
: null,
|
: null,
|
||||||
attachments: null,
|
attachments: null,
|
||||||
);
|
);
|
||||||
|
@ -573,9 +568,7 @@ class _EditEducationScreenState extends State<EditEducationScreen> {
|
||||||
},
|
},
|
||||||
child: const Text(submit)),
|
child: const Text(submit)),
|
||||||
),
|
),
|
||||||
|
]),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,13 +3,13 @@ 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:fluttertoast/fluttertoast.dart';
|
|
||||||
import 'package:share_plus/share_plus.dart';
|
|
||||||
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
||||||
import 'package:unit2/bloc/profile/education/education_bloc.dart';
|
import 'package:unit2/bloc/profile/education/education_bloc.dart';
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart';
|
import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart';
|
||||||
|
|
||||||
|
import '../../../../utils/url_launcher_file_downloader.dart';
|
||||||
|
|
||||||
class EudcationViewAttachment extends StatefulWidget {
|
class EudcationViewAttachment extends StatefulWidget {
|
||||||
const EudcationViewAttachment({super.key});
|
const EudcationViewAttachment({super.key});
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class _EudcationViewAttachmentState extends State<EudcationViewAttachment> {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await _launchInBrowser(fileUrl!);
|
await launchInBrowser(fileUrl!);
|
||||||
},
|
},
|
||||||
child: const Icon(Icons.file_download),
|
child: const Icon(Icons.file_download),
|
||||||
),
|
),
|
||||||
|
@ -103,19 +103,4 @@ class _EudcationViewAttachmentState extends State<EudcationViewAttachment> {
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _launchInBrowser(String url) async {
|
|
||||||
final UrlLauncherPlatform launcher = UrlLauncherPlatform.instance;
|
|
||||||
if (!await launcher.launch(
|
|
||||||
url,
|
|
||||||
useSafariVC: false,
|
|
||||||
useWebView: false,
|
|
||||||
enableJavaScript: false,
|
|
||||||
enableDomStorage: false,
|
|
||||||
universalLinksOnly: false,
|
|
||||||
headers: <String, String>{},
|
|
||||||
)) {
|
|
||||||
throw Exception('Could not launch $url');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ 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/educational_background.dart';
|
import 'package:unit2/model/profile/educational_background.dart';
|
||||||
import 'package:unit2/screens/profile/components/education/add_modal.dart';
|
import 'package:unit2/screens/profile/components/education/add_modal.dart';
|
||||||
import 'package:unit2/screens/profile/shared/view_attachment.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/widgets/Leadings/add_leading.dart';
|
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||||
|
@ -41,7 +40,7 @@ class EducationScreen extends StatelessWidget {
|
||||||
int profileId;
|
int profileId;
|
||||||
String? token;
|
String? token;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: context.watch<EducationBloc>().state is AddEducationState
|
title: context.watch<EducationBloc>().state is AddEducationState
|
||||||
? const FittedBox(child: Text("Add Educational Background"))
|
? const FittedBox(child: Text("Add Educational Background"))
|
||||||
|
|
|
@ -71,343 +71,337 @@ class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
||||||
padding: const EdgeInsets.symmetric(vertical: 32, horizontal: 28),
|
padding: const EdgeInsets.symmetric(vertical: 32, horizontal: 28),
|
||||||
child: FormBuilder(
|
child: FormBuilder(
|
||||||
key: formKey,
|
key: formKey,
|
||||||
child: SizedBox(
|
child: ListView(children: [
|
||||||
height: screenHeight * 90,
|
////ELIGIBILITIES DROPDOWN
|
||||||
child: Column(
|
FormBuilderDropdown<Eligibility>(
|
||||||
children: [
|
onChanged: (Eligibility? eligibility) {
|
||||||
Flexible(
|
selectedEligibility = eligibility;
|
||||||
child: ListView(children: [
|
},
|
||||||
////ELIGIBILITIES DROPDOWN
|
autovalidateMode:
|
||||||
FormBuilderDropdown<Eligibility>(
|
AutovalidateMode.onUserInteraction,
|
||||||
onChanged: (Eligibility? eligibility) {
|
validator: (value) =>
|
||||||
selectedEligibility = eligibility;
|
value == null ? 'required' : null,
|
||||||
},
|
items: state.eligibilities
|
||||||
autovalidateMode:
|
.map<DropdownMenuItem<Eligibility>>(
|
||||||
AutovalidateMode.onUserInteraction,
|
(Eligibility eligibility) {
|
||||||
validator: (value) =>
|
return DropdownMenuItem<Eligibility>(
|
||||||
value == null ? 'required' : null,
|
value: eligibility,
|
||||||
items: state.eligibilities
|
child: Text(eligibility.title));
|
||||||
.map<DropdownMenuItem<Eligibility>>(
|
}).toList(),
|
||||||
(Eligibility eligibility) {
|
name: "eligibility",
|
||||||
return DropdownMenuItem<Eligibility>(
|
decoration: normalTextFieldStyle(
|
||||||
value: eligibility,
|
"Eligibility", "Eligibility")),
|
||||||
child: Text(eligibility.title));
|
const SizedBox(
|
||||||
}).toList(),
|
height: 8,
|
||||||
name: "eligibility",
|
),
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Eligibility", "Eligibility")),
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
////LICENSE NUMBER
|
////LICENSE NUMBER
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: FormBuilderTextField(
|
child: FormBuilderTextField(
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
license = value;
|
license = value;
|
||||||
},
|
},
|
||||||
name: 'license_number',
|
name: 'license_number',
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"license number", "license number"),
|
"license number", "license number"),
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 8,
|
|
||||||
),
|
|
||||||
////RATING
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
validator: FormBuilderValidators.numeric(
|
|
||||||
errorText: "Enter a number"),
|
|
||||||
keyboardType:
|
|
||||||
const TextInputType.numberWithOptions(),
|
|
||||||
onChanged: (value) {
|
|
||||||
rating = value;
|
|
||||||
},
|
|
||||||
name: 'rating',
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
'rating %', 'rating'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
height: 8,
|
const SizedBox(
|
||||||
|
width: 8,
|
||||||
|
),
|
||||||
|
////RATING
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
validator: FormBuilderValidators.numeric(
|
||||||
|
errorText: "Enter a number"),
|
||||||
|
keyboardType:
|
||||||
|
const TextInputType.numberWithOptions(),
|
||||||
|
onChanged: (value) {
|
||||||
|
rating = value;
|
||||||
|
},
|
||||||
|
name: 'rating',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
'rating %', 'rating'),
|
||||||
),
|
),
|
||||||
SizedBox(
|
),
|
||||||
width: screenWidth,
|
],
|
||||||
child: StatefulBuilder(builder: (context, setState) {
|
),
|
||||||
return Row(
|
),
|
||||||
children: [
|
const SizedBox(
|
||||||
////EXAM DATE
|
height: 8,
|
||||||
Flexible(
|
),
|
||||||
flex: 1,
|
SizedBox(
|
||||||
child: DateTimePicker(
|
width: screenWidth,
|
||||||
use24HourFormat: false,
|
child: StatefulBuilder(builder: (context, setState) {
|
||||||
icon: const Icon(Icons.date_range),
|
return Row(
|
||||||
controller: examDateController,
|
children: [
|
||||||
firstDate: DateTime(1990),
|
////EXAM DATE
|
||||||
lastDate: DateTime(2100),
|
Flexible(
|
||||||
timeHintText:
|
flex: 1,
|
||||||
"Date of Examination/Conferment",
|
child: DateTimePicker(
|
||||||
decoration:
|
use24HourFormat: false,
|
||||||
normalTextFieldStyle("Exam date", "")
|
icon: const Icon(Icons.date_range),
|
||||||
.copyWith(
|
controller: examDateController,
|
||||||
prefixIcon: const Icon(
|
firstDate: DateTime(1990),
|
||||||
Icons.date_range,
|
lastDate: DateTime(2100),
|
||||||
color: Colors.black87,
|
timeHintText:
|
||||||
)),
|
"Date of Examination/Conferment",
|
||||||
initialDate: expireDate == null
|
decoration:
|
||||||
? DateTime.now()
|
normalTextFieldStyle("Exam date", "")
|
||||||
: expireDate!.subtract(
|
.copyWith(
|
||||||
const Duration(days: 1)),
|
prefixIcon: const Icon(
|
||||||
selectableDayPredicate: (date) {
|
Icons.date_range,
|
||||||
if (expireDate != null &&
|
color: Colors.black87,
|
||||||
expireDate!
|
)),
|
||||||
.microsecondsSinceEpoch <=
|
initialDate: expireDate == null
|
||||||
date.microsecondsSinceEpoch) {
|
? DateTime.now()
|
||||||
return false;
|
: expireDate!.subtract(
|
||||||
}
|
const Duration(days: 1)),
|
||||||
return true;
|
selectableDayPredicate: (date) {
|
||||||
},
|
if (expireDate != null &&
|
||||||
onChanged: (value) {
|
expireDate!
|
||||||
setState(() {
|
.microsecondsSinceEpoch <=
|
||||||
examDate = DateTime.parse(value);
|
date.microsecondsSinceEpoch) {
|
||||||
});
|
return false;
|
||||||
},
|
}
|
||||||
)),
|
return true;
|
||||||
const SizedBox(
|
},
|
||||||
width: 8,
|
|
||||||
),
|
|
||||||
////VALIDITY DATE
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: DateTimePicker(
|
|
||||||
controller: validityDateController,
|
|
||||||
firstDate: DateTime(1970),
|
|
||||||
lastDate: DateTime(2100),
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Validity date", "Validity date")
|
|
||||||
.copyWith(
|
|
||||||
prefixIcon: const Icon(
|
|
||||||
Icons.date_range,
|
|
||||||
color: Colors.black87,
|
|
||||||
)),
|
|
||||||
selectableDayPredicate: (date) {
|
|
||||||
if (examDate != null &&
|
|
||||||
examDate!.microsecondsSinceEpoch >=
|
|
||||||
date.microsecondsSinceEpoch) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
expireDate = DateTime.parse(value);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
initialDate: examDate == null
|
|
||||||
? DateTime.now()
|
|
||||||
: examDate!
|
|
||||||
.add(const Duration(days: 1)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Placement of Examination/Conferment",
|
|
||||||
style: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.displaySmall!
|
|
||||||
.copyWith(fontSize: blockSizeVertical * 2),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
////OVERSEAS ADDRESS SWITCH
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
FormBuilderSwitch(
|
|
||||||
validator: FormBuilderValidators.required(
|
|
||||||
errorText: 'This field is required'),
|
|
||||||
initialValue: overseas,
|
|
||||||
activeColor: second,
|
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
overseas = value;
|
examDate = DateTime.parse(value);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
decoration: normalTextFieldStyle("", ''),
|
)),
|
||||||
name: 'overseas',
|
const SizedBox(
|
||||||
title: const Text("Overseas Address?"),
|
width: 8,
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
////COUNTRY DROPDOWN
|
|
||||||
SizedBox(
|
|
||||||
child: overseas == true
|
|
||||||
? FormBuilderDropdown<Country>(
|
|
||||||
initialValue: null,
|
|
||||||
validator:
|
|
||||||
FormBuilderValidators.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
items: state.countries
|
|
||||||
.map<DropdownMenuItem<Country>>(
|
|
||||||
(Country country) {
|
|
||||||
return DropdownMenuItem<Country>(
|
|
||||||
value: country,
|
|
||||||
child: FittedBox(
|
|
||||||
child: Text(country.name!)));
|
|
||||||
}).toList(),
|
|
||||||
name: 'country',
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Country*", "Country"),
|
|
||||||
onChanged: (Country? value) {
|
|
||||||
selectedCountry = value;
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: Column(
|
|
||||||
children: [
|
|
||||||
////REGION DROPDOWN
|
|
||||||
FormBuilderDropdown<Region?>(
|
|
||||||
autovalidateMode: AutovalidateMode
|
|
||||||
.onUserInteraction,
|
|
||||||
validator:
|
|
||||||
FormBuilderValidators.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
//// region onchange
|
|
||||||
onChanged: (Region? region) async {
|
|
||||||
if (selectedRegion != region) {
|
|
||||||
setState(() {
|
|
||||||
provinceCall = true;
|
|
||||||
});
|
|
||||||
selectedRegion = region;
|
|
||||||
getProvinces();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
initialValue: selectedRegion,
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Region*", "Region"),
|
|
||||||
name: 'region',
|
|
||||||
items: state.regions
|
|
||||||
.map<DropdownMenuItem<Region>>(
|
|
||||||
(Region region) {
|
|
||||||
return DropdownMenuItem<Region>(
|
|
||||||
value: region,
|
|
||||||
child: Text(
|
|
||||||
region.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
////PROVINCE DROPDOWN
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.transparent,
|
|
||||||
inAsyncCall: provinceCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
Province?>(
|
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode
|
|
||||||
.onUserInteraction,
|
|
||||||
validator: (value) =>
|
|
||||||
value == null
|
|
||||||
? 'required'
|
|
||||||
: null,
|
|
||||||
isExpanded: true,
|
|
||||||
value: selectedProvince,
|
|
||||||
onChanged:
|
|
||||||
(Province? province) {
|
|
||||||
if (selectedProvince !=
|
|
||||||
province) {
|
|
||||||
setState(() {
|
|
||||||
cityCall = true;
|
|
||||||
});
|
|
||||||
selectedProvince =
|
|
||||||
province;
|
|
||||||
getCities();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
items: provinces == null
|
|
||||||
? []
|
|
||||||
: provinces!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Province>>(
|
|
||||||
(Province province) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: province,
|
|
||||||
child: FittedBox(
|
|
||||||
child: Text(province
|
|
||||||
.description!),
|
|
||||||
));
|
|
||||||
}).toList(),
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Province*",
|
|
||||||
"Province")),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
//// CityMunicipalities dropdown
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: cityCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
CityMunicipality>(
|
|
||||||
validator: (value) =>
|
|
||||||
value == null
|
|
||||||
? 'required'
|
|
||||||
: null,
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged:
|
|
||||||
(CityMunicipality? city) {
|
|
||||||
selectedMunicipality = city;
|
|
||||||
},
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Municipality*",
|
|
||||||
"Municipality"),
|
|
||||||
value: selectedMunicipality,
|
|
||||||
items: citymuns == null
|
|
||||||
? []
|
|
||||||
: citymuns!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
CityMunicipality>>(
|
|
||||||
(CityMunicipality c) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: c,
|
|
||||||
child: Text(c
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
]),
|
////VALIDITY DATE
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: DateTimePicker(
|
||||||
|
controller: validityDateController,
|
||||||
|
firstDate: DateTime(1970),
|
||||||
|
lastDate: DateTime(2100),
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Validity date", "Validity date")
|
||||||
|
.copyWith(
|
||||||
|
prefixIcon: const Icon(
|
||||||
|
Icons.date_range,
|
||||||
|
color: Colors.black87,
|
||||||
|
)),
|
||||||
|
selectableDayPredicate: (date) {
|
||||||
|
if (examDate != null &&
|
||||||
|
examDate!.microsecondsSinceEpoch >=
|
||||||
|
date.microsecondsSinceEpoch) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
expireDate = DateTime.parse(value);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
initialDate: examDate == null
|
||||||
|
? DateTime.now()
|
||||||
|
: examDate!
|
||||||
|
.add(const Duration(days: 1)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Placement of Examination/Conferment",
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.displaySmall!
|
||||||
|
.copyWith(fontSize: blockSizeVertical * 2),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
////OVERSEAS ADDRESS SWITCH
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
FormBuilderSwitch(
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: 'This field is required'),
|
||||||
|
initialValue: overseas,
|
||||||
|
activeColor: second,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
overseas = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
decoration: normalTextFieldStyle("", ''),
|
||||||
|
name: 'overseas',
|
||||||
|
title: const Text("Overseas Address?"),
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
////COUNTRY DROPDOWN
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
child: overseas == true
|
||||||
|
? FormBuilderDropdown<Country>(
|
||||||
|
initialValue: null,
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
items: state.countries
|
||||||
|
.map<DropdownMenuItem<Country>>(
|
||||||
|
(Country country) {
|
||||||
|
return DropdownMenuItem<Country>(
|
||||||
|
value: country,
|
||||||
|
child: FittedBox(
|
||||||
|
child: Text(country.name!)));
|
||||||
|
}).toList(),
|
||||||
|
name: 'country',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Country*", "Country"),
|
||||||
|
onChanged: (Country? value) {
|
||||||
|
selectedCountry = value;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
////REGION DROPDOWN
|
||||||
|
FormBuilderDropdown<Region?>(
|
||||||
|
autovalidateMode: AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
//// region onchange
|
||||||
|
onChanged: (Region? region) async {
|
||||||
|
if (selectedRegion != region) {
|
||||||
|
setState(() {
|
||||||
|
provinceCall = true;
|
||||||
|
});
|
||||||
|
selectedRegion = region;
|
||||||
|
getProvinces();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initialValue: selectedRegion,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Region*", "Region"),
|
||||||
|
name: 'region',
|
||||||
|
items: state.regions
|
||||||
|
.map<DropdownMenuItem<Region>>(
|
||||||
|
(Region region) {
|
||||||
|
return DropdownMenuItem<Region>(
|
||||||
|
value: region,
|
||||||
|
child: Text(
|
||||||
|
region.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
////PROVINCE DROPDOWN
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.transparent,
|
||||||
|
inAsyncCall: provinceCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
Province?>(
|
||||||
|
autovalidateMode:
|
||||||
|
AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator: (value) =>
|
||||||
|
value == null
|
||||||
|
? 'required'
|
||||||
|
: null,
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedProvince,
|
||||||
|
onChanged:
|
||||||
|
(Province? province) {
|
||||||
|
if (selectedProvince !=
|
||||||
|
province) {
|
||||||
|
setState(() {
|
||||||
|
cityCall = true;
|
||||||
|
});
|
||||||
|
selectedProvince =
|
||||||
|
province;
|
||||||
|
getCities();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
items: provinces == null
|
||||||
|
? []
|
||||||
|
: provinces!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
Province>>(
|
||||||
|
(Province province) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: province,
|
||||||
|
child: FittedBox(
|
||||||
|
child: Text(province
|
||||||
|
.description!),
|
||||||
|
));
|
||||||
|
}).toList(),
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Province*",
|
||||||
|
"Province")),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
//// CityMunicipalities dropdown
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.white,
|
||||||
|
inAsyncCall: cityCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
CityMunicipality>(
|
||||||
|
validator: (value) =>
|
||||||
|
value == null
|
||||||
|
? 'required'
|
||||||
|
: null,
|
||||||
|
isExpanded: true,
|
||||||
|
onChanged:
|
||||||
|
(CityMunicipality? city) {
|
||||||
|
selectedMunicipality = city;
|
||||||
|
},
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Municipality*",
|
||||||
|
"Municipality"),
|
||||||
|
value: selectedMunicipality,
|
||||||
|
items: citymuns == null
|
||||||
|
? []
|
||||||
|
: citymuns!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
CityMunicipality>>(
|
||||||
|
(CityMunicipality c) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: c,
|
||||||
|
child: Text(c
|
||||||
|
.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24,),
|
||||||
|
SizedBox(
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
height: 60,
|
height: 60,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
@ -464,9 +458,7 @@ class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
||||||
},
|
},
|
||||||
child: const Text(submit)),
|
child: const Text(submit)),
|
||||||
),
|
),
|
||||||
],
|
]),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,8 +78,8 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
validityDateController.text = state.eligibityCert.validityDate == null
|
validityDateController.text = state.eligibityCert.validityDate == null
|
||||||
? ''
|
? ''
|
||||||
: state.eligibityCert.validityDate.toString();
|
: state.eligibityCert.validityDate.toString();
|
||||||
DateTime? examDate = DateTime.tryParse(examDateController.text) ;
|
DateTime? examDate = DateTime.tryParse(examDateController.text);
|
||||||
DateTime? expireDate = DateTime.tryParse(validityDateController.text);
|
DateTime? expireDate = DateTime.tryParse(validityDateController.text);
|
||||||
provinces = state.provinces;
|
provinces = state.provinces;
|
||||||
citymuns = state.cities;
|
citymuns = state.cities;
|
||||||
regions = state.regions;
|
regions = state.regions;
|
||||||
|
@ -96,461 +96,445 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
padding: const EdgeInsets.symmetric(vertical: 25, horizontal: 28),
|
padding: const EdgeInsets.symmetric(vertical: 25, horizontal: 28),
|
||||||
child: FormBuilder(
|
child: FormBuilder(
|
||||||
key: formKey,
|
key: formKey,
|
||||||
child: Column(
|
child: ListView(children: [
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
const SizedBox(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
height: 24,
|
||||||
children: [
|
),
|
||||||
const SizedBox(
|
////ELIGIBILITIES DROPDOWN
|
||||||
height: 24,
|
DropdownButtonFormField<Eligibility>(
|
||||||
),
|
validator: (value) => value == null ? 'required' : null,
|
||||||
////ELIGIBILITIES DROPDOWN
|
isExpanded: true,
|
||||||
DropdownButtonFormField<Eligibility>(
|
onChanged: (Eligibility? eligibility) {
|
||||||
validator: (value) =>
|
selectedEligibility = eligibility;
|
||||||
value == null ? 'required' : null,
|
},
|
||||||
isExpanded: true,
|
value: selectedEligibility,
|
||||||
onChanged: (Eligibility? eligibility) {
|
items: state.eligibilities
|
||||||
selectedEligibility = eligibility;
|
.map<DropdownMenuItem<Eligibility>>(
|
||||||
},
|
(Eligibility eligibility) {
|
||||||
value: selectedEligibility,
|
return DropdownMenuItem<Eligibility>(
|
||||||
items: state.eligibilities
|
value: eligibility, child: Text(eligibility.title));
|
||||||
.map<DropdownMenuItem<Eligibility>>(
|
}).toList(),
|
||||||
(Eligibility eligibility) {
|
decoration: normalTextFieldStyle("Eligibility", "")),
|
||||||
return DropdownMenuItem<Eligibility>(
|
const SizedBox(
|
||||||
value: eligibility,
|
height: 12,
|
||||||
child: Text(eligibility.title));
|
),
|
||||||
}).toList(),
|
|
||||||
decoration: normalTextFieldStyle("Eligibility", "")),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
////LICENSE NUMBER
|
////LICENSE NUMBER
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: FormBuilderTextField(
|
child: FormBuilderTextField(
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
license = value;
|
license = value;
|
||||||
},
|
},
|
||||||
name: 'license_number',
|
name: 'license_number',
|
||||||
initialValue: license,
|
initialValue: license,
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"license number", "license number"),
|
"license number", "license number"),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 12,
|
|
||||||
),
|
|
||||||
// //RATING
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
validator: FormBuilderValidators.numeric(
|
|
||||||
errorText: "Enter a number"),
|
|
||||||
keyboardType:
|
|
||||||
const TextInputType.numberWithOptions(),
|
|
||||||
onChanged: (value) {
|
|
||||||
rating = value;
|
|
||||||
},
|
|
||||||
name: 'rating',
|
|
||||||
initialValue:
|
|
||||||
rating == null ? 'N/A' : rating.toString(),
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle('rating', 'rating'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
const SizedBox(
|
width: 12,
|
||||||
height: 12,
|
),
|
||||||
),
|
// //RATING
|
||||||
SizedBox(
|
Flexible(
|
||||||
width: screenWidth,
|
flex: 1,
|
||||||
child: StatefulBuilder(builder: (context, setState) {
|
child: FormBuilderTextField(
|
||||||
return Row(
|
validator: FormBuilderValidators.numeric(
|
||||||
children: [
|
errorText: "Enter a number"),
|
||||||
// //EXAM DATE
|
keyboardType:
|
||||||
Flexible(
|
const TextInputType.numberWithOptions(),
|
||||||
flex: 1,
|
onChanged: (value) {
|
||||||
child: DateTimePicker(
|
rating = value;
|
||||||
use24HourFormat: false,
|
},
|
||||||
controller: examDateController,
|
name: 'rating',
|
||||||
firstDate: DateTime(1990),
|
initialValue:
|
||||||
lastDate: DateTime(2100),
|
rating == null ? 'N/A' : rating.toString(),
|
||||||
decoration:
|
decoration:
|
||||||
normalTextFieldStyle("Exam date", "")
|
normalTextFieldStyle('rating', 'rating'),
|
||||||
.copyWith(
|
),
|
||||||
prefixIcon: const Icon(
|
),
|
||||||
Icons.date_range,
|
],
|
||||||
color: Colors.black87,
|
),
|
||||||
)),
|
),
|
||||||
initialDate: expireDate == null
|
const SizedBox(
|
||||||
? DateTime.now()
|
height: 12,
|
||||||
: expireDate!
|
),
|
||||||
.subtract(const Duration(days: 1)),
|
SizedBox(
|
||||||
selectableDayPredicate: (date) {
|
width: screenWidth,
|
||||||
if (expireDate != null &&
|
child: StatefulBuilder(builder: (context, setState) {
|
||||||
expireDate!.microsecondsSinceEpoch <=
|
return Row(
|
||||||
date.microsecondsSinceEpoch) {
|
children: [
|
||||||
return false;
|
// //EXAM DATE
|
||||||
}
|
Flexible(
|
||||||
return true;
|
flex: 1,
|
||||||
},
|
child: DateTimePicker(
|
||||||
onChanged: (value) {
|
use24HourFormat: false,
|
||||||
setState(() {
|
controller: examDateController,
|
||||||
examDate = DateTime.parse(value);
|
firstDate: DateTime(1990),
|
||||||
});
|
lastDate: DateTime(2100),
|
||||||
},
|
decoration:
|
||||||
)),
|
normalTextFieldStyle("Exam date", "")
|
||||||
|
.copyWith(
|
||||||
|
prefixIcon: const Icon(
|
||||||
|
Icons.date_range,
|
||||||
|
color: Colors.black87,
|
||||||
|
)),
|
||||||
|
initialDate: expireDate == null
|
||||||
|
? DateTime.now()
|
||||||
|
: expireDate!
|
||||||
|
.subtract(const Duration(days: 1)),
|
||||||
|
selectableDayPredicate: (date) {
|
||||||
|
if (expireDate != null &&
|
||||||
|
expireDate!.microsecondsSinceEpoch <=
|
||||||
|
date.microsecondsSinceEpoch) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
examDate = DateTime.parse(value);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 12,
|
width: 12,
|
||||||
),
|
),
|
||||||
////VALIDITY DATE
|
////VALIDITY DATE
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: DateTimePicker(
|
child: DateTimePicker(
|
||||||
use24HourFormat: false,
|
use24HourFormat: false,
|
||||||
controller: validityDateController,
|
controller: validityDateController,
|
||||||
firstDate: DateTime(1970),
|
firstDate: DateTime(1970),
|
||||||
lastDate: DateTime(2100),
|
lastDate: DateTime(2100),
|
||||||
decoration:
|
decoration:
|
||||||
normalTextFieldStyle("validity date", "")
|
normalTextFieldStyle("validity date", "")
|
||||||
.copyWith(
|
.copyWith(
|
||||||
prefixIcon: const Icon(
|
prefixIcon: const Icon(
|
||||||
Icons.date_range,
|
Icons.date_range,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
)),
|
)),
|
||||||
selectableDayPredicate: (date) {
|
selectableDayPredicate: (date) {
|
||||||
if (examDate != null &&
|
if (examDate != null &&
|
||||||
examDate!.microsecondsSinceEpoch >=
|
examDate!.microsecondsSinceEpoch >=
|
||||||
date.microsecondsSinceEpoch) {
|
date.microsecondsSinceEpoch) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
expireDate = DateTime.parse(value);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
initialDate: examDate == null
|
|
||||||
? DateTime.now()
|
|
||||||
: examDate!.add(const Duration(days: 1)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Placement of Examination/Confinement",
|
|
||||||
style: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.displaySmall!
|
|
||||||
.copyWith(fontSize: blockSizeVertical * 2),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
//OVERSEAS ADDRESS SWITCH
|
|
||||||
StatefulBuilder(builder: (context, StateSetter setState) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
FormBuilderSwitch(
|
|
||||||
initialValue: overseas,
|
|
||||||
activeColor: second,
|
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
overseas = value;
|
expireDate = DateTime.parse(value);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
decoration: normalTextFieldStyle("", ''),
|
initialDate: examDate == null
|
||||||
name: 'overseas',
|
? DateTime.now()
|
||||||
title: const Text("Overseas Address?"),
|
: examDate!.add(const Duration(days: 1)),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
height: 12,
|
],
|
||||||
),
|
);
|
||||||
//COUNTRY DROPDOWN
|
}),
|
||||||
SizedBox(
|
),
|
||||||
child: overseas == true
|
const SizedBox(
|
||||||
? FormBuilderDropdown<Country>(
|
height: 20,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Placement of Examination/Confinement",
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.displaySmall!
|
||||||
|
.copyWith(fontSize: blockSizeVertical * 2),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
//OVERSEAS ADDRESS SWITCH
|
||||||
|
StatefulBuilder(builder: (context, StateSetter setState) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
FormBuilderSwitch(
|
||||||
|
initialValue: overseas,
|
||||||
|
activeColor: second,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
overseas = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
decoration: normalTextFieldStyle("", ''),
|
||||||
|
name: 'overseas',
|
||||||
|
title: const Text("Overseas Address?"),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
//COUNTRY DROPDOWN
|
||||||
|
SizedBox(
|
||||||
|
child: overseas == true
|
||||||
|
? FormBuilderDropdown<Country>(
|
||||||
|
validator: (value) =>
|
||||||
|
value == null ? 'required' : null,
|
||||||
|
initialValue: selectedCountry!.id == 175
|
||||||
|
? null
|
||||||
|
: selectedCountry,
|
||||||
|
items: state.countries
|
||||||
|
.map<DropdownMenuItem<Country>>(
|
||||||
|
(Country country) {
|
||||||
|
return DropdownMenuItem<Country>(
|
||||||
|
value: country,
|
||||||
|
child: FittedBox(
|
||||||
|
child: Text(country.name!)));
|
||||||
|
}).toList(),
|
||||||
|
name: 'country',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Country*", "Country"),
|
||||||
|
onChanged: (Country? value) {
|
||||||
|
selectedCountry = value;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
////REGION DROPDOWN
|
||||||
|
DropdownButtonFormField<Region?>(
|
||||||
validator: (value) =>
|
validator: (value) =>
|
||||||
value == null ? 'required' : null,
|
value == null ? 'required' : null,
|
||||||
initialValue: selectedCountry!.id == 175
|
isExpanded: true,
|
||||||
? null
|
onChanged: (Region? region) async {
|
||||||
: selectedCountry,
|
setState(() {
|
||||||
items: state.countries
|
provinceCall = true;
|
||||||
.map<DropdownMenuItem<Country>>(
|
});
|
||||||
(Country country) {
|
selectedRegion = region;
|
||||||
return DropdownMenuItem<Country>(
|
try {
|
||||||
value: country,
|
provinces = await LocationUtils
|
||||||
child: FittedBox(
|
.instance
|
||||||
child: Text(country.name!)));
|
.getProvinces(
|
||||||
}).toList(),
|
regionCode: selectedRegion!
|
||||||
name: 'country',
|
.code
|
||||||
decoration: normalTextFieldStyle(
|
.toString());
|
||||||
"Country*", "Country"),
|
} catch (e) {
|
||||||
onChanged: (Country? value) {
|
context
|
||||||
selectedCountry = value;
|
.read<EligibilityBloc>()
|
||||||
|
.add(CallErrorState());
|
||||||
|
}
|
||||||
|
selectedProvince = provinces![0];
|
||||||
|
setState(() {
|
||||||
|
provinceCall = false;
|
||||||
|
cityCall = true;
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
citymuns = await LocationUtils
|
||||||
|
.instance
|
||||||
|
.getCities(
|
||||||
|
code: selectedProvince!
|
||||||
|
.code!);
|
||||||
|
} catch (e) {
|
||||||
|
NavigationService
|
||||||
|
.navigatorKey.currentContext
|
||||||
|
?.read<EligibilityBloc>()
|
||||||
|
.add(CallErrorState());
|
||||||
|
}
|
||||||
|
selectedMunicipality = citymuns![0];
|
||||||
|
setState(() {
|
||||||
|
cityCall = false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
)
|
value: selectedRegion,
|
||||||
: Column(
|
decoration: normalTextFieldStyle(
|
||||||
children: [
|
"Region*", "Region"),
|
||||||
////REGION DROPDOWN
|
items: regions == null
|
||||||
DropdownButtonFormField<Region?>(
|
? []
|
||||||
|
: regions!
|
||||||
|
.map<DropdownMenuItem<Region>>(
|
||||||
|
(Region region) {
|
||||||
|
return DropdownMenuItem<Region>(
|
||||||
|
value: region,
|
||||||
|
child: Text(
|
||||||
|
region.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////PROVINCE DROPDOWN
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.transparent,
|
||||||
|
inAsyncCall: provinceCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
Province?>(
|
||||||
|
validator: (value) =>
|
||||||
|
value == null
|
||||||
|
? 'required'
|
||||||
|
: null,
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedProvince,
|
||||||
|
onChanged:
|
||||||
|
(Province? province) async {
|
||||||
|
setState(() {
|
||||||
|
cityCall = true;
|
||||||
|
});
|
||||||
|
selectedProvince = province;
|
||||||
|
try {
|
||||||
|
citymuns = await LocationUtils
|
||||||
|
.instance
|
||||||
|
.getCities(
|
||||||
|
code:
|
||||||
|
selectedProvince!
|
||||||
|
.code
|
||||||
|
.toString());
|
||||||
|
} catch (e) {
|
||||||
|
context
|
||||||
|
.read<EligibilityBloc>()
|
||||||
|
.add(CallErrorState());
|
||||||
|
}
|
||||||
|
selectedMunicipality =
|
||||||
|
citymuns![0];
|
||||||
|
setState(() {
|
||||||
|
cityCall = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
items: provinces == null
|
||||||
|
? []
|
||||||
|
: provinces!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
Province>>(
|
||||||
|
(Province province) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: province,
|
||||||
|
child: FittedBox(
|
||||||
|
child: Text(province
|
||||||
|
.description!),
|
||||||
|
));
|
||||||
|
}).toList(),
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Province*", "Province")),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
//// City municipality
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.transparent,
|
||||||
|
inAsyncCall: cityCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
CityMunicipality>(
|
||||||
validator: (value) => value == null
|
validator: (value) => value == null
|
||||||
? 'required'
|
? 'required'
|
||||||
: null,
|
: null,
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
onChanged: (Region? region) async {
|
onChanged:
|
||||||
setState(() {
|
(CityMunicipality? city) {
|
||||||
provinceCall = true;
|
selectedMunicipality = city;
|
||||||
});
|
|
||||||
selectedRegion = region;
|
|
||||||
try{
|
|
||||||
provinces = await LocationUtils
|
|
||||||
.instance
|
|
||||||
.getProvinces(
|
|
||||||
regionCode:
|
|
||||||
selectedRegion!.code
|
|
||||||
.toString());
|
|
||||||
}catch(e){
|
|
||||||
context.read<EligibilityBloc>().add(CallErrorState());
|
|
||||||
}
|
|
||||||
selectedProvince = provinces![0];
|
|
||||||
setState(() {
|
|
||||||
provinceCall = false;
|
|
||||||
cityCall = true;
|
|
||||||
});
|
|
||||||
try{
|
|
||||||
citymuns = await LocationUtils
|
|
||||||
.instance
|
|
||||||
.getCities(
|
|
||||||
code: selectedProvince!
|
|
||||||
.code!);
|
|
||||||
}catch(e){
|
|
||||||
NavigationService.navigatorKey.currentContext?.read<EligibilityBloc>().add(CallErrorState());
|
|
||||||
}
|
|
||||||
selectedMunicipality =
|
|
||||||
citymuns![0];
|
|
||||||
setState(() {
|
|
||||||
cityCall = false;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
value: selectedRegion,
|
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"Region*", "Region"),
|
"Municipality*",
|
||||||
items: regions == null
|
"Municipality"),
|
||||||
|
value: selectedMunicipality,
|
||||||
|
items: citymuns == null
|
||||||
? []
|
? []
|
||||||
: regions!.map<
|
: citymuns!.map<
|
||||||
DropdownMenuItem<
|
DropdownMenuItem<
|
||||||
Region>>(
|
CityMunicipality>>(
|
||||||
(Region region) {
|
(CityMunicipality c) {
|
||||||
return DropdownMenuItem<
|
return DropdownMenuItem(
|
||||||
Region>(
|
value: c,
|
||||||
value: region,
|
child: Text(
|
||||||
child: Text(region
|
c.description!));
|
||||||
.description!));
|
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
height: 12,
|
),
|
||||||
),
|
],
|
||||||
////PROVINCE DROPDOWN
|
)),
|
||||||
SizedBox(
|
],
|
||||||
height: 60,
|
);
|
||||||
child: ModalProgressHUD(
|
}),
|
||||||
color: Colors.transparent,
|
const SizedBox(
|
||||||
inAsyncCall: provinceCall,
|
height: 18,
|
||||||
child: DropdownButtonFormField<
|
),
|
||||||
Province?>(
|
SizedBox(
|
||||||
validator: (value) =>
|
width: screenWidth,
|
||||||
value == null
|
height: 60,
|
||||||
? 'required'
|
child: ElevatedButton(
|
||||||
: null,
|
style:
|
||||||
isExpanded: true,
|
mainBtnStyle(primary, Colors.transparent, second),
|
||||||
value: selectedProvince,
|
onPressed: () {
|
||||||
onChanged: (Province?
|
ExamAddress examAddress;
|
||||||
province) async {
|
////rating
|
||||||
setState(() {
|
double? rate =
|
||||||
cityCall = true;
|
rating == null ? null : double.parse(rating!);
|
||||||
});
|
////license
|
||||||
selectedProvince = province;
|
String? newLicense = license;
|
||||||
try{
|
////city municipality
|
||||||
|
CityMunicipality? cityMunicipality =
|
||||||
|
selectedMunicipality;
|
||||||
citymuns = await LocationUtils
|
////exam date
|
||||||
.instance
|
DateTime? examDate = examDateController.text.isEmpty
|
||||||
.getCities(
|
? null
|
||||||
code:
|
: DateTime.parse(examDateController.text);
|
||||||
selectedProvince!
|
// // validity date
|
||||||
.code
|
DateTime? validityDate =
|
||||||
.toString());
|
validityDateController.text.isEmpty
|
||||||
}catch(e){
|
|
||||||
context.read<EligibilityBloc>().add(CallErrorState());
|
|
||||||
}
|
|
||||||
selectedMunicipality =
|
|
||||||
citymuns![0];
|
|
||||||
setState(() {
|
|
||||||
cityCall = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
items: provinces == null
|
|
||||||
? []
|
|
||||||
: provinces!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Province>>(
|
|
||||||
(Province province) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: province,
|
|
||||||
child: FittedBox(
|
|
||||||
child: Text(province
|
|
||||||
.description!),
|
|
||||||
));
|
|
||||||
}).toList(),
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Province*",
|
|
||||||
"Province")),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
//// City municipality
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.transparent,
|
|
||||||
inAsyncCall: cityCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
CityMunicipality>(
|
|
||||||
validator: (value) =>
|
|
||||||
value == null
|
|
||||||
? 'required'
|
|
||||||
: null,
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged:
|
|
||||||
(CityMunicipality? city) {
|
|
||||||
selectedMunicipality = city;
|
|
||||||
},
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Municipality*",
|
|
||||||
"Municipality"),
|
|
||||||
value: selectedMunicipality,
|
|
||||||
items: citymuns == null
|
|
||||||
? []
|
|
||||||
: citymuns!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
CityMunicipality>>(
|
|
||||||
(CityMunicipality c) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: c,
|
|
||||||
child: Text(c
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
|
|
||||||
const Expanded(
|
|
||||||
child: SizedBox(),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
width: screenWidth,
|
|
||||||
height: 60,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: mainBtnStyle(
|
|
||||||
primary, Colors.transparent, second),
|
|
||||||
onPressed: () {
|
|
||||||
ExamAddress examAddress;
|
|
||||||
////rating
|
|
||||||
double? rate =
|
|
||||||
rating == null ? null : double.parse(rating!);
|
|
||||||
////license
|
|
||||||
String? newLicense = license;
|
|
||||||
////city municipality
|
|
||||||
CityMunicipality? cityMunicipality =
|
|
||||||
selectedMunicipality;
|
|
||||||
////exam date
|
|
||||||
DateTime? examDate =
|
|
||||||
examDateController.text.isEmpty
|
|
||||||
? null
|
|
||||||
: DateTime.parse(examDateController.text);
|
|
||||||
// // validity date
|
|
||||||
DateTime? validityDate = validityDateController
|
|
||||||
.text.isEmpty
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(validityDateController.text);
|
: DateTime.parse(validityDateController.text);
|
||||||
//// exam address
|
//// exam address
|
||||||
if (overseas!) {
|
if (overseas!) {
|
||||||
examAddress = ExamAddress(
|
examAddress = ExamAddress(
|
||||||
barangay: null,
|
barangay: null,
|
||||||
id: state.eligibityCert.examAddress?.id,
|
id: state.eligibityCert.examAddress?.id,
|
||||||
addressCategory: state.eligibityCert
|
addressCategory: state
|
||||||
.examAddress?.addressCategory,
|
.eligibityCert.examAddress?.addressCategory,
|
||||||
examAddressClass: state.eligibityCert
|
examAddressClass: state.eligibityCert
|
||||||
.examAddress?.examAddressClass,
|
.examAddress?.examAddressClass,
|
||||||
country: selectedCountry,
|
country: selectedCountry,
|
||||||
cityMunicipality: null);
|
cityMunicipality: null);
|
||||||
} else {
|
} else {
|
||||||
examAddress = ExamAddress(
|
examAddress = ExamAddress(
|
||||||
barangay: state
|
barangay:
|
||||||
.eligibityCert.examAddress?.barangay,
|
state.eligibityCert.examAddress?.barangay,
|
||||||
id: state.eligibityCert.examAddress?.id,
|
id: state.eligibityCert.examAddress?.id,
|
||||||
addressCategory: state.eligibityCert
|
addressCategory: state
|
||||||
.examAddress?.addressCategory,
|
.eligibityCert.examAddress?.addressCategory,
|
||||||
examAddressClass: state.eligibityCert
|
examAddressClass: state.eligibityCert
|
||||||
.examAddress?.examAddressClass,
|
.examAddress?.examAddressClass,
|
||||||
country: Country(
|
country: Country(
|
||||||
id: 175,
|
id: 175, name: 'Philippines', code: 'PH'),
|
||||||
name: 'Philippines',
|
cityMunicipality: cityMunicipality);
|
||||||
code: 'PH'),
|
}
|
||||||
cityMunicipality: cityMunicipality);
|
|
||||||
}
|
|
||||||
|
|
||||||
EligibityCert eligibityCert = EligibityCert(
|
EligibityCert eligibityCert = EligibityCert(
|
||||||
id: state.eligibityCert.id,
|
id: state.eligibityCert.id,
|
||||||
rating: rate,
|
rating: rate,
|
||||||
examDate: examDate,
|
examDate: examDate,
|
||||||
attachments: null,
|
attachments: null,
|
||||||
eligibility: selectedEligibility,
|
eligibility: selectedEligibility,
|
||||||
examAddress: examAddress,
|
examAddress: examAddress,
|
||||||
validityDate: validityDate,
|
validityDate: validityDate,
|
||||||
licenseNumber: newLicense,
|
licenseNumber: newLicense,
|
||||||
overseas: overseas);
|
overseas: overseas);
|
||||||
if (formKey.currentState!.saveAndValidate()) {
|
if (formKey.currentState!.saveAndValidate()) {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
progress!.showWithText("Loading...");
|
progress!.showWithText("Loading...");
|
||||||
context.read<EligibilityBloc>().add(
|
context.read<EligibilityBloc>().add(
|
||||||
UpdateEligibility(
|
UpdateEligibility(
|
||||||
eligibityCert: eligibityCert,
|
eligibityCert: eligibityCert,
|
||||||
oldEligibility:
|
oldEligibility:
|
||||||
state.eligibityCert.eligibility!.id,
|
state.eligibityCert.eligibility!.id,
|
||||||
profileId: widget.profileId.toString(),
|
profileId: widget.profileId.toString(),
|
||||||
token: widget.token));
|
token: widget.token));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: const Text(submit)),
|
child: const Text(submit)),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,73 +1,113 @@
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
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_spinkit/flutter_spinkit.dart';
|
||||||
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
||||||
import 'package:unit2/bloc/profile/education/education_bloc.dart';
|
|
||||||
import 'package:unit2/bloc/profile/eligibility/eligibility_bloc.dart';
|
import 'package:unit2/bloc/profile/eligibility/eligibility_bloc.dart';
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
import 'package:unit2/utils/url_launcher_file_downloader.dart';
|
||||||
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import '../../../../utils/urls.dart';
|
|
||||||
class EligibilityViewAttachment extends StatefulWidget {
|
|
||||||
|
|
||||||
|
class EligibilityViewAttachment extends StatefulWidget {
|
||||||
const EligibilityViewAttachment({super.key});
|
const EligibilityViewAttachment({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<EligibilityViewAttachment> createState() => _EligibilityViewAttachmentState();
|
State<EligibilityViewAttachment> createState() =>
|
||||||
|
_EligibilityViewAttachmentState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _EligibilityViewAttachmentState extends State<EligibilityViewAttachment> {
|
class _EligibilityViewAttachmentState extends State<EligibilityViewAttachment> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
String? filename;
|
||||||
String? fileUrl;
|
String? fileUrl;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: ()async {
|
onPressed: () async {
|
||||||
await launchUrl(Uri.parse(fileUrl!));
|
await launchInBrowser(fileUrl!);
|
||||||
},
|
},
|
||||||
child: const Icon(Icons.file_download),
|
child: const Icon(Icons.file_download),
|
||||||
),
|
),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text("Attachment"),
|
title: const Text("Attachment"),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(onPressed: () {}, icon: const Icon(Icons.share)),
|
IconButton(
|
||||||
],
|
onPressed: () {
|
||||||
),
|
context.read<EligibilityBloc>().add(
|
||||||
body: BlocConsumer<EligibilityBloc, EligibilityState>(builder: (context,state){
|
ShareAttachment(fileName: filename!, source: fileUrl!));
|
||||||
if(state is EligibilityAttachmentViewState){
|
|
||||||
fileUrl = state.fileUrl;
|
|
||||||
bool isPDF = state.fileUrl[state.fileUrl.length - 1] == 'f' ? true : false;
|
|
||||||
return SizedBox(
|
|
||||||
child: isPDF?SfPdfViewer.network(
|
|
||||||
state.fileUrl,onDocumentLoadFailed: (details) {
|
|
||||||
Center(child: Text(details.description),);
|
|
||||||
},): Center(
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
progressIndicatorBuilder: (context, url, progress) {
|
|
||||||
return const SizedBox(
|
|
||||||
height: 100,
|
|
||||||
width: 100,
|
|
||||||
child: CircularProgressIndicator(color: primary,));
|
|
||||||
},
|
},
|
||||||
|
icon: const Icon(Icons.share)),
|
||||||
imageBuilder: (context, imageProvider) => Container(
|
],
|
||||||
decoration: BoxDecoration(
|
),
|
||||||
image: DecorationImage(
|
body: ProgressHUD(
|
||||||
image: imageProvider, fit: BoxFit.fill)),
|
padding: const EdgeInsets.all(24),
|
||||||
),
|
backgroundColor: Colors.black87,
|
||||||
imageUrl:
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
state.fileUrl,
|
child: BlocConsumer<EligibilityBloc, EligibilityState>(
|
||||||
width: double.infinity,
|
builder: (context, state) {
|
||||||
height: 220,
|
if (state is EligibilityAttachmentViewState) {
|
||||||
fit: BoxFit.cover,
|
fileUrl = state.fileUrl;
|
||||||
),
|
filename = state.fileName;
|
||||||
),
|
bool isPDF = state.fileUrl[state.fileUrl.length - 1] == 'f'
|
||||||
);
|
? true
|
||||||
}
|
: false;
|
||||||
return Container();
|
return SizedBox(
|
||||||
},listener: (context, state) {
|
child: isPDF
|
||||||
|
? SfPdfViewer.network(
|
||||||
},)
|
state.fileUrl,
|
||||||
);
|
onDocumentLoadFailed: (details) {
|
||||||
|
Center(
|
||||||
|
child: Text(details.description),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: Center(
|
||||||
|
child: CachedNetworkImage(
|
||||||
|
progressIndicatorBuilder: (context, url, progress) {
|
||||||
|
return const SizedBox(
|
||||||
|
height: 100,
|
||||||
|
width: 100,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: primary,
|
||||||
|
));
|
||||||
|
},
|
||||||
|
imageBuilder: (context, imageProvider) => Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
image: DecorationImage(
|
||||||
|
image: imageProvider, fit: BoxFit.fill)),
|
||||||
|
),
|
||||||
|
imageUrl: state.fileUrl,
|
||||||
|
width: double.infinity,
|
||||||
|
height: 220,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (state is EligibilityErrorState) {
|
||||||
|
return SomethingWentWrong(
|
||||||
|
message: state.message,
|
||||||
|
onpressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
listener: (context, state) {
|
||||||
|
if (state is EligibilityLoadingState) {
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.showWithText("Please wait...");
|
||||||
|
}
|
||||||
|
if (state is EligibilityAttachmentViewState ||
|
||||||
|
state is EligibilityErrorState) {
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.dismiss();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import '../../../bloc/profile/eligibility/eligibility_bloc.dart';
|
||||||
import '../../../utils/alerts.dart';
|
import '../../../utils/alerts.dart';
|
||||||
import '../shared/multiple_attachment.dart';
|
import '../shared/multiple_attachment.dart';
|
||||||
import '../shared/single_attachment.dart';
|
import '../shared/single_attachment.dart';
|
||||||
import '../shared/view_attachment.dart';
|
|
||||||
import 'eligibility/eligibility_view_attachment.dart';
|
import 'eligibility/eligibility_view_attachment.dart';
|
||||||
|
|
||||||
class EligibiltyScreen extends StatelessWidget {
|
class EligibiltyScreen extends StatelessWidget {
|
||||||
|
@ -48,7 +47,7 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: context.watch<EligibilityBloc>().state is AddEligibilityState
|
title: context.watch<EligibilityBloc>().state is AddEligibilityState
|
||||||
? const Text("Add Eligiblity")
|
? const Text("Add Eligiblity")
|
||||||
|
@ -637,7 +636,7 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: ((context) => BlocProvider.value(
|
builder: ((context) => BlocProvider.value(
|
||||||
value: EligibilityBloc()..add(EligibiltyViewAttachmentEvent(source: state.eligibilities[index].attachments!.first.source!)),
|
value: EligibilityBloc()..add(EligibiltyViewAttachmentEvent(source: state.eligibilities[index].attachments!.first.source!,filename: state.eligibilities[index].attachments!.first.filename!)),
|
||||||
child: const EligibilityViewAttachment(),
|
child: const EligibilityViewAttachment(),
|
||||||
))));
|
))));
|
||||||
|
|
||||||
|
@ -678,7 +677,7 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: ((context) => BlocProvider.value(
|
builder: ((context) => BlocProvider.value(
|
||||||
value: EligibilityBloc()..add(EligibiltyViewAttachmentEvent(source: source)),
|
value: EligibilityBloc()..add(EligibiltyViewAttachmentEvent(source: source,filename: filename)),
|
||||||
child: const EligibilityViewAttachment(),
|
child: const EligibilityViewAttachment(),
|
||||||
))));
|
))));
|
||||||
},
|
},
|
||||||
|
|
|
@ -510,8 +510,8 @@ class _FamilyBackgroundScreenState extends State<FamilyBackgroundScreen> {
|
||||||
)
|
)
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
child: const Text(
|
child: Text(
|
||||||
"Provide your father's primary information.",
|
"Provide your father's primary information.",style:Theme.of(context).textTheme.bodySmall,
|
||||||
textAlign:
|
textAlign:
|
||||||
TextAlign.center,
|
TextAlign.center,
|
||||||
),
|
),
|
||||||
|
@ -808,8 +808,8 @@ class _FamilyBackgroundScreenState extends State<FamilyBackgroundScreen> {
|
||||||
)
|
)
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
child: const Text(
|
child: Text(
|
||||||
"Provide your mother's primary information",
|
"Provide your mother's primary information",style: Theme.of(context).textTheme.bodySmall,
|
||||||
textAlign:
|
textAlign:
|
||||||
TextAlign.center,
|
TextAlign.center,
|
||||||
),
|
),
|
||||||
|
@ -1238,13 +1238,13 @@ class _FamilyBackgroundScreenState extends State<FamilyBackgroundScreen> {
|
||||||
)
|
)
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
child: const Padding(
|
child: Padding(
|
||||||
padding:
|
padding:
|
||||||
EdgeInsets.symmetric(
|
const EdgeInsets.symmetric(
|
||||||
vertical: 8,
|
vertical: 8,
|
||||||
horizontal: 0),
|
horizontal: 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
"Provide your spouse's primary and employment information. Leave empty if not applicable.",
|
"Provide your spouse's primary and employment information. Leave empty if not applicable.",style: Theme.of(context).textTheme.bodySmall,
|
||||||
textAlign:
|
textAlign:
|
||||||
TextAlign.center,
|
TextAlign.center,
|
||||||
),
|
),
|
||||||
|
@ -1540,13 +1540,13 @@ class _FamilyBackgroundScreenState extends State<FamilyBackgroundScreen> {
|
||||||
}).toList())
|
}).toList())
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
child: const Padding(
|
child: Padding(
|
||||||
padding:
|
padding:
|
||||||
EdgeInsets.symmetric(
|
const EdgeInsets.symmetric(
|
||||||
vertical: 8,
|
vertical: 8,
|
||||||
horizontal: 0),
|
horizontal: 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
"Provide your child/children's primary information. Leave empty if not applicable..",
|
"Provide your child/children's primary information. Leave empty if not applicable.",style: Theme.of(context).textTheme.bodySmall,
|
||||||
textAlign:
|
textAlign:
|
||||||
TextAlign.center,
|
TextAlign.center,
|
||||||
),
|
),
|
||||||
|
@ -1854,13 +1854,13 @@ class _FamilyBackgroundScreenState extends State<FamilyBackgroundScreen> {
|
||||||
}).toList())
|
}).toList())
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
child: const Padding(
|
child: Padding(
|
||||||
padding:
|
padding:
|
||||||
EdgeInsets.symmetric(
|
const EdgeInsets.symmetric(
|
||||||
vertical: 8,
|
vertical: 8,
|
||||||
horizontal: 0),
|
horizontal: 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
"Provide the other related person's primary information. Leave empty if not applicable.",
|
"Provide the other related person's primary information. Leave empty if not applicable.",style: Theme.of(context).textTheme.bodySmall,
|
||||||
textAlign:
|
textAlign:
|
||||||
TextAlign.center,
|
TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
|
@ -28,7 +28,6 @@ import '../../../utils/alerts.dart';
|
||||||
import '../../../widgets/Leadings/close_leading.dart';
|
import '../../../widgets/Leadings/close_leading.dart';
|
||||||
import '../shared/multiple_attachment.dart';
|
import '../shared/multiple_attachment.dart';
|
||||||
import '../shared/single_attachment.dart';
|
import '../shared/single_attachment.dart';
|
||||||
import '../shared/view_attachment.dart';
|
|
||||||
import 'learning_development/add_modal.dart';
|
import 'learning_development/add_modal.dart';
|
||||||
|
|
||||||
class LearningAndDevelopmentScreen extends StatelessWidget {
|
class LearningAndDevelopmentScreen extends StatelessWidget {
|
||||||
|
@ -46,6 +45,7 @@ class LearningAndDevelopmentScreen extends StatelessWidget {
|
||||||
AttachmentCategory? selectedAttachmentCategory;
|
AttachmentCategory? selectedAttachmentCategory;
|
||||||
List<AttachmentCategory> attachmentCategories = [];
|
List<AttachmentCategory> attachmentCategories = [];
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
resizeToAvoidBottomInset: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: context.watch<LearningDevelopmentBloc>().state
|
title: context.watch<LearningDevelopmentBloc>().state
|
||||||
is LearningDevelopmentAddingState
|
is LearningDevelopmentAddingState
|
||||||
|
@ -680,7 +680,7 @@ class LearningAndDevelopmentScreen extends StatelessWidget {
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: ((context) => BlocProvider.value(
|
builder: ((context) => BlocProvider.value(
|
||||||
value: LearningDevelopmentBloc()..add(LearningDevelopmentViewAttachmentEvent(source: state.learningsAndDevelopment[index].attachments!.first.source!)),
|
value: LearningDevelopmentBloc()..add(LearningDevelopmentViewAttachmentEvent(source: state.learningsAndDevelopment[index].attachments!.first.source!,filename: state.learningsAndDevelopment[index].attachments!.first.filename!)),
|
||||||
child: const LearningDevelopmentViewAttachment(),
|
child: const LearningDevelopmentViewAttachment(),
|
||||||
))));
|
))));
|
||||||
},
|
},
|
||||||
|
@ -721,7 +721,7 @@ class LearningAndDevelopmentScreen extends StatelessWidget {
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: ((context) =>
|
builder: ((context) =>
|
||||||
BlocProvider.value(
|
BlocProvider.value(
|
||||||
value: LearningDevelopmentBloc()..add(LearningDevelopmentViewAttachmentEvent(source: source)),
|
value: LearningDevelopmentBloc()..add(LearningDevelopmentViewAttachmentEvent(source: source,filename: filename)),
|
||||||
child: const LearningDevelopmentViewAttachment(),
|
child: const LearningDevelopmentViewAttachment(),
|
||||||
))));
|
))));
|
||||||
},
|
},
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,71 +1,107 @@
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
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_spinkit/flutter_spinkit.dart';
|
||||||
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
||||||
import 'package:unit2/bloc/profile/learningDevelopment/learning_development_bloc.dart';
|
import 'package:unit2/bloc/profile/learningDevelopment/learning_development_bloc.dart';
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
import 'package:unit2/utils/url_launcher_file_downloader.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
class LearningDevelopmentViewAttachment extends StatefulWidget {
|
|
||||||
|
|
||||||
|
class LearningDevelopmentViewAttachment extends StatefulWidget {
|
||||||
const LearningDevelopmentViewAttachment({super.key});
|
const LearningDevelopmentViewAttachment({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<LearningDevelopmentViewAttachment> createState() => _LearningDevelopmentViewAttachmentState();
|
State<LearningDevelopmentViewAttachment> createState() =>
|
||||||
|
_LearningDevelopmentViewAttachmentState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LearningDevelopmentViewAttachmentState extends State<LearningDevelopmentViewAttachment> {
|
class _LearningDevelopmentViewAttachmentState
|
||||||
|
extends State<LearningDevelopmentViewAttachment> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String? fileUrl;
|
String? fileUrl;
|
||||||
|
String? filename;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: ()async {
|
onPressed: () async {
|
||||||
await launchUrl(Uri.parse(fileUrl!));
|
await launchInBrowser(fileUrl!);
|
||||||
},
|
},
|
||||||
child: const Icon(Icons.file_download),
|
child: const Icon(Icons.file_download),
|
||||||
),
|
),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text("Attachment"),
|
title: const Text("Attachment"),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
actions: [
|
actions: context.watch<LearningDevelopmentBloc>().state is LearningAndDevelopmentAttachmentViewState ? [
|
||||||
IconButton(onPressed: () {}, icon: const Icon(Icons.share)),
|
IconButton(onPressed: () {
|
||||||
],
|
context.read<LearningDevelopmentBloc>().add(ShareAttachment(fileName: filename!, source: fileUrl!));
|
||||||
),
|
}, icon: const Icon(Icons.share)),
|
||||||
body: BlocConsumer<LearningDevelopmentBloc, LearningDevelopmentState>(builder: (context,state){
|
]:[]
|
||||||
if(state is LearningAndDevelopmentAttachmentViewState){
|
),
|
||||||
fileUrl = state.fileUrl;
|
body: ProgressHUD(
|
||||||
bool isPDF = state.fileUrl[state.fileUrl.length - 1] == 'f' ? true : false;
|
padding: const EdgeInsets.all(24),
|
||||||
return SizedBox(
|
backgroundColor: Colors.black87,
|
||||||
child: isPDF?SfPdfViewer.network(
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
state.fileUrl,onDocumentLoadFailed: (details) {
|
child:
|
||||||
Center(child: Text(details.description),);
|
BlocConsumer<LearningDevelopmentBloc, LearningDevelopmentState>(
|
||||||
},): Center(
|
builder: (context, state) {
|
||||||
child: CachedNetworkImage(
|
if (state is LearningAndDevelopmentAttachmentViewState) {
|
||||||
progressIndicatorBuilder: (context, url, progress) {
|
fileUrl = state.fileUrl;
|
||||||
return const SizedBox(
|
filename = state.filename;
|
||||||
height: 100,
|
bool isPDF = state.fileUrl[state.fileUrl.length - 1] == 'f'
|
||||||
width: 100,
|
? true
|
||||||
child: CircularProgressIndicator(color: primary,));
|
: false;
|
||||||
},
|
return SizedBox(
|
||||||
|
child: isPDF
|
||||||
imageBuilder: (context, imageProvider) => Container(
|
? SfPdfViewer.network(
|
||||||
decoration: BoxDecoration(
|
|
||||||
image: DecorationImage(
|
state.fileUrl,
|
||||||
image: imageProvider, fit: BoxFit.fill)),
|
onDocumentLoadFailed: (details) {
|
||||||
),
|
Center(
|
||||||
imageUrl:
|
child: Text(details.description),
|
||||||
state.fileUrl,
|
);
|
||||||
width: double.infinity,
|
},
|
||||||
height: 220,
|
)
|
||||||
fit: BoxFit.cover,
|
: Center(
|
||||||
),
|
child: CachedNetworkImage(
|
||||||
),
|
progressIndicatorBuilder: (context, url, progress) {
|
||||||
);
|
return const SizedBox(
|
||||||
}
|
height: 100,
|
||||||
return Container();
|
width: 100,
|
||||||
},listener: (context, state) {
|
child: CircularProgressIndicator(
|
||||||
|
color: primary,
|
||||||
},)
|
));
|
||||||
);
|
},
|
||||||
|
imageBuilder: (context, imageProvider) => Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
image: DecorationImage(
|
||||||
|
image: imageProvider, fit: BoxFit.fill)),
|
||||||
|
),
|
||||||
|
imageUrl: state.fileUrl,
|
||||||
|
width: double.infinity,
|
||||||
|
height: 220,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
listener: (context, state) {
|
||||||
|
|
||||||
|
if (state is LearningDevelopmentLoadingState) {
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.showWithText("Please wait...");
|
||||||
|
}
|
||||||
|
if (state is LearningAndDevelopmentAttachmentViewState ||
|
||||||
|
state is LearningDevelopmentErrorState) {
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.dismiss();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ class _EditNonAcademicRecognitionScreenState
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
FormBuilderTextField(
|
FormBuilderTextField(
|
||||||
|
inputFormatters: [UpperCaseTextFormatter()],
|
||||||
name: 'title',
|
name: 'title',
|
||||||
initialValue:
|
initialValue:
|
||||||
state.nonAcademicRecognition.title,
|
state.nonAcademicRecognition.title,
|
||||||
|
@ -205,6 +206,7 @@ class _EditNonAcademicRecognitionScreenState
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
TextFormField(
|
TextFormField(
|
||||||
|
inputFormatters: [UpperCaseTextFormatter()],
|
||||||
controller:
|
controller:
|
||||||
addAgencyController,
|
addAgencyController,
|
||||||
decoration:
|
decoration:
|
||||||
|
|
|
@ -53,316 +53,303 @@ class _AddReferenceScreenState extends State<AddReferenceScreen> {
|
||||||
return BlocBuilder<ReferencesBloc, ReferencesState>(
|
return BlocBuilder<ReferencesBloc, ReferencesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is AddReferenceState) {
|
if (state is AddReferenceState) {
|
||||||
return SingleChildScrollView(
|
return FormBuilder(
|
||||||
child: FormBuilder(
|
key: formKey,
|
||||||
key: formKey,
|
child: Padding(
|
||||||
child: SizedBox(
|
padding: const EdgeInsets.all(28),
|
||||||
height: screenHeight * .90,
|
child: ListView(
|
||||||
child: Padding(
|
children: [
|
||||||
padding: const EdgeInsets.all(28),
|
|
||||||
child: Column(
|
Row(
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 15,),
|
////LAST NAME
|
||||||
Flexible(
|
Flexible(
|
||||||
child: ListView(
|
flex: 1,
|
||||||
children: [
|
child: FormBuilderTextField(
|
||||||
|
inputFormatters: [UpperCaseTextFormatter()],
|
||||||
Row(
|
decoration: normalTextFieldStyle(
|
||||||
children: [
|
"Last name *", "Last name *"),
|
||||||
////LAST NAME
|
name: "lastname",
|
||||||
Flexible(
|
validator: FormBuilderValidators.required(
|
||||||
flex: 1,
|
errorText: "This field is required"),
|
||||||
child: FormBuilderTextField(
|
|
||||||
inputFormatters: [UpperCaseTextFormatter()],
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Last name *", "Last name *"),
|
|
||||||
name: "lastname",
|
|
||||||
validator: FormBuilderValidators.required(
|
|
||||||
errorText: "This field is required"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 8,
|
|
||||||
),
|
|
||||||
////FIRST NAME
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
inputFormatters: [UpperCaseTextFormatter()],
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"First name *", "First name *"),
|
|
||||||
name: "firstname",
|
|
||||||
validator: FormBuilderValidators.required(
|
|
||||||
errorText: "This field is required"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
inputFormatters: [
|
|
||||||
UpperCaseTextFormatter()
|
|
||||||
],
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Middle name ", ""),
|
|
||||||
name: "middlename",
|
|
||||||
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 8,
|
|
||||||
),
|
|
||||||
////Mobile
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
inputFormatters: [mobileFormatter],
|
|
||||||
name: "mobile",
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Mobile *",
|
|
||||||
"+63 (9xx) xxx - xxxx"),
|
|
||||||
validator: FormBuilderValidators.required(
|
|
||||||
errorText: "This field is required"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
FormBuilderDropdown<AddressCategory>(
|
|
||||||
name: 'category',
|
|
||||||
validator:
|
|
||||||
FormBuilderValidators.required(errorText: "This field is required"),
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Address Category", "Address Category"),
|
|
||||||
items: state.categories
|
|
||||||
.map<DropdownMenuItem<AddressCategory>>(
|
|
||||||
(AddressCategory cat) {
|
|
||||||
return DropdownMenuItem<AddressCategory>(
|
|
||||||
value: cat,
|
|
||||||
child: Text(cat.name!),
|
|
||||||
);
|
|
||||||
}).toList(),
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
selectedCategory = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
////OVERSEAS ADDRESS
|
|
||||||
FormBuilderSwitch(
|
|
||||||
initialValue: overseas,
|
|
||||||
activeColor: second,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
overseas = value!;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
decoration: normalTextFieldStyle("", ''),
|
|
||||||
name: 'overseas',
|
|
||||||
title: const Text("Overseas Address?"),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: overseas == true ? 12 : 0,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
child: overseas == false
|
|
||||||
? Column(
|
|
||||||
children: [
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
////REGION DROPDOWN
|
|
||||||
FormBuilderDropdown<Region?>(
|
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode.onUserInteraction,
|
|
||||||
validator:
|
|
||||||
FormBuilderValidators.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
onChanged: (Region? region) async {
|
|
||||||
if (selectedRegion != region) {
|
|
||||||
setState(() {
|
|
||||||
provinceCall = true;
|
|
||||||
});
|
|
||||||
selectedRegion = region;
|
|
||||||
getProvinces();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
initialValue: null,
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Region*", "Region"),
|
|
||||||
name: 'region',
|
|
||||||
items: state.regions
|
|
||||||
.map<DropdownMenuItem<Region>>(
|
|
||||||
(Region region) {
|
|
||||||
return DropdownMenuItem<Region>(
|
|
||||||
value: region,
|
|
||||||
child: Text(region.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
//// PROVINCE DROPDOWN
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.transparent,
|
|
||||||
inAsyncCall: provinceCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
Province?>(
|
|
||||||
autovalidateMode: AutovalidateMode
|
|
||||||
.onUserInteraction,
|
|
||||||
validator: (value) =>
|
|
||||||
value == null
|
|
||||||
? 'This field is required'
|
|
||||||
: null,
|
|
||||||
isExpanded: true,
|
|
||||||
value: selectedProvince,
|
|
||||||
onChanged: (Province? province) {
|
|
||||||
if (selectedProvince !=
|
|
||||||
province) {
|
|
||||||
setState(() {
|
|
||||||
cityCall = true;
|
|
||||||
});
|
|
||||||
selectedProvince = province;
|
|
||||||
getCities();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
items: provinces == null
|
|
||||||
? []
|
|
||||||
: provinces!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Province>>(
|
|
||||||
(Province province) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: province,
|
|
||||||
child: FittedBox(
|
|
||||||
child: Text(province
|
|
||||||
.description!),
|
|
||||||
));
|
|
||||||
}).toList(),
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Province*", "Province")),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
////CITY MUNICIPALITY
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: cityCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
CityMunicipality>(
|
|
||||||
validator:
|
|
||||||
FormBuilderValidators.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged:
|
|
||||||
(CityMunicipality? city) {
|
|
||||||
if (selectedMunicipality !=
|
|
||||||
city) {
|
|
||||||
setState(() {
|
|
||||||
barangayCall = true;
|
|
||||||
});
|
|
||||||
selectedMunicipality = city;
|
|
||||||
getBarangays();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Municipality*",
|
|
||||||
"Municipality"),
|
|
||||||
value: selectedMunicipality,
|
|
||||||
items: citymuns == null
|
|
||||||
? []
|
|
||||||
: citymuns!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
CityMunicipality>>(
|
|
||||||
(CityMunicipality c) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: c,
|
|
||||||
child: Text(
|
|
||||||
c.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
//// BARANGAY
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: barangayCall,
|
|
||||||
child:
|
|
||||||
DropdownButtonFormField<Barangay>(
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged: (Barangay? baragay) {
|
|
||||||
selectedBarangay = baragay;
|
|
||||||
},
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Barangay*", "Barangay"),
|
|
||||||
value: selectedBarangay,
|
|
||||||
items: barangays == null
|
|
||||||
? []
|
|
||||||
: barangays!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Barangay>>(
|
|
||||||
(Barangay barangay) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: barangay,
|
|
||||||
child: Text(barangay
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
//// COUNTRY DROPDOWN
|
|
||||||
: SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: FormBuilderDropdown<Country>(
|
|
||||||
initialValue: null,
|
|
||||||
validator: FormBuilderValidators.required(
|
|
||||||
errorText: "This field is required"),
|
|
||||||
items: state.countries
|
|
||||||
.map<DropdownMenuItem<Country>>(
|
|
||||||
(Country country) {
|
|
||||||
return DropdownMenuItem<Country>(
|
|
||||||
value: country,
|
|
||||||
child: FittedBox(
|
|
||||||
child: Text(country.name!)));
|
|
||||||
}).toList(),
|
|
||||||
name: 'country',
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Country*", "Country"),
|
|
||||||
onChanged: (Country? value) {
|
|
||||||
selectedCountry = value;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
const SizedBox(
|
||||||
|
width: 8,
|
||||||
|
),
|
||||||
|
////FIRST NAME
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
inputFormatters: [UpperCaseTextFormatter()],
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"First name *", "First name *"),
|
||||||
|
name: "firstname",
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
inputFormatters: [
|
||||||
|
UpperCaseTextFormatter()
|
||||||
|
],
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Middle name ", ""),
|
||||||
|
name: "middlename",
|
||||||
|
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 8,
|
||||||
|
),
|
||||||
|
////Mobile
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
inputFormatters: [mobileFormatter],
|
||||||
|
name: "mobile",
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Mobile *",
|
||||||
|
"+63 (9xx) xxx - xxxx"),
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
FormBuilderDropdown<AddressCategory>(
|
||||||
|
name: 'category',
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(errorText: "This field is required"),
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Address Category", "Address Category"),
|
||||||
|
items: state.categories
|
||||||
|
.map<DropdownMenuItem<AddressCategory>>(
|
||||||
|
(AddressCategory cat) {
|
||||||
|
return DropdownMenuItem<AddressCategory>(
|
||||||
|
value: cat,
|
||||||
|
child: Text(cat.name!),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
selectedCategory = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////OVERSEAS ADDRESS
|
||||||
|
FormBuilderSwitch(
|
||||||
|
initialValue: overseas,
|
||||||
|
activeColor: second,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
overseas = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
decoration: normalTextFieldStyle("", ''),
|
||||||
|
name: 'overseas',
|
||||||
|
title: const Text("Overseas Address?"),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: overseas == true ? 12 : 0,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
child: overseas == false
|
||||||
|
? Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
////REGION DROPDOWN
|
||||||
|
FormBuilderDropdown<Region?>(
|
||||||
|
autovalidateMode:
|
||||||
|
AutovalidateMode.onUserInteraction,
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
onChanged: (Region? region) async {
|
||||||
|
if (selectedRegion != region) {
|
||||||
|
setState(() {
|
||||||
|
provinceCall = true;
|
||||||
|
});
|
||||||
|
selectedRegion = region;
|
||||||
|
getProvinces();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initialValue: null,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Region*", "Region"),
|
||||||
|
name: 'region',
|
||||||
|
items: state.regions
|
||||||
|
.map<DropdownMenuItem<Region>>(
|
||||||
|
(Region region) {
|
||||||
|
return DropdownMenuItem<Region>(
|
||||||
|
value: region,
|
||||||
|
child: Text(region.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
//// PROVINCE DROPDOWN
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.transparent,
|
||||||
|
inAsyncCall: provinceCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
Province?>(
|
||||||
|
autovalidateMode: AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator: (value) =>
|
||||||
|
value == null
|
||||||
|
? 'This field is required'
|
||||||
|
: null,
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedProvince,
|
||||||
|
onChanged: (Province? province) {
|
||||||
|
if (selectedProvince !=
|
||||||
|
province) {
|
||||||
|
setState(() {
|
||||||
|
cityCall = true;
|
||||||
|
});
|
||||||
|
selectedProvince = province;
|
||||||
|
getCities();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
items: provinces == null
|
||||||
|
? []
|
||||||
|
: provinces!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
Province>>(
|
||||||
|
(Province province) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: province,
|
||||||
|
child: FittedBox(
|
||||||
|
child: Text(province
|
||||||
|
.description!),
|
||||||
|
));
|
||||||
|
}).toList(),
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Province*", "Province")),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
////CITY MUNICIPALITY
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.white,
|
||||||
|
inAsyncCall: cityCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
CityMunicipality>(
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
isExpanded: true,
|
||||||
|
onChanged:
|
||||||
|
(CityMunicipality? city) {
|
||||||
|
if (selectedMunicipality !=
|
||||||
|
city) {
|
||||||
|
setState(() {
|
||||||
|
barangayCall = true;
|
||||||
|
});
|
||||||
|
selectedMunicipality = city;
|
||||||
|
getBarangays();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Municipality*",
|
||||||
|
"Municipality"),
|
||||||
|
value: selectedMunicipality,
|
||||||
|
items: citymuns == null
|
||||||
|
? []
|
||||||
|
: citymuns!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
CityMunicipality>>(
|
||||||
|
(CityMunicipality c) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: c,
|
||||||
|
child: Text(
|
||||||
|
c.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
//// BARANGAY
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.white,
|
||||||
|
inAsyncCall: barangayCall,
|
||||||
|
child:
|
||||||
|
DropdownButtonFormField<Barangay>(
|
||||||
|
isExpanded: true,
|
||||||
|
onChanged: (Barangay? baragay) {
|
||||||
|
selectedBarangay = baragay;
|
||||||
|
},
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Barangay*", "Barangay"),
|
||||||
|
value: selectedBarangay,
|
||||||
|
items: barangays == null
|
||||||
|
? []
|
||||||
|
: barangays!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
Barangay>>(
|
||||||
|
(Barangay barangay) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: barangay,
|
||||||
|
child: Text(barangay
|
||||||
|
.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
//// COUNTRY DROPDOWN
|
||||||
|
: SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: FormBuilderDropdown<Country>(
|
||||||
|
initialValue: null,
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
items: state.countries
|
||||||
|
.map<DropdownMenuItem<Country>>(
|
||||||
|
(Country country) {
|
||||||
|
return DropdownMenuItem<Country>(
|
||||||
|
value: country,
|
||||||
|
child: FittedBox(
|
||||||
|
child: Text(country.name!)));
|
||||||
|
}).toList(),
|
||||||
|
name: 'country',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Country*", "Country"),
|
||||||
|
onChanged: (Country? value) {
|
||||||
|
selectedCountry = value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16,),
|
||||||
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 60,
|
height: 60,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
@ -438,13 +425,12 @@ class _AddReferenceScreenState extends State<AddReferenceScreen> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
)),
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return Container();
|
return Container();
|
||||||
},
|
},
|
||||||
|
|
|
@ -72,473 +72,461 @@ class _EditReferenceScreenState extends State<EditReferenceScreen> {
|
||||||
|
|
||||||
return FormBuilder(
|
return FormBuilder(
|
||||||
key: formKey,
|
key: formKey,
|
||||||
child: SizedBox(
|
child: Padding(
|
||||||
height: screenHeight * .90,
|
padding: const EdgeInsets.all(28),
|
||||||
child: Padding(
|
child: ListView(
|
||||||
padding: const EdgeInsets.all(28),
|
children: [
|
||||||
child: Column(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
////LAST NAME
|
||||||
child: Column(
|
Flexible(
|
||||||
children: [
|
flex: 1,
|
||||||
const SizedBox(height: 25),
|
child: FormBuilderTextField(
|
||||||
Row(
|
inputFormatters: [UpperCaseTextFormatter(),mobileFormatter],
|
||||||
children: [
|
initialValue: state.ref.lastName,
|
||||||
////LAST NAME
|
decoration: normalTextFieldStyle(
|
||||||
Flexible(
|
"Last name *", "Last name *"),
|
||||||
flex: 1,
|
name: "lastname",
|
||||||
child: FormBuilderTextField(
|
validator: FormBuilderValidators.required(
|
||||||
inputFormatters: [UpperCaseTextFormatter(),mobileFormatter],
|
errorText: "This field is required"),
|
||||||
initialValue: state.ref.lastName,
|
),
|
||||||
decoration: normalTextFieldStyle(
|
),
|
||||||
"Last name *", "Last name *"),
|
const SizedBox(
|
||||||
name: "lastname",
|
width: 8,
|
||||||
validator: FormBuilderValidators.required(
|
),
|
||||||
errorText: "This field is required"),
|
////FIRST NAME
|
||||||
),
|
Flexible(
|
||||||
),
|
flex: 1,
|
||||||
const SizedBox(
|
child: FormBuilderTextField(
|
||||||
width: 8,
|
inputFormatters: [UpperCaseTextFormatter()],
|
||||||
),
|
initialValue: state.ref.firstName,
|
||||||
////FIRST NAME
|
decoration: normalTextFieldStyle(
|
||||||
Flexible(
|
"First name *", "First name *"),
|
||||||
flex: 1,
|
name: "firstname",
|
||||||
child: FormBuilderTextField(
|
validator: FormBuilderValidators.required(
|
||||||
inputFormatters: [UpperCaseTextFormatter()],
|
errorText: "This field is required"),
|
||||||
initialValue: state.ref.firstName,
|
),
|
||||||
decoration: normalTextFieldStyle(
|
),
|
||||||
"First name *", "First name *"),
|
],
|
||||||
name: "firstname",
|
),
|
||||||
validator: FormBuilderValidators.required(
|
const SizedBox(
|
||||||
errorText: "This field is required"),
|
height: 12,
|
||||||
),
|
),
|
||||||
),
|
Row(
|
||||||
],
|
children: [
|
||||||
),
|
Flexible(
|
||||||
const SizedBox(
|
flex: 1,
|
||||||
height: 12,
|
child: FormBuilderTextField(
|
||||||
),
|
inputFormatters: [UpperCaseTextFormatter()],
|
||||||
Row(
|
initialValue: state.ref.middleName,
|
||||||
children: [
|
decoration: normalTextFieldStyle(
|
||||||
Flexible(
|
"Middle name *", "Midlle name *"),
|
||||||
flex: 1,
|
name: "middlename",
|
||||||
child: FormBuilderTextField(
|
),
|
||||||
inputFormatters: [UpperCaseTextFormatter()],
|
),
|
||||||
initialValue: state.ref.middleName,
|
const SizedBox(
|
||||||
decoration: normalTextFieldStyle(
|
width: 8,
|
||||||
"Middle name *", "Midlle name *"),
|
),
|
||||||
name: "middlename",
|
////CATEGORY
|
||||||
),
|
Flexible(
|
||||||
),
|
flex: 1,
|
||||||
const SizedBox(
|
child: FormBuilderTextField(
|
||||||
width: 8,
|
initialValue: state.ref.contactNo,
|
||||||
),
|
name: "mobile",
|
||||||
////CATEGORY
|
decoration: normalTextFieldStyle(
|
||||||
Flexible(
|
"Tel./Mobile *", "Tel./Mobile"),
|
||||||
flex: 1,
|
validator: FormBuilderValidators.required(
|
||||||
child: FormBuilderTextField(
|
errorText: "This field is required"),
|
||||||
initialValue: state.ref.contactNo,
|
),
|
||||||
name: "mobile",
|
),
|
||||||
decoration: normalTextFieldStyle(
|
],
|
||||||
"Tel./Mobile *", "Tel./Mobile"),
|
),
|
||||||
validator: FormBuilderValidators.required(
|
const SizedBox(
|
||||||
errorText: "This field is required"),
|
height: 12,
|
||||||
),
|
),
|
||||||
),
|
FormBuilderDropdown<AddressCategory>(
|
||||||
],
|
name: 'category',
|
||||||
),
|
validator: FormBuilderValidators.required(
|
||||||
const SizedBox(
|
errorText: "This field is required"),
|
||||||
height: 12,
|
decoration: normalTextFieldStyle(
|
||||||
),
|
"Address Category", "Address Category"),
|
||||||
FormBuilderDropdown<AddressCategory>(
|
items: state.categories
|
||||||
name: 'category',
|
.map<DropdownMenuItem<AddressCategory>>(
|
||||||
validator: FormBuilderValidators.required(
|
(AddressCategory cat) {
|
||||||
errorText: "This field is required"),
|
return DropdownMenuItem<AddressCategory>(
|
||||||
decoration: normalTextFieldStyle(
|
value: cat,
|
||||||
"Address Category", "Address Category"),
|
child: Text(cat.name!),
|
||||||
items: state.categories
|
);
|
||||||
.map<DropdownMenuItem<AddressCategory>>(
|
}).toList(),
|
||||||
(AddressCategory cat) {
|
initialValue: selectedCategory,
|
||||||
return DropdownMenuItem<AddressCategory>(
|
onChanged: (value) {
|
||||||
value: cat,
|
selectedCategory = value;
|
||||||
child: Text(cat.name!),
|
},
|
||||||
);
|
),
|
||||||
}).toList(),
|
const SizedBox(
|
||||||
initialValue: selectedCategory,
|
height: 12,
|
||||||
onChanged: (value) {
|
),
|
||||||
selectedCategory = value;
|
////OVERSEAS ADDRESS
|
||||||
},
|
StatefulBuilder(builder: (context, setState) {
|
||||||
),
|
return Column(
|
||||||
const SizedBox(
|
children: [
|
||||||
height: 12,
|
FormBuilderSwitch(
|
||||||
),
|
initialValue: overseas,
|
||||||
////OVERSEAS ADDRESS
|
activeColor: second,
|
||||||
StatefulBuilder(builder: (context, setState) {
|
onChanged: (value) {
|
||||||
return Column(
|
setState(() {
|
||||||
children: [
|
overseas = value!;
|
||||||
FormBuilderSwitch(
|
});
|
||||||
initialValue: overseas,
|
},
|
||||||
activeColor: second,
|
decoration: normalTextFieldStyle("", ''),
|
||||||
onChanged: (value) {
|
name: 'overseas',
|
||||||
setState(() {
|
title: const Text("Overseas Address?"),
|
||||||
overseas = value!;
|
),
|
||||||
});
|
SizedBox(
|
||||||
},
|
height: overseas == true ? 12 : 0,
|
||||||
decoration: normalTextFieldStyle("", ''),
|
),
|
||||||
name: 'overseas',
|
SizedBox(
|
||||||
title: const Text("Overseas Address?"),
|
child: overseas == false
|
||||||
),
|
? Column(
|
||||||
SizedBox(
|
children: [
|
||||||
height: overseas == true ? 12 : 0,
|
const SizedBox(
|
||||||
),
|
height: 12,
|
||||||
SizedBox(
|
),
|
||||||
child: overseas == false
|
////REGION DROPDOWN
|
||||||
? Column(
|
DropdownButtonFormField<Region?>(
|
||||||
children: [
|
isExpanded: true,
|
||||||
const SizedBox(
|
autovalidateMode:
|
||||||
height: 12,
|
AutovalidateMode
|
||||||
),
|
.onUserInteraction,
|
||||||
////REGION DROPDOWN
|
validator: FormBuilderValidators
|
||||||
DropdownButtonFormField<Region?>(
|
.required(
|
||||||
isExpanded: true,
|
errorText:
|
||||||
autovalidateMode:
|
"This field is required"),
|
||||||
AutovalidateMode
|
onChanged:
|
||||||
.onUserInteraction,
|
(Region? region) async {
|
||||||
validator: FormBuilderValidators
|
setState(() {
|
||||||
.required(
|
provinceCall = true;
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
onChanged:
|
|
||||||
(Region? region) async {
|
|
||||||
setState(() {
|
|
||||||
provinceCall = true;
|
|
||||||
|
|
||||||
selectedRegion = region;
|
selectedRegion = region;
|
||||||
});
|
});
|
||||||
//// GET PROVINCES
|
//// GET PROVINCES
|
||||||
try {
|
try {
|
||||||
provinces = await LocationUtils
|
provinces = await LocationUtils
|
||||||
.instance
|
.instance
|
||||||
.getProvinces(
|
.getProvinces(
|
||||||
regionCode:
|
regionCode:
|
||||||
selectedRegion!
|
selectedRegion!
|
||||||
.code
|
.code
|
||||||
.toString());
|
.toString());
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
context
|
context
|
||||||
.read<ReferencesBloc>()
|
.read<ReferencesBloc>()
|
||||||
.add(CallErrorState());
|
.add(CallErrorState());
|
||||||
}
|
}
|
||||||
selectedProvince =
|
selectedProvince =
|
||||||
provinces![0];
|
provinces![0];
|
||||||
setState(() {
|
setState(() {
|
||||||
provinceCall = false;
|
provinceCall = false;
|
||||||
cityCall = true;
|
cityCall = true;
|
||||||
});
|
});
|
||||||
////GET CITY MUNICIPALITY
|
////GET CITY MUNICIPALITY
|
||||||
try {
|
try {
|
||||||
citymuns = await LocationUtils
|
citymuns = await LocationUtils
|
||||||
.instance
|
.instance
|
||||||
.getCities(
|
.getCities(
|
||||||
code:
|
code:
|
||||||
selectedProvince!
|
selectedProvince!
|
||||||
.code!);
|
.code!);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
NavigationService
|
NavigationService
|
||||||
.navigatorKey
|
.navigatorKey
|
||||||
.currentContext
|
.currentContext
|
||||||
?.read<ReferencesBloc>()
|
?.read<ReferencesBloc>()
|
||||||
.add(CallErrorState());
|
.add(CallErrorState());
|
||||||
}
|
}
|
||||||
selectedMunicipality =
|
selectedMunicipality =
|
||||||
citymuns![0];
|
citymuns![0];
|
||||||
setState(() {
|
setState(() {
|
||||||
cityCall = false;
|
cityCall = false;
|
||||||
barangayCall = true;
|
barangayCall = true;
|
||||||
});
|
});
|
||||||
//// GET BARANGAYS
|
//// GET BARANGAYS
|
||||||
try {
|
try {
|
||||||
barangays = await LocationUtils
|
barangays = await LocationUtils
|
||||||
|
.instance
|
||||||
|
.getBarangay(
|
||||||
|
code:
|
||||||
|
selectedMunicipality!
|
||||||
|
.code!);
|
||||||
|
selectedBarangay =
|
||||||
|
barangays![0];
|
||||||
|
} catch (e) {
|
||||||
|
NavigationService
|
||||||
|
.navigatorKey
|
||||||
|
.currentContext
|
||||||
|
?.read<ReferencesBloc>()
|
||||||
|
.add(CallErrorState());
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
barangayCall = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
value: selectedRegion,
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Region*", "Region"),
|
||||||
|
items: state.regions.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
Region>>(
|
||||||
|
(Region region) {
|
||||||
|
return DropdownMenuItem<
|
||||||
|
Region>(
|
||||||
|
value: region,
|
||||||
|
child: Text(
|
||||||
|
region.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
//// PROVINCE DROPDOWN
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.transparent,
|
||||||
|
inAsyncCall: provinceCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
Province?>(
|
||||||
|
autovalidateMode:
|
||||||
|
AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator: (value) =>
|
||||||
|
value == null
|
||||||
|
? 'required'
|
||||||
|
: null,
|
||||||
|
isExpanded: true,
|
||||||
|
onChanged: (Province?
|
||||||
|
province) async {
|
||||||
|
selectedProvince =
|
||||||
|
province;
|
||||||
|
setState(() {
|
||||||
|
cityCall = true;
|
||||||
|
});
|
||||||
|
//// GET CITIES
|
||||||
|
try {
|
||||||
|
citymuns =
|
||||||
|
await LocationUtils
|
||||||
|
.instance
|
||||||
|
.getCities(
|
||||||
|
code: selectedProvince!
|
||||||
|
.code!);
|
||||||
|
} catch (e) {
|
||||||
|
NavigationService
|
||||||
|
.navigatorKey
|
||||||
|
.currentContext
|
||||||
|
?.read<
|
||||||
|
ReferencesBloc>()
|
||||||
|
.add(
|
||||||
|
CallErrorState());
|
||||||
|
}
|
||||||
|
selectedMunicipality =
|
||||||
|
citymuns![0];
|
||||||
|
setState(() {
|
||||||
|
cityCall = false;
|
||||||
|
barangayCall = true;
|
||||||
|
});
|
||||||
|
//// GET BARANGAY
|
||||||
|
try {
|
||||||
|
barangays =
|
||||||
|
await LocationUtils
|
||||||
|
.instance
|
||||||
|
.getBarangay(
|
||||||
|
code: selectedMunicipality!
|
||||||
|
.code!);
|
||||||
|
} catch (e) {
|
||||||
|
NavigationService
|
||||||
|
.navigatorKey
|
||||||
|
.currentContext
|
||||||
|
?.read<
|
||||||
|
ReferencesBloc>()
|
||||||
|
.add(
|
||||||
|
CallErrorState());
|
||||||
|
}
|
||||||
|
selectedBarangay =
|
||||||
|
barangays![0];
|
||||||
|
setState(() {
|
||||||
|
barangayCall = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
value: selectedProvince,
|
||||||
|
items: provinces == null
|
||||||
|
? []
|
||||||
|
: provinces!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
Province>>(
|
||||||
|
(Province
|
||||||
|
province) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value:
|
||||||
|
province,
|
||||||
|
child:
|
||||||
|
FittedBox(
|
||||||
|
child: Text(
|
||||||
|
province
|
||||||
|
.description!),
|
||||||
|
));
|
||||||
|
}).toList(),
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Province*",
|
||||||
|
"Province")),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
////CITY MUNICIPALITY
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.white,
|
||||||
|
inAsyncCall: cityCall,
|
||||||
|
child:
|
||||||
|
DropdownButtonFormField<
|
||||||
|
CityMunicipality>(
|
||||||
|
validator: FormBuilderValidators
|
||||||
|
.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
isExpanded: true,
|
||||||
|
onChanged:
|
||||||
|
(CityMunicipality?
|
||||||
|
city) async {
|
||||||
|
setState(() {
|
||||||
|
barangayCall = true;
|
||||||
|
});
|
||||||
|
selectedMunicipality =
|
||||||
|
city;
|
||||||
|
//// GET BARANGAYS
|
||||||
|
try {
|
||||||
|
barangays =
|
||||||
|
await LocationUtils
|
||||||
.instance
|
.instance
|
||||||
.getBarangay(
|
.getBarangay(
|
||||||
code:
|
code: selectedMunicipality!
|
||||||
selectedMunicipality!
|
.code!);
|
||||||
.code!);
|
} catch (e) {
|
||||||
selectedBarangay =
|
NavigationService
|
||||||
barangays![0];
|
.navigatorKey
|
||||||
} catch (e) {
|
.currentContext
|
||||||
NavigationService
|
?.read<
|
||||||
.navigatorKey
|
ReferencesBloc>()
|
||||||
.currentContext
|
.add(
|
||||||
?.read<ReferencesBloc>()
|
CallErrorState());
|
||||||
.add(CallErrorState());
|
}
|
||||||
}
|
selectedBarangay =
|
||||||
setState(() {
|
barangays![0];
|
||||||
barangayCall = false;
|
setState(() {
|
||||||
});
|
barangayCall = false;
|
||||||
},
|
});
|
||||||
value: selectedRegion,
|
},
|
||||||
decoration:
|
decoration:
|
||||||
normalTextFieldStyle(
|
normalTextFieldStyle(
|
||||||
"Region*", "Region"),
|
"Municipality*",
|
||||||
items: state.regions.map<
|
"Municipality"),
|
||||||
|
value: selectedMunicipality,
|
||||||
|
items: citymuns == null
|
||||||
|
? []
|
||||||
|
: citymuns!.map<
|
||||||
DropdownMenuItem<
|
DropdownMenuItem<
|
||||||
Region>>(
|
CityMunicipality>>(
|
||||||
(Region region) {
|
(CityMunicipality
|
||||||
return DropdownMenuItem<
|
c) {
|
||||||
Region>(
|
return DropdownMenuItem(
|
||||||
value: region,
|
value: c,
|
||||||
child: Text(
|
child: Text(c
|
||||||
region.description!));
|
.description!));
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
//// PROVINCE DROPDOWN
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.transparent,
|
|
||||||
inAsyncCall: provinceCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
Province?>(
|
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode
|
|
||||||
.onUserInteraction,
|
|
||||||
validator: (value) =>
|
|
||||||
value == null
|
|
||||||
? 'required'
|
|
||||||
: null,
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged: (Province?
|
|
||||||
province) async {
|
|
||||||
selectedProvince =
|
|
||||||
province;
|
|
||||||
setState(() {
|
|
||||||
cityCall = true;
|
|
||||||
});
|
|
||||||
//// GET CITIES
|
|
||||||
try {
|
|
||||||
citymuns =
|
|
||||||
await LocationUtils
|
|
||||||
.instance
|
|
||||||
.getCities(
|
|
||||||
code: selectedProvince!
|
|
||||||
.code!);
|
|
||||||
} catch (e) {
|
|
||||||
NavigationService
|
|
||||||
.navigatorKey
|
|
||||||
.currentContext
|
|
||||||
?.read<
|
|
||||||
ReferencesBloc>()
|
|
||||||
.add(
|
|
||||||
CallErrorState());
|
|
||||||
}
|
|
||||||
selectedMunicipality =
|
|
||||||
citymuns![0];
|
|
||||||
setState(() {
|
|
||||||
cityCall = false;
|
|
||||||
barangayCall = true;
|
|
||||||
});
|
|
||||||
//// GET BARANGAY
|
|
||||||
try {
|
|
||||||
barangays =
|
|
||||||
await LocationUtils
|
|
||||||
.instance
|
|
||||||
.getBarangay(
|
|
||||||
code: selectedMunicipality!
|
|
||||||
.code!);
|
|
||||||
} catch (e) {
|
|
||||||
NavigationService
|
|
||||||
.navigatorKey
|
|
||||||
.currentContext
|
|
||||||
?.read<
|
|
||||||
ReferencesBloc>()
|
|
||||||
.add(
|
|
||||||
CallErrorState());
|
|
||||||
}
|
|
||||||
selectedBarangay =
|
|
||||||
barangays![0];
|
|
||||||
setState(() {
|
|
||||||
barangayCall = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
value: selectedProvince,
|
|
||||||
items: provinces == null
|
|
||||||
? []
|
|
||||||
: provinces!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Province>>(
|
|
||||||
(Province
|
|
||||||
province) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value:
|
|
||||||
province,
|
|
||||||
child:
|
|
||||||
FittedBox(
|
|
||||||
child: Text(
|
|
||||||
province
|
|
||||||
.description!),
|
|
||||||
));
|
|
||||||
}).toList(),
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Province*",
|
|
||||||
"Province")),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
////CITY MUNICIPALITY
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: cityCall,
|
|
||||||
child:
|
|
||||||
DropdownButtonFormField<
|
|
||||||
CityMunicipality>(
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged:
|
|
||||||
(CityMunicipality?
|
|
||||||
city) async {
|
|
||||||
setState(() {
|
|
||||||
barangayCall = true;
|
|
||||||
});
|
|
||||||
selectedMunicipality =
|
|
||||||
city;
|
|
||||||
//// GET BARANGAYS
|
|
||||||
try {
|
|
||||||
barangays =
|
|
||||||
await LocationUtils
|
|
||||||
.instance
|
|
||||||
.getBarangay(
|
|
||||||
code: selectedMunicipality!
|
|
||||||
.code!);
|
|
||||||
} catch (e) {
|
|
||||||
NavigationService
|
|
||||||
.navigatorKey
|
|
||||||
.currentContext
|
|
||||||
?.read<
|
|
||||||
ReferencesBloc>()
|
|
||||||
.add(
|
|
||||||
CallErrorState());
|
|
||||||
}
|
|
||||||
selectedBarangay =
|
|
||||||
barangays![0];
|
|
||||||
setState(() {
|
|
||||||
barangayCall = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Municipality*",
|
|
||||||
"Municipality"),
|
|
||||||
value: selectedMunicipality,
|
|
||||||
items: citymuns == null
|
|
||||||
? []
|
|
||||||
: citymuns!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
CityMunicipality>>(
|
|
||||||
(CityMunicipality
|
|
||||||
c) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: c,
|
|
||||||
child: Text(c
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
//// BARANGAY
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: barangayCall,
|
|
||||||
child:
|
|
||||||
DropdownButtonFormField<
|
|
||||||
Barangay>(
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged:
|
|
||||||
(Barangay? baragay) {
|
|
||||||
selectedBarangay =
|
|
||||||
baragay;
|
|
||||||
},
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Barangay*",
|
|
||||||
"Barangay"),
|
|
||||||
value: selectedBarangay,
|
|
||||||
items: barangays == null
|
|
||||||
? []
|
|
||||||
: barangays!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Barangay>>(
|
|
||||||
(Barangay
|
|
||||||
barangay) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: barangay,
|
|
||||||
child: Text(barangay
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
//// COUNTRY DROPDOWN
|
|
||||||
: SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
Country>(
|
|
||||||
isExpanded: true,
|
|
||||||
value: selectedCountry?.id == 175
|
|
||||||
? null
|
|
||||||
: selectedCountry,
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
items: state.countries.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Country>>(
|
|
||||||
(Country country) {
|
|
||||||
return DropdownMenuItem<
|
|
||||||
Country>(
|
|
||||||
value: country,
|
|
||||||
child: FittedBox(
|
|
||||||
child: Text(
|
|
||||||
country.name!)));
|
|
||||||
}).toList(),
|
|
||||||
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Country*", "Country"),
|
|
||||||
//// country dropdown
|
|
||||||
onChanged: (Country? value) {
|
|
||||||
selectedCountry = value;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
);
|
//// BARANGAY
|
||||||
}),
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.white,
|
||||||
|
inAsyncCall: barangayCall,
|
||||||
|
child:
|
||||||
|
DropdownButtonFormField<
|
||||||
|
Barangay>(
|
||||||
|
validator: FormBuilderValidators
|
||||||
|
.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
isExpanded: true,
|
||||||
|
onChanged:
|
||||||
|
(Barangay? baragay) {
|
||||||
|
selectedBarangay =
|
||||||
|
baragay;
|
||||||
|
},
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Barangay*",
|
||||||
|
"Barangay"),
|
||||||
|
value: selectedBarangay,
|
||||||
|
items: barangays == null
|
||||||
|
? []
|
||||||
|
: barangays!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
Barangay>>(
|
||||||
|
(Barangay
|
||||||
|
barangay) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: barangay,
|
||||||
|
child: Text(barangay
|
||||||
|
.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
//// COUNTRY DROPDOWN
|
||||||
|
: SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
Country>(
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedCountry?.id == 175
|
||||||
|
? null
|
||||||
|
: selectedCountry,
|
||||||
|
validator: FormBuilderValidators
|
||||||
|
.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
items: state.countries.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
Country>>(
|
||||||
|
(Country country) {
|
||||||
|
return DropdownMenuItem<
|
||||||
|
Country>(
|
||||||
|
value: country,
|
||||||
|
child: FittedBox(
|
||||||
|
child: Text(
|
||||||
|
country.name!)));
|
||||||
|
}).toList(),
|
||||||
|
|
||||||
const SizedBox(
|
decoration: normalTextFieldStyle(
|
||||||
height: 20,
|
"Country*", "Country"),
|
||||||
),
|
//// country dropdown
|
||||||
],
|
onChanged: (Country? value) {
|
||||||
),
|
selectedCountry = value;
|
||||||
),
|
},
|
||||||
SizedBox(
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(height: 16,),
|
||||||
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 60,
|
height: 60,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
@ -616,8 +604,7 @@ class _EditReferenceScreenState extends State<EditReferenceScreen> {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ class ReferencesScreen extends StatelessWidget {
|
||||||
int? profileId;
|
int? profileId;
|
||||||
String? token;
|
String? token;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: context.watch<ReferencesBloc>().state is AddReferenceState
|
title: context.watch<ReferencesBloc>().state is AddReferenceState
|
||||||
? const Text("Add Personal Reference")
|
? const Text("Add Personal Reference")
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -156,6 +156,7 @@ class _EditVoluntaryWorkScreenState extends State<EditVoluntaryWorkScreen> {
|
||||||
onSuggestionTap: (position) {
|
onSuggestionTap: (position) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedPosition = position.item;
|
selectedPosition = position.item;
|
||||||
|
print(selectedPosition!.title);
|
||||||
positionFocusNode.unfocus();
|
positionFocusNode.unfocus();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -193,6 +194,8 @@ class _EditVoluntaryWorkScreenState extends State<EditVoluntaryWorkScreen> {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
SearchField(
|
SearchField(
|
||||||
|
|
||||||
|
enabled: false,
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
UpperCaseTextFormatter()
|
UpperCaseTextFormatter()
|
||||||
],
|
],
|
||||||
|
@ -222,6 +225,8 @@ class _EditVoluntaryWorkScreenState extends State<EditVoluntaryWorkScreen> {
|
||||||
searchInputDecoration:
|
searchInputDecoration:
|
||||||
normalTextFieldStyle("Agency *", "")
|
normalTextFieldStyle("Agency *", "")
|
||||||
.copyWith(
|
.copyWith(
|
||||||
|
filled: true,
|
||||||
|
fillColor: Colors.grey.shade300,
|
||||||
suffixIcon: GestureDetector(
|
suffixIcon: GestureDetector(
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Icons.arrow_drop_down,
|
Icons.arrow_drop_down,
|
||||||
|
@ -267,7 +272,10 @@ class _EditVoluntaryWorkScreenState extends State<EditVoluntaryWorkScreen> {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
title: "Add Agency")),
|
title: "Add Agency")),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text("You cannot change agency on update mode",style: Theme.of(context).textTheme.bodySmall,),
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: showAgency ? 12 : 0,
|
height: showAgency ? 12 : 0,
|
||||||
),
|
),
|
||||||
|
@ -424,15 +432,7 @@ class _EditVoluntaryWorkScreenState extends State<EditVoluntaryWorkScreen> {
|
||||||
Icons.date_range,
|
Icons.date_range,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
)),
|
)),
|
||||||
selectableDayPredicate:
|
|
||||||
(date) {
|
|
||||||
if (to != null &&
|
|
||||||
to!.microsecondsSinceEpoch <=
|
|
||||||
date.microsecondsSinceEpoch) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
from = DateTime.parse(
|
from = DateTime.parse(
|
||||||
|
@ -475,15 +475,7 @@ class _EditVoluntaryWorkScreenState extends State<EditVoluntaryWorkScreen> {
|
||||||
DateTime(1990),
|
DateTime(1990),
|
||||||
lastDate:
|
lastDate:
|
||||||
DateTime(2100),
|
DateTime(2100),
|
||||||
selectableDayPredicate:
|
|
||||||
(date) {
|
|
||||||
if (from != null &&
|
|
||||||
from!.microsecondsSinceEpoch >=
|
|
||||||
date.microsecondsSinceEpoch) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
to = DateTime.parse(
|
to = DateTime.parse(
|
||||||
|
@ -522,6 +514,7 @@ class _EditVoluntaryWorkScreenState extends State<EditVoluntaryWorkScreen> {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
|
|
|
@ -197,6 +197,7 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
////AGENCY
|
////AGENCY
|
||||||
StatefulBuilder(builder: (context, setState) {
|
StatefulBuilder(builder: (context, setState) {
|
||||||
return Column(
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SearchField(
|
SearchField(
|
||||||
inputFormatters: [UpperCaseTextFormatter()],
|
inputFormatters: [UpperCaseTextFormatter()],
|
||||||
|
@ -407,6 +408,7 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: showSalaryGradeAndSalaryStep
|
child: showSalaryGradeAndSalaryStep
|
||||||
? Column(
|
? Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
@ -481,20 +483,7 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
//// NAME OF OFFICE UNIT
|
|
||||||
FormBuilderTextField(
|
|
||||||
onChanged: (value){
|
|
||||||
sOffice = value;
|
|
||||||
},
|
|
||||||
validator: FormBuilderValidators.required(
|
|
||||||
errorText: "This field is required"),
|
|
||||||
name: 'office',
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Name of Office/Unit", "Name of Office/Unit"),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
|
@ -518,7 +507,10 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
const Text("Immediate SuperVisor"),
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text("Immediate SuperVisor",textAlign: TextAlign.start, style: Theme.of(context).textTheme.titleMedium,),
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
|
@ -557,12 +549,26 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
decoration:
|
decoration:
|
||||||
normalTextFieldStyle("Last name", "Last Name"),
|
normalTextFieldStyle("Last name", "Last Name"),
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
//// NAME OF OFFICE UNIT
|
||||||
|
FormBuilderTextField(
|
||||||
|
onChanged: (value){
|
||||||
|
sOffice = value;
|
||||||
|
},
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
name: 'office',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Name of Office/Unit", "Name of Office/Unit"),
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
StatefulBuilder(builder: (context, setState) {
|
StatefulBuilder(builder: (context, setState) {
|
||||||
return Column(
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
////CURRENTLY EMPLOYED
|
////CURRENTLY EMPLOYED
|
||||||
FormBuilderSwitch(
|
FormBuilderSwitch(
|
||||||
|
@ -690,12 +696,18 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
const SizedBox(
|
||||||
const Text("Work Experience"),
|
height: 8,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text("Work Experience",style: Theme.of(context).textTheme.titleMedium,),
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 8,
|
height: 8,
|
||||||
),
|
),
|
||||||
FormBuilderTextField(
|
FormBuilderTextField(
|
||||||
|
maxLines: 3,
|
||||||
onChanged: (value){
|
onChanged: (value){
|
||||||
accomplishment = value;
|
accomplishment = value;
|
||||||
},
|
},
|
||||||
|
@ -709,6 +721,7 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
FormBuilderTextField(
|
FormBuilderTextField(
|
||||||
|
maxLines: 3,
|
||||||
onChanged: (value){
|
onChanged: (value){
|
||||||
duties = value;
|
duties = value;
|
||||||
},
|
},
|
||||||
|
@ -733,8 +746,7 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
style:
|
style:
|
||||||
mainBtnStyle(primary, Colors.transparent, second),
|
mainBtnStyle(primary, Colors.transparent, second),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print(salaryGrade);
|
|
||||||
print(salaryGradeStep);
|
|
||||||
|
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
|
|
|
@ -48,6 +48,12 @@ class _EditWorkHistoryScreenState extends State<EditWorkHistoryScreen> {
|
||||||
String? salary;
|
String? salary;
|
||||||
String? salaryGrade;
|
String? salaryGrade;
|
||||||
String? salaryGradeStep;
|
String? salaryGradeStep;
|
||||||
|
String? accomplishments;
|
||||||
|
String? duties;
|
||||||
|
String? sFname;
|
||||||
|
String? sMname;
|
||||||
|
String? sLname;
|
||||||
|
String? sOffice;
|
||||||
//show agency category is a variable to show adding of agency category if you add agency manually
|
//show agency category is a variable to show adding of agency category if you add agency manually
|
||||||
bool showAgencyCategory = false;
|
bool showAgencyCategory = false;
|
||||||
//showSalaryGadeAndSalaryStep is a variable that will show salary
|
//showSalaryGadeAndSalaryStep is a variable that will show salary
|
||||||
|
@ -91,6 +97,12 @@ class _EditWorkHistoryScreenState extends State<EditWorkHistoryScreen> {
|
||||||
currentlyEmployed = state.workHistory.toDate == null ? true : false;
|
currentlyEmployed = state.workHistory.toDate == null ? true : false;
|
||||||
from = state.workHistory.fromDate;
|
from = state.workHistory.fromDate;
|
||||||
to = state.workHistory.toDate;
|
to = state.workHistory.toDate;
|
||||||
|
accomplishments = state.workHistory.accomplishment == null?null:state.workHistory.accomplishment!.first.accomplishment!;
|
||||||
|
duties = state.workHistory.actualDuties == null? null:state.workHistory.actualDuties!.first.description;
|
||||||
|
sFname = state.workHistory.supervisor?.firstname;
|
||||||
|
sMname = state.workHistory.supervisor?.middlename;
|
||||||
|
sLname = state.workHistory.supervisor?.lastname;
|
||||||
|
sOffice = state.workHistory.supervisor?.stationName;
|
||||||
return FormBuilder(
|
return FormBuilder(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
@ -146,10 +158,11 @@ class _EditWorkHistoryScreenState extends State<EditWorkHistoryScreen> {
|
||||||
controller: addPositionController,
|
controller: addPositionController,
|
||||||
onpressed: () {
|
onpressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
PositionTitle newAgencyPosition = PositionTitle(
|
PositionTitle newAgencyPosition =
|
||||||
id: null,
|
PositionTitle(
|
||||||
title: addPositionController.text
|
id: null,
|
||||||
.toUpperCase());
|
title: addPositionController.text
|
||||||
|
.toUpperCase());
|
||||||
state.agencyPositions
|
state.agencyPositions
|
||||||
.insert(0, newAgencyPosition);
|
.insert(0, newAgencyPosition);
|
||||||
selectedPosition = newAgencyPosition;
|
selectedPosition = newAgencyPosition;
|
||||||
|
@ -209,8 +222,10 @@ class _EditWorkHistoryScreenState extends State<EditWorkHistoryScreen> {
|
||||||
////AGENCY
|
////AGENCY
|
||||||
StatefulBuilder(builder: (context, setState) {
|
StatefulBuilder(builder: (context, setState) {
|
||||||
return Column(
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SearchField(
|
SearchField(
|
||||||
|
enabled: false,
|
||||||
inputFormatters: [UpperCaseTextFormatter()],
|
inputFormatters: [UpperCaseTextFormatter()],
|
||||||
controller: oldAgencyController,
|
controller: oldAgencyController,
|
||||||
itemHeight: 100,
|
itemHeight: 100,
|
||||||
|
@ -288,6 +303,7 @@ class _EditWorkHistoryScreenState extends State<EditWorkHistoryScreen> {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
title: "Add Agency")),
|
title: "Add Agency")),
|
||||||
|
Text("You cannot change agency on update mode",textAlign: TextAlign.start,style: Theme.of(context).textTheme.bodySmall,),
|
||||||
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: showAgencyCategory ? 12 : 0,
|
height: showAgencyCategory ? 12 : 0,
|
||||||
|
@ -476,6 +492,7 @@ class _EditWorkHistoryScreenState extends State<EditWorkHistoryScreen> {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
|
@ -494,10 +511,71 @@ class _EditWorkHistoryScreenState extends State<EditWorkHistoryScreen> {
|
||||||
normalTextFieldStyle("Monthly Salary *", "")
|
normalTextFieldStyle("Monthly Salary *", "")
|
||||||
.copyWith(prefix: const Text("₱ ")),
|
.copyWith(prefix: const Text("₱ ")),
|
||||||
),
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text("Immediate SuperVisor",style: Theme.of(context).textTheme.titleMedium,),
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
|
////IMMEDIATE SUPERVISOR
|
||||||
|
FormBuilderTextField(
|
||||||
|
initialValue: sFname,
|
||||||
|
onChanged: (value) {
|
||||||
|
sFname = value;
|
||||||
|
},
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
name: 'supervisor_firstname',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"First name", "First Name"),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
FormBuilderTextField(
|
||||||
|
initialValue: sMname,
|
||||||
|
onChanged: (value) {
|
||||||
|
sMname = value;
|
||||||
|
},
|
||||||
|
name: 'supervisor_middlename',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Middle name", "Middle Name"),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
FormBuilderTextField(
|
||||||
|
initialValue: sLname,
|
||||||
|
onChanged: (value) {
|
||||||
|
sLname = value;
|
||||||
|
},
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
name: 'supervisor_lastname',
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Last name", "Last Name"),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
//// NAME OF OFFICE UNIT
|
||||||
|
FormBuilderTextField(
|
||||||
|
initialValue:
|
||||||
|
sOffice,
|
||||||
|
onChanged: (value) {
|
||||||
|
sOffice = value;
|
||||||
|
},
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
name: 'office',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Name of Office/Unit", "Name of Office/Unit"),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
StatefulBuilder(builder: (context, setState) {
|
StatefulBuilder(builder: (context, setState) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
|
@ -640,12 +718,52 @@ class _EditWorkHistoryScreenState extends State<EditWorkHistoryScreen> {
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text("Work Experience",textAlign: TextAlign.start, style: Theme.of(context).textTheme.titleMedium,),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
FormBuilderTextField(
|
||||||
|
initialValue: accomplishments,
|
||||||
|
maxLines: 3,
|
||||||
|
onChanged: (value){
|
||||||
|
accomplishments = value;
|
||||||
|
},
|
||||||
|
name: "accomplishment",
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"List of Accomplishment and Contribution",
|
||||||
|
"",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
FormBuilderTextField(
|
||||||
|
initialValue: duties,
|
||||||
|
maxLines: 3,
|
||||||
|
onChanged: (value){
|
||||||
|
duties = value;
|
||||||
|
},
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
name: "summary",
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Summary of Actual Duties",
|
||||||
|
"",
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 25,),
|
||||||
////SUBMIT BUTTON
|
////SUBMIT BUTTON
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
|
@ -654,50 +772,55 @@ class _EditWorkHistoryScreenState extends State<EditWorkHistoryScreen> {
|
||||||
style:
|
style:
|
||||||
mainBtnStyle(primary, Colors.transparent, second),
|
mainBtnStyle(primary, Colors.transparent, second),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// if (_formKey.currentState!.saveAndValidate()) {
|
if (_formKey.currentState!.saveAndValidate()) {
|
||||||
// final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
// progress!.showWithText("Loading...");
|
progress!.showWithText("Loading...");
|
||||||
// salary = _formKey.currentState!.value['salary'];
|
salary = _formKey.currentState!.value['salary'];
|
||||||
// selectedPosition ??= state.workHistory.position;
|
selectedPosition ??= state.workHistory.position;
|
||||||
// salaryGrade =
|
salaryGrade =
|
||||||
// _formKey.currentState!.value['salary_grade'];
|
_formKey.currentState!.value['salary_grade'];
|
||||||
// salaryGradeStep =
|
salaryGradeStep =
|
||||||
// _formKey.currentState!.value['salary_step'];
|
_formKey.currentState!.value['salary_step'];
|
||||||
// selectedAgency ??= state.workHistory.agency;
|
selectedAgency ??= state.workHistory.agency;
|
||||||
|
|
||||||
// selectedStatus ??= AppoinemtStatus(
|
selectedStatus ??= AppoinemtStatus(
|
||||||
// value: state.workHistory.statusAppointment!,
|
value: state.workHistory.statusAppointment!,
|
||||||
// label: state.workHistory.statusAppointment!);
|
label: state.workHistory.statusAppointment!);
|
||||||
// WorkHistory newWorkHistory = WorkHistory(
|
WorkHistory newWorkHistory = WorkHistory(
|
||||||
// id: state.workHistory.id,
|
accomplishment: accomplishments == null?null: [Accomplishment(id: state.workHistory.accomplishment!.first.id, workExperienceId: state.workHistory.id, accomplishment: accomplishments)],
|
||||||
// position: selectedPosition,
|
actualDuties: duties == null? null: [ActualDuty(id: state.workHistory.actualDuties!.first.id, workExperienceId: state.workHistory.id, description: duties!)],
|
||||||
// agency: selectedAgency,
|
agencydepid: state.workHistory.agency!.id,
|
||||||
// fromDate: fromDateController.text.isEmpty
|
supervisor: Supervisor(agencyId: state.workHistory.agencydepid,id: state.workHistory.supervisor!.id,firstname: sFname,middlename: sMname,lastname: sLname,stationName: sOffice),
|
||||||
// ? null
|
id: state.workHistory.id,
|
||||||
// : DateTime.parse(fromDateController.text),
|
position: selectedPosition,
|
||||||
// toDate: toDateController.text.isEmpty ||
|
agency: selectedAgency,
|
||||||
// toDateController.text.toUpperCase() ==
|
fromDate: fromDateController.text.isEmpty
|
||||||
// "PRESENT" ||
|
? null
|
||||||
// toDateController.text.toLowerCase() ==
|
: DateTime.parse(fromDateController.text),
|
||||||
// 'null'
|
toDate: toDateController.text.isEmpty ||
|
||||||
// ? null
|
toDateController.text.toUpperCase() ==
|
||||||
// : DateTime.parse(toDateController.text),
|
"PRESENT" ||
|
||||||
// monthlySalary: double.parse(salary!),
|
toDateController.text.toLowerCase() ==
|
||||||
// appointmentStatus: selectedStatus!.value,
|
'null'
|
||||||
// salaryGrade: salaryGrade == null
|
? null
|
||||||
// ? null
|
: DateTime.parse(toDateController.text),
|
||||||
// : int.parse(salaryGrade!),
|
monthlysalary: double.parse(salary!),
|
||||||
// sgStep: salaryGradeStep == null
|
statusAppointment: selectedStatus!.value,
|
||||||
// ? null
|
salarygrade: salaryGrade == null
|
||||||
// : int.parse(salaryGradeStep!),
|
? null
|
||||||
// );
|
: int.parse(salaryGrade!),
|
||||||
// context.read<WorkHistoryBloc>().add(
|
sgstep: salaryGradeStep == null
|
||||||
// UpdateWorkHistory(
|
? null
|
||||||
// oldWorkHistory: state.workHistory,
|
: int.parse(salaryGradeStep!),
|
||||||
// profileId: widget.profileId.toString(),
|
);
|
||||||
// token: widget.token,
|
context.read<WorkHistoryBloc>().add(
|
||||||
// workHistory: newWorkHistory));
|
UpdateWorkHistory(
|
||||||
// }
|
|
||||||
|
isPrivate: state.workHistory.agency!.privateEntity!,
|
||||||
|
profileId: widget.profileId,
|
||||||
|
token: widget.token,
|
||||||
|
workHistory: newWorkHistory));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: const Text(submit)),
|
child: const Text(submit)),
|
||||||
),
|
),
|
||||||
|
|
|
@ -322,20 +322,20 @@ class WorkHistoryScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
if (value == 1) {
|
if (value == 1) {
|
||||||
////edit eligibilty-= = = = = = = = =>>
|
////edit eligibilty-= = = = = = = = =>>
|
||||||
final progress =
|
// final progress =
|
||||||
ProgressHUD.of(
|
// ProgressHUD.of(
|
||||||
context);
|
// context);
|
||||||
progress!.showWithText(
|
// progress!.showWithText(
|
||||||
"Loading...");
|
// "Loading...");
|
||||||
WorkHistory workHistory =
|
// WorkHistory workHistory =
|
||||||
state.workExperiences[
|
// state.workExperiences[
|
||||||
index];
|
// index];
|
||||||
context
|
// context
|
||||||
.read<
|
// .read<
|
||||||
WorkHistoryBloc>()
|
// WorkHistoryBloc>()
|
||||||
.add(ShowEditWorkHistoryForm(
|
// .add(ShowEditWorkHistoryForm(
|
||||||
workHistory:
|
// workHistory:
|
||||||
workHistory));
|
// workHistory));
|
||||||
}
|
}
|
||||||
////Attachment
|
////Attachment
|
||||||
if (value == 3) {
|
if (value == 3) {
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
|
||||||
import 'package:unit2/widgets/error_state.dart';
|
|
||||||
|
|
||||||
import '../../../utils/urls.dart';
|
|
||||||
|
|
||||||
class ImageAttachment extends StatefulWidget {
|
|
||||||
final String imgUrl;
|
|
||||||
const ImageAttachment({super.key, required this.imgUrl});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<ImageAttachment> createState() => _ImageAttachmentState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ImageAttachmentState extends State<ImageAttachment> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
bool isPDF = widget.imgUrl[widget.imgUrl.length - 1] == 'f' ? true : false;
|
|
||||||
|
|
||||||
return Scaffold(
|
|
||||||
floatingActionButton: FloatingActionButton(
|
|
||||||
onPressed: () {},
|
|
||||||
child: const Icon(Icons.file_download),
|
|
||||||
),
|
|
||||||
appBar: AppBar(
|
|
||||||
title: const Text("Attachment"),
|
|
||||||
centerTitle: true,
|
|
||||||
actions: [
|
|
||||||
IconButton(onPressed: () {}, icon: const Icon(Icons.share)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
body: isPDF
|
|
||||||
? SfPdfViewer.network(
|
|
||||||
'${Url.instance.prefixHost()}://${Url.instance.host()}${widget.imgUrl}',onDocumentLoadFailed: (details) {
|
|
||||||
Center(child: Text(details.description),);
|
|
||||||
},)
|
|
||||||
: Center(
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
progressIndicatorBuilder: (context, url, progress) {
|
|
||||||
return const SizedBox(
|
|
||||||
height: 100,
|
|
||||||
width: 100,
|
|
||||||
child: CircularProgressIndicator(color: primary,));
|
|
||||||
},
|
|
||||||
|
|
||||||
imageBuilder: (context, imageProvider) => Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
image: DecorationImage(
|
|
||||||
image: imageProvider, fit: BoxFit.fill)),
|
|
||||||
),
|
|
||||||
imageUrl:
|
|
||||||
'${Url.instance.prefixHost()}://${Url.instance.host()}${widget.imgUrl}',
|
|
||||||
width: double.infinity,
|
|
||||||
height: 220,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -68,7 +68,7 @@ class EducationService {
|
||||||
try {
|
try {
|
||||||
http.Response response = await Request.instance
|
http.Response response = await Request.instance
|
||||||
.postRequest(path: path, param: {}, body: body, headers: headers);
|
.postRequest(path: path, param: {}, body: body, headers: headers);
|
||||||
if (response.statusCode == 2011) {
|
if (response.statusCode == 201) {
|
||||||
Map data = jsonDecode(response.body);
|
Map data = jsonDecode(response.body);
|
||||||
statusResponse = data;
|
statusResponse = data;
|
||||||
} else {
|
} else {
|
||||||
|
@ -150,7 +150,7 @@ class EducationService {
|
||||||
http.Response response = await Request.instance.deleteRequest(
|
http.Response response = await Request.instance.deleteRequest(
|
||||||
path: path, headers: headers, body: body, param: params);
|
path: path, headers: headers, body: body, param: params);
|
||||||
|
|
||||||
if (response.statusCode == 2001) {
|
if (response.statusCode == 200) {
|
||||||
Map data = jsonDecode(response.body);
|
Map data = jsonDecode(response.body);
|
||||||
success = data['success'];
|
success = data['success'];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,7 +21,7 @@ class ProfileOtherInfoServices{
|
||||||
try {
|
try {
|
||||||
http.Response response = await Request.instance
|
http.Response response = await Request.instance
|
||||||
.getRequest(path: path, headers: headers, param: {});
|
.getRequest(path: path, headers: headers, param: {});
|
||||||
if (response.statusCode == 20012) {
|
if (response.statusCode == 200) {
|
||||||
Map data = jsonDecode(response.body);
|
Map data = jsonDecode(response.body);
|
||||||
if (data['data'] != null) {
|
if (data['data'] != null) {
|
||||||
data['data'].forEach((var e) {
|
data['data'].forEach((var e) {
|
||||||
|
|
|
@ -40,7 +40,6 @@ class WorkHistoryService {
|
||||||
return workExperiences;
|
return workExperiences;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////delete workhistory
|
////delete workhistory
|
||||||
Future<bool> delete(
|
Future<bool> delete(
|
||||||
{required int profileId,
|
{required int profileId,
|
||||||
|
@ -69,10 +68,10 @@ class WorkHistoryService {
|
||||||
http.Response response = await Request.instance.deleteRequest(
|
http.Response response = await Request.instance.deleteRequest(
|
||||||
path: path, headers: headers, body: body, param: params);
|
path: path, headers: headers, body: body, param: params);
|
||||||
|
|
||||||
if(response.statusCode == 200){
|
if (response.statusCode == 200) {
|
||||||
Map data = jsonDecode(response.body);
|
Map data = jsonDecode(response.body);
|
||||||
success = data['success'];
|
success = data['success'];
|
||||||
}else{
|
} else {
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -81,7 +80,6 @@ class WorkHistoryService {
|
||||||
return success!;
|
return success!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////edit work history
|
////edit work history
|
||||||
// Future<Map<dynamic,dynamic>> update({required WorkHistory oldWorkHistory, required WorkHistory newWorkHistory, required String token, required String profileId})async{
|
// Future<Map<dynamic,dynamic>> update({required WorkHistory oldWorkHistory, required WorkHistory newWorkHistory, required String token, required String profileId})async{
|
||||||
// Map<dynamic, dynamic>? statusResponse={};
|
// Map<dynamic, dynamic>? statusResponse={};
|
||||||
|
@ -108,8 +106,7 @@ class WorkHistoryService {
|
||||||
// "oldPosId":oldWorkHistory.position!.id,
|
// "oldPosId":oldWorkHistory.position!.id,
|
||||||
// "_oldAgencyId":oldWorkHistory.agency!.id,
|
// "_oldAgencyId":oldWorkHistory.agency!.id,
|
||||||
// "oldFromDate":oldWorkHistory.fromDate?.toString(),
|
// "oldFromDate":oldWorkHistory.fromDate?.toString(),
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
|
||||||
// try{
|
// try{
|
||||||
// http.Response response = await Request.instance.putRequest(path: path, headers: headers, body: body, param: {});
|
// http.Response response = await Request.instance.putRequest(path: path, headers: headers, body: body, param: {});
|
||||||
|
@ -125,74 +122,129 @@ class WorkHistoryService {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////Add work history
|
////Add work history
|
||||||
Future<Map<dynamic, dynamic>>add({required WorkHistory workHistory, required String token, required int profileId , required bool isPrivate,required String? accomplishment, required String? actualDuties})async{
|
Future<Map<dynamic, dynamic>> add(
|
||||||
String authtoken = "Token $token";
|
{required WorkHistory workHistory,
|
||||||
|
required String token,
|
||||||
|
required int profileId,
|
||||||
|
required bool isPrivate,
|
||||||
|
required String? accomplishment,
|
||||||
|
required String? actualDuties}) async {
|
||||||
|
String authtoken = "Token $token";
|
||||||
String path = '${Url.instance.workhistory()}$profileId/';
|
String path = '${Url.instance.workhistory()}$profileId/';
|
||||||
Map<String, String> headers = {
|
Map<String, String> headers = {
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
'Authorization': authtoken
|
'Authorization': authtoken
|
||||||
};
|
};
|
||||||
Map<String,String> body = {};
|
Map<String, String> body = {};
|
||||||
Map<dynamic,dynamic> statusResponse = {};
|
Map<dynamic, dynamic> statusResponse = {};
|
||||||
String fromDate = DateFormat('yyyy-MM-dd').format(workHistory.fromDate!);
|
String fromDate = DateFormat('yyyy-MM-dd').format(workHistory.fromDate!);
|
||||||
String? toDate;
|
String? toDate = workHistory.toDate == null
|
||||||
if(workHistory.toDate != null){
|
? null
|
||||||
toDate = DateFormat('yyyy-MM-dd').format(workHistory.toDate!);
|
: DateFormat('yyyy-MM-dd').format(workHistory.toDate!);
|
||||||
}
|
|
||||||
if(workHistory.toDate == null){
|
if (workHistory.toDate == null) {
|
||||||
body = {
|
body = {
|
||||||
"a_category_id ": workHistory.agency?.category?.id == null? "":workHistory.agency!.category!.id.toString(),
|
"a_category_id ": workHistory.agency?.category?.id == null
|
||||||
"a_name" : workHistory.agency?.name == null? "":workHistory.agency!.name!,
|
? ""
|
||||||
" a_private_entity ": workHistory.agency?.privateEntity == null?"":workHistory.agency!.privateEntity.toString(),
|
: workHistory.agency!.category!.id.toString(),
|
||||||
"accomplishment" : accomplishment??"",
|
"a_name":
|
||||||
"actual_duties ": actualDuties!,
|
workHistory.agency?.name == null ? "" : workHistory.agency!.name!,
|
||||||
"agency_id" : workHistory.agency?.id == null?"": workHistory.agency!.id.toString() ,
|
" a_private_entity ": workHistory.agency?.privateEntity == null
|
||||||
"from_date" : fromDate,
|
? ""
|
||||||
"monthly_salary" : workHistory.monthlysalary == null? "": workHistory.monthlysalary.toString(),
|
: workHistory.agency!.privateEntity.toString(),
|
||||||
"position_id" : workHistory.position?.id == null? "": workHistory.position!.id.toString(),
|
"accomplishment": accomplishment ?? "",
|
||||||
"position_name" : workHistory.position?.title == null? "":workHistory.position!.title!,
|
"actual_duties ": actualDuties!,
|
||||||
"s_fname" : workHistory.supervisor?.firstname == null?"":workHistory.supervisor!.firstname!,
|
"agency_id": workHistory.agency?.id == null
|
||||||
"s_lname" : workHistory.supervisor?.lastname == null? "":workHistory.supervisor!.lastname!,
|
? ""
|
||||||
"s_mname" : workHistory.supervisor?.middlename == null?"":workHistory.supervisor!.middlename!,
|
: workHistory.agency!.id.toString(),
|
||||||
"s_office" : workHistory.supervisor?.stationName == null?"":workHistory.supervisor!.stationName!,
|
"from_date": fromDate,
|
||||||
"salary_grade" : workHistory.salarygrade == null? "":workHistory.salarygrade.toString(),
|
"monthly_salary": workHistory.monthlysalary == null
|
||||||
"sg_step" : workHistory.sgstep == null?"":workHistory.sgstep.toString() ,
|
? ""
|
||||||
'status_appointment' : workHistory.statusAppointment??"",
|
: workHistory.monthlysalary.toString(),
|
||||||
};
|
"position_id": workHistory.position?.id == null
|
||||||
}else{
|
? ""
|
||||||
body = {
|
: workHistory.position!.id.toString(),
|
||||||
"a_category_id ": workHistory.agency?.category?.id == null? "":workHistory.agency!.category!.id.toString(),
|
"position_name": workHistory.position?.title == null
|
||||||
"a_name" : workHistory.agency?.name == null? "":workHistory.agency!.name!,
|
? ""
|
||||||
" a_private_entity ": workHistory.agency?.privateEntity == null?"":workHistory.agency!.privateEntity.toString(),
|
: workHistory.position!.title!,
|
||||||
"accomplishment" : accomplishment??"",
|
"s_fname": workHistory.supervisor?.firstname == null
|
||||||
"actual_duties ": actualDuties!,
|
? ""
|
||||||
"agency_id" : workHistory.agency?.id == null?"": workHistory.agency!.id.toString() ,
|
: workHistory.supervisor!.firstname!,
|
||||||
"from_date" : workHistory.fromDate == null? "2018-10-04":"2018-06-04",
|
"s_lname": workHistory.supervisor?.lastname == null
|
||||||
"monthly_salary" : workHistory.monthlysalary == null? "": workHistory.monthlysalary.toString(),
|
? ""
|
||||||
"position_id" : workHistory.position?.id == null? "": workHistory.position!.id.toString(),
|
: workHistory.supervisor!.lastname!,
|
||||||
"position_name" : workHistory.position?.title == null? "":workHistory.position!.title!,
|
"s_mname": workHistory.supervisor?.middlename == null
|
||||||
"s_fname" : workHistory.supervisor?.firstname == null?"":workHistory.supervisor!.firstname!,
|
? ""
|
||||||
"s_lname" : workHistory.supervisor?.lastname == null? "":workHistory.supervisor!.lastname!,
|
: workHistory.supervisor!.middlename!,
|
||||||
"s_mname" : workHistory.supervisor?.middlename == null?"":workHistory.supervisor!.middlename!,
|
"s_office": workHistory.supervisor?.stationName == null
|
||||||
"s_office" : workHistory.supervisor?.stationName == null?"":workHistory.supervisor!.stationName!,
|
? ""
|
||||||
"salary_grade" : workHistory.salarygrade == null? "":workHistory.salarygrade.toString(),
|
: workHistory.supervisor!.stationName!,
|
||||||
"sg_step" : workHistory.sgstep == null?"":workHistory.sgstep.toString() ,
|
"salary_grade": workHistory.salarygrade == null
|
||||||
'status_appointment' : workHistory.statusAppointment??"",
|
? ""
|
||||||
"to_date" : toDate!,
|
: workHistory.salarygrade.toString(),
|
||||||
};
|
"sg_step":
|
||||||
|
workHistory.sgstep == null ? "" : workHistory.sgstep.toString(),
|
||||||
|
'status_appointment': workHistory.statusAppointment ?? "",
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
body = {
|
||||||
|
"a_category_id ": workHistory.agency?.category?.id == null
|
||||||
|
? ""
|
||||||
|
: workHistory.agency!.category!.id.toString(),
|
||||||
|
"a_name":
|
||||||
|
workHistory.agency?.name == null ? "" : workHistory.agency!.name!,
|
||||||
|
" a_private_entity ": workHistory.agency?.privateEntity == null
|
||||||
|
? ""
|
||||||
|
: workHistory.agency!.privateEntity.toString(),
|
||||||
|
"accomplishment": accomplishment ?? "",
|
||||||
|
"actual_duties ": actualDuties!,
|
||||||
|
"agency_id": workHistory.agency?.id == null
|
||||||
|
? ""
|
||||||
|
: workHistory.agency!.id.toString(),
|
||||||
|
"from_date": fromDate,
|
||||||
|
"monthly_salary": workHistory.monthlysalary == null
|
||||||
|
? ""
|
||||||
|
: workHistory.monthlysalary.toString(),
|
||||||
|
"position_id": workHistory.position?.id == null
|
||||||
|
? ""
|
||||||
|
: workHistory.position!.id.toString(),
|
||||||
|
"position_name": workHistory.position?.title == null
|
||||||
|
? ""
|
||||||
|
: workHistory.position!.title!,
|
||||||
|
"s_fname": workHistory.supervisor?.firstname == null
|
||||||
|
? ""
|
||||||
|
: workHistory.supervisor!.firstname!,
|
||||||
|
"s_lname": workHistory.supervisor?.lastname == null
|
||||||
|
? ""
|
||||||
|
: workHistory.supervisor!.lastname!,
|
||||||
|
"s_mname": workHistory.supervisor?.middlename == null
|
||||||
|
? ""
|
||||||
|
: workHistory.supervisor!.middlename!,
|
||||||
|
"s_office": workHistory.supervisor?.stationName == null
|
||||||
|
? ""
|
||||||
|
: workHistory.supervisor!.stationName!,
|
||||||
|
"salary_grade": workHistory.salarygrade == null
|
||||||
|
? ""
|
||||||
|
: workHistory.salarygrade.toString(),
|
||||||
|
"sg_step":
|
||||||
|
workHistory.sgstep == null ? "" : workHistory.sgstep.toString(),
|
||||||
|
'status_appointment': workHistory.statusAppointment ?? "",
|
||||||
|
"to_date": toDate!,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var request = http.MultipartRequest('POST',Uri.parse('${Url.instance.prefixHost()}://${Url.instance.host()}$path'));
|
var request = http.MultipartRequest(
|
||||||
request.fields.addAll(body);
|
'POST',
|
||||||
request.headers.addAll(headers);
|
Uri.parse(
|
||||||
|
'${Url.instance.prefixHost()}://${Url.instance.host()}$path'));
|
||||||
|
request.fields.addAll(body);
|
||||||
|
request.headers.addAll(headers);
|
||||||
try {
|
try {
|
||||||
http.StreamedResponse response = await request.send();
|
http.StreamedResponse response = await request.send();
|
||||||
final steamResponse = await response.stream.bytesToString();
|
final steamResponse = await response.stream.bytesToString();
|
||||||
Map data = jsonDecode(steamResponse);
|
Map data = jsonDecode(steamResponse);
|
||||||
if (response.statusCode == 201) {
|
if (response.statusCode == 201) {
|
||||||
statusResponse = data;
|
statusResponse = data;
|
||||||
} else {
|
} else {
|
||||||
String message = data['response']['details'];
|
String message = data['response']['details'];
|
||||||
|
@ -204,91 +256,151 @@ class WorkHistoryService {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw e.toString();
|
throw e.toString();
|
||||||
}
|
}
|
||||||
return statusResponse;
|
return statusResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<dynamic, dynamic>>update({required WorkHistory workHistory, required String token, required int profileId , required bool isPrivate,required String? accomplishment, required String? actualDuties})async{
|
Future<Map<dynamic, dynamic>> update(
|
||||||
String authtoken = "Token $token";
|
{required WorkHistory workHistory,
|
||||||
|
required String token,
|
||||||
|
required int profileId,
|
||||||
|
required bool isPrivate}) async {
|
||||||
|
String authtoken = "Token $token";
|
||||||
String path = '${Url.instance.workhistory()}$profileId/';
|
String path = '${Url.instance.workhistory()}$profileId/';
|
||||||
Map<String, String> headers = {
|
Map<String, String> headers = {
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
'Authorization': authtoken
|
'Authorization': authtoken
|
||||||
};
|
};
|
||||||
Map<String,String> body = {};
|
|
||||||
Map<dynamic,dynamic> statusResponse = {};
|
Map<String, String> body = {};
|
||||||
String fromDate = DateFormat('yyyy-MM-dd').format(workHistory.fromDate!);
|
Map<dynamic, dynamic> statusResponse = {};
|
||||||
String? toDate;
|
String fromDate = DateFormat('yyyy-MM-dd').format(workHistory.fromDate!);
|
||||||
if(workHistory.toDate != null){
|
String? toDate = workHistory.toDate == null
|
||||||
toDate = DateFormat('yyyy-MM-dd').format(workHistory.toDate!);
|
? null
|
||||||
}
|
: DateFormat('yyyy-MM-dd').format(workHistory.toDate!);
|
||||||
if(workHistory.toDate == null){
|
if (workHistory.toDate == null) {
|
||||||
body = {
|
body = {
|
||||||
"a_category_id ": workHistory.agency?.category?.id == null? "":workHistory.agency!.category!.id.toString(),
|
"a_category_id ": workHistory.agency?.category?.id == null
|
||||||
"a_name" : workHistory.agency?.name == null? "":workHistory.agency!.name!,
|
? ""
|
||||||
" a_private_entity ": workHistory.agency?.privateEntity == null?"":workHistory.agency!.privateEntity.toString(),
|
: workHistory.agency!.category!.id.toString(),
|
||||||
"accomplishment" : accomplishment??"",
|
"a_name":
|
||||||
"actual_duties ": actualDuties!,
|
workHistory.agency?.name == null ? "" : workHistory.agency!.name!,
|
||||||
"agency_id" : workHistory.agency?.id == null?"": workHistory.agency!.id.toString() ,
|
" a_private_entity ": workHistory.agency?.privateEntity == null
|
||||||
"from_date" : fromDate,
|
? ""
|
||||||
"monthly_salary" : workHistory.monthlysalary == null? "": workHistory.monthlysalary.toString(),
|
: workHistory.agency!.privateEntity.toString(),
|
||||||
"position_id" : workHistory.position?.id == null? "": workHistory.position!.id.toString(),
|
"accomplishment": workHistory.accomplishment == null
|
||||||
"position_name" : workHistory.position?.title == null? "":workHistory.position!.title!,
|
? ""
|
||||||
"s_fname" : workHistory.supervisor?.firstname == null?"":workHistory.supervisor!.firstname!,
|
: workHistory.accomplishment!.first.accomplishment!,
|
||||||
"s_lname" : workHistory.supervisor?.lastname == null? "":workHistory.supervisor!.lastname!,
|
"actual_duties ": workHistory.actualDuties == null
|
||||||
"s_mname" : workHistory.supervisor?.middlename == null?"":workHistory.supervisor!.middlename!,
|
? ""
|
||||||
"s_office" : workHistory.supervisor?.stationName == null?"":workHistory.supervisor!.stationName!,
|
: workHistory.actualDuties!.first.description,
|
||||||
"salary_grade" : workHistory.salarygrade == null? "":workHistory.salarygrade.toString(),
|
"agency_id": workHistory.agency?.id == null
|
||||||
"sg_step" : workHistory.sgstep == null?"":workHistory.sgstep.toString() ,
|
? ""
|
||||||
'status_appointment' : workHistory.statusAppointment??"",
|
: workHistory.agency!.id.toString(),
|
||||||
};
|
"from_date": fromDate,
|
||||||
}else{
|
"monthly_salary": workHistory.monthlysalary == null
|
||||||
body = {
|
? ""
|
||||||
"a_category_id ": workHistory.agency?.category?.id == null? "":workHistory.agency!.category!.id.toString(),
|
: workHistory.monthlysalary.toString(),
|
||||||
"a_name" : workHistory.agency?.name == null? "":workHistory.agency!.name!,
|
"position_id": workHistory.position?.id == null
|
||||||
" a_private_entity ": workHistory.agency?.privateEntity == null?"":workHistory.agency!.privateEntity.toString(),
|
? ""
|
||||||
"accomplishment" : accomplishment??"",
|
: workHistory.position!.id.toString(),
|
||||||
"actual_duties ": actualDuties!,
|
"position_name": workHistory.position?.title == null
|
||||||
"agency_id" : workHistory.agency?.id == null?"": workHistory.agency!.id.toString() ,
|
? ""
|
||||||
"from_date" : workHistory.fromDate == null? "2018-10-04":"2018-06-04",
|
: workHistory.position!.title!,
|
||||||
"monthly_salary" : workHistory.monthlysalary == null? "": workHistory.monthlysalary.toString(),
|
"s_fname": workHistory.supervisor?.firstname == null
|
||||||
"position_id" : workHistory.position?.id == null? "": workHistory.position!.id.toString(),
|
? ""
|
||||||
"position_name" : workHistory.position?.title == null? "":workHistory.position!.title!,
|
: workHistory.supervisor!.firstname!,
|
||||||
"s_fname" : workHistory.supervisor?.firstname == null?"":workHistory.supervisor!.firstname!,
|
"s_lname": workHistory.supervisor?.lastname == null
|
||||||
"s_lname" : workHistory.supervisor?.lastname == null? "":workHistory.supervisor!.lastname!,
|
? ""
|
||||||
"s_mname" : workHistory.supervisor?.middlename == null?"":workHistory.supervisor!.middlename!,
|
: workHistory.supervisor!.lastname!,
|
||||||
"s_office" : workHistory.supervisor?.stationName == null?"":workHistory.supervisor!.stationName!,
|
"s_mname": workHistory.supervisor?.middlename == null
|
||||||
"salary_grade" : workHistory.salarygrade == null? "":workHistory.salarygrade.toString(),
|
? ""
|
||||||
"sg_step" : workHistory.sgstep == null?"":workHistory.sgstep.toString() ,
|
: workHistory.supervisor!.middlename!,
|
||||||
'status_appointment' : workHistory.statusAppointment??"",
|
"s_office": workHistory.supervisor?.stationName == null
|
||||||
"to_date" : toDate!,
|
? ""
|
||||||
};
|
: workHistory.supervisor!.stationName!,
|
||||||
|
"salary_grade": workHistory.salarygrade == null
|
||||||
|
? ""
|
||||||
|
: workHistory.salarygrade.toString(),
|
||||||
|
"sg_step":
|
||||||
|
workHistory.sgstep == null ? "" : workHistory.sgstep.toString(),
|
||||||
|
'status_appointment': workHistory.statusAppointment ?? "",
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
body = {
|
||||||
|
"a_category_id ": workHistory.agency?.category?.id == null
|
||||||
|
? ""
|
||||||
|
: workHistory.agency!.category!.id.toString(),
|
||||||
|
"a_name":
|
||||||
|
workHistory.agency?.name == null ? "" : workHistory.agency!.name!,
|
||||||
|
" a_private_entity ": workHistory.agency?.privateEntity == null
|
||||||
|
? ""
|
||||||
|
: workHistory.agency!.privateEntity.toString(),
|
||||||
|
"accomplishment": workHistory.accomplishment == null
|
||||||
|
? ""
|
||||||
|
: workHistory.accomplishment!.first.accomplishment!,
|
||||||
|
"actual_duties ": workHistory.actualDuties == null
|
||||||
|
? ""
|
||||||
|
: workHistory.actualDuties!.first.description,
|
||||||
|
"agency_id": workHistory.agency?.id == null
|
||||||
|
? ""
|
||||||
|
: workHistory.agency!.id.toString(),
|
||||||
|
"from_date": fromDate,
|
||||||
|
"monthly_salary": workHistory.monthlysalary == null
|
||||||
|
? ""
|
||||||
|
: workHistory.monthlysalary.toString(),
|
||||||
|
"position_id": workHistory.position?.id == null
|
||||||
|
? ""
|
||||||
|
: workHistory.position!.id.toString(),
|
||||||
|
"position_name": workHistory.position?.title == null
|
||||||
|
? ""
|
||||||
|
: workHistory.position!.title!,
|
||||||
|
"s_fname": workHistory.supervisor?.firstname == null
|
||||||
|
? ""
|
||||||
|
: workHistory.supervisor!.firstname!,
|
||||||
|
"s_lname": workHistory.supervisor?.lastname == null
|
||||||
|
? ""
|
||||||
|
: workHistory.supervisor!.lastname!,
|
||||||
|
"s_mname": workHistory.supervisor?.middlename == null
|
||||||
|
? ""
|
||||||
|
: workHistory.supervisor!.middlename!,
|
||||||
|
"s_office": workHistory.supervisor?.stationName == null
|
||||||
|
? ""
|
||||||
|
: workHistory.supervisor!.stationName!,
|
||||||
|
"salary_grade": workHistory.salarygrade == null
|
||||||
|
? ""
|
||||||
|
: workHistory.salarygrade.toString(),
|
||||||
|
"sg_step":
|
||||||
|
workHistory.sgstep == null ? "" : workHistory.sgstep.toString(),
|
||||||
|
'status_appointment': workHistory.statusAppointment ?? "",
|
||||||
|
"to_date": toDate!,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var request = http.MultipartRequest('PUT',Uri.parse('${Url.instance.prefixHost()}://${Url.instance.host()}$path'));
|
var request = http.MultipartRequest(
|
||||||
request.fields.addAll(body);
|
'PUT',
|
||||||
request.headers.addAll(headers);
|
Uri.parse(
|
||||||
try {
|
'${Url.instance.prefixHost()}://${Url.instance.host()}$path'));
|
||||||
http.StreamedResponse response = await request.send();
|
request.fields.addAll(body);
|
||||||
final steamResponse = await response.stream.bytesToString();
|
request.headers.addAll(headers);
|
||||||
Map data = jsonDecode(steamResponse);
|
// try {
|
||||||
if (response.statusCode == 201) {
|
http.StreamedResponse response = await request.send();
|
||||||
statusResponse = data;
|
final steamResponse = await response.stream.bytesToString();
|
||||||
} else {
|
Map data = jsonDecode(steamResponse);
|
||||||
String message = data['response']['details'];
|
if (response.statusCode == 201) {
|
||||||
statusResponse.addAll({'message': message});
|
statusResponse = data;
|
||||||
statusResponse.addAll(
|
} else {
|
||||||
{'success': false},
|
String message = data['response']['details'];
|
||||||
);
|
statusResponse.addAll({'message': message});
|
||||||
}
|
statusResponse.addAll(
|
||||||
} catch (e) {
|
{'success': false},
|
||||||
throw e.toString();
|
);
|
||||||
}
|
}
|
||||||
return statusResponse;
|
// } catch (e) {
|
||||||
|
// throw e.toString();
|
||||||
|
// }
|
||||||
|
return statusResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////get agency position
|
////get agency position
|
||||||
Future<List<PositionTitle>> getAgencyPosition() async {
|
Future<List<PositionTitle>> getAgencyPosition() async {
|
||||||
List<PositionTitle> agencyPositions = [];
|
List<PositionTitle> agencyPositions = [];
|
||||||
|
@ -324,7 +436,7 @@ return statusResponse;
|
||||||
AppoinemtStatus(value: "Coterminous", label: "Coterminous"),
|
AppoinemtStatus(value: "Coterminous", label: "Coterminous"),
|
||||||
AppoinemtStatus(value: "Elected", label: "Elected"),
|
AppoinemtStatus(value: "Elected", label: "Elected"),
|
||||||
AppoinemtStatus(value: "Job Order", label: "Job Order"),
|
AppoinemtStatus(value: "Job Order", label: "Job Order"),
|
||||||
AppoinemtStatus(value: "Permanent", label: "Permanent"),
|
AppoinemtStatus(value: "Permanent", label: "Permanent"),
|
||||||
AppoinemtStatus(value: "Elected", label: "Elected"),
|
AppoinemtStatus(value: "Elected", label: "Elected"),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart';
|
||||||
|
|
||||||
|
Future<void> launchInBrowser(String url) async {
|
||||||
|
final UrlLauncherPlatform launcher = UrlLauncherPlatform.instance;
|
||||||
|
if (!await launcher.launch(
|
||||||
|
url,
|
||||||
|
useSafariVC: false,
|
||||||
|
useWebView: false,
|
||||||
|
enableJavaScript: false,
|
||||||
|
enableDomStorage: false,
|
||||||
|
universalLinksOnly: false,
|
||||||
|
headers: <String, String>{},
|
||||||
|
)) {
|
||||||
|
throw Exception('Could not launch $url');
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,8 @@ PODS:
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- audioplayers_darwin (0.0.1):
|
- audioplayers_darwin (0.0.1):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
|
- device_info_plus (0.0.1):
|
||||||
|
- FlutterMacOS
|
||||||
- FlutterMacOS (1.0.0)
|
- FlutterMacOS (1.0.0)
|
||||||
- FMDB (2.7.5):
|
- FMDB (2.7.5):
|
||||||
- FMDB/standard (= 2.7.5)
|
- FMDB/standard (= 2.7.5)
|
||||||
|
@ -24,17 +26,24 @@ PODS:
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- rive_common (0.0.1):
|
- rive_common (0.0.1):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
|
- share_plus (0.0.1):
|
||||||
|
- FlutterMacOS
|
||||||
- shared_preferences_foundation (0.0.1):
|
- shared_preferences_foundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- sqflite (0.0.2):
|
- sqflite (0.0.2):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- FMDB (>= 2.7.5)
|
- FMDB (>= 2.7.5)
|
||||||
|
- syncfusion_pdfviewer_macos (0.0.1):
|
||||||
|
- FlutterMacOS
|
||||||
|
- url_launcher_macos (0.0.1):
|
||||||
|
- FlutterMacOS
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- assets_audio_player (from `Flutter/ephemeral/.symlinks/plugins/assets_audio_player/macos`)
|
- assets_audio_player (from `Flutter/ephemeral/.symlinks/plugins/assets_audio_player/macos`)
|
||||||
- assets_audio_player_web (from `Flutter/ephemeral/.symlinks/plugins/assets_audio_player_web/macos`)
|
- assets_audio_player_web (from `Flutter/ephemeral/.symlinks/plugins/assets_audio_player_web/macos`)
|
||||||
- audioplayers_darwin (from `Flutter/ephemeral/.symlinks/plugins/audioplayers_darwin/macos`)
|
- audioplayers_darwin (from `Flutter/ephemeral/.symlinks/plugins/audioplayers_darwin/macos`)
|
||||||
|
- device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`)
|
||||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||||
- location (from `Flutter/ephemeral/.symlinks/plugins/location/macos`)
|
- location (from `Flutter/ephemeral/.symlinks/plugins/location/macos`)
|
||||||
- modal_progress_hud_nsn (from `Flutter/ephemeral/.symlinks/plugins/modal_progress_hud_nsn/macos`)
|
- modal_progress_hud_nsn (from `Flutter/ephemeral/.symlinks/plugins/modal_progress_hud_nsn/macos`)
|
||||||
|
@ -43,8 +52,11 @@ DEPENDENCIES:
|
||||||
- platform_device_id (from `Flutter/ephemeral/.symlinks/plugins/platform_device_id/macos`)
|
- platform_device_id (from `Flutter/ephemeral/.symlinks/plugins/platform_device_id/macos`)
|
||||||
- platform_device_id_macos (from `Flutter/ephemeral/.symlinks/plugins/platform_device_id_macos/macos`)
|
- platform_device_id_macos (from `Flutter/ephemeral/.symlinks/plugins/platform_device_id_macos/macos`)
|
||||||
- rive_common (from `Flutter/ephemeral/.symlinks/plugins/rive_common/macos`)
|
- rive_common (from `Flutter/ephemeral/.symlinks/plugins/rive_common/macos`)
|
||||||
|
- share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
|
||||||
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/macos`)
|
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/macos`)
|
||||||
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`)
|
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`)
|
||||||
|
- syncfusion_pdfviewer_macos (from `Flutter/ephemeral/.symlinks/plugins/syncfusion_pdfviewer_macos/macos`)
|
||||||
|
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
trunk:
|
trunk:
|
||||||
|
@ -57,6 +69,8 @@ EXTERNAL SOURCES:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/assets_audio_player_web/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/assets_audio_player_web/macos
|
||||||
audioplayers_darwin:
|
audioplayers_darwin:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/audioplayers_darwin/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/audioplayers_darwin/macos
|
||||||
|
device_info_plus:
|
||||||
|
:path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos
|
||||||
FlutterMacOS:
|
FlutterMacOS:
|
||||||
:path: Flutter/ephemeral
|
:path: Flutter/ephemeral
|
||||||
location:
|
location:
|
||||||
|
@ -73,15 +87,22 @@ EXTERNAL SOURCES:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/platform_device_id_macos/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/platform_device_id_macos/macos
|
||||||
rive_common:
|
rive_common:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/rive_common/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/rive_common/macos
|
||||||
|
share_plus:
|
||||||
|
:path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos
|
||||||
shared_preferences_foundation:
|
shared_preferences_foundation:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/macos
|
||||||
sqflite:
|
sqflite:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos
|
||||||
|
syncfusion_pdfviewer_macos:
|
||||||
|
:path: Flutter/ephemeral/.symlinks/plugins/syncfusion_pdfviewer_macos/macos
|
||||||
|
url_launcher_macos:
|
||||||
|
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
assets_audio_player: be2578e6f11dd4d183412e97143673c3c4cb2e8a
|
assets_audio_player: be2578e6f11dd4d183412e97143673c3c4cb2e8a
|
||||||
assets_audio_player_web: 917101123b6db8f73156835c0fa266c11340ff15
|
assets_audio_player_web: 917101123b6db8f73156835c0fa266c11340ff15
|
||||||
audioplayers_darwin: dcad41de4fbd0099cb3749f7ab3b0cb8f70b810c
|
audioplayers_darwin: dcad41de4fbd0099cb3749f7ab3b0cb8f70b810c
|
||||||
|
device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f
|
||||||
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
|
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
|
||||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||||
location: 7cdb0665bd6577d382b0a343acdadbcb7f964775
|
location: 7cdb0665bd6577d382b0a343acdadbcb7f964775
|
||||||
|
@ -91,8 +112,11 @@ SPEC CHECKSUMS:
|
||||||
platform_device_id: 3e414428f45df149bbbfb623e2c0ca27c545b763
|
platform_device_id: 3e414428f45df149bbbfb623e2c0ca27c545b763
|
||||||
platform_device_id_macos: f763bb55f088be804d61b96eb4710b8ab6598e94
|
platform_device_id_macos: f763bb55f088be804d61b96eb4710b8ab6598e94
|
||||||
rive_common: fab8476ce8352bf54152a913f393a8696d3dc98c
|
rive_common: fab8476ce8352bf54152a913f393a8696d3dc98c
|
||||||
|
share_plus: 76dd39142738f7a68dd57b05093b5e8193f220f7
|
||||||
shared_preferences_foundation: e2dae3258e06f44cc55f49d42024fd8dd03c590c
|
shared_preferences_foundation: e2dae3258e06f44cc55f49d42024fd8dd03c590c
|
||||||
sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea
|
sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea
|
||||||
|
syncfusion_pdfviewer_macos: e9194851581cad04b28b53913d0636d39a4ed4b2
|
||||||
|
url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95
|
||||||
|
|
||||||
PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7
|
PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue