primary information and contact information api integration

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
PGAN-MIS 2023-02-01 16:03:05 +08:00
parent 8d71591e5e
commit 25d3d1b3cd
41 changed files with 1524 additions and 322 deletions

View File

@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"

View File

@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"

41
ios/Podfile 100644
View File

@ -0,0 +1,41 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end

87
ios/Podfile.lock 100644
View File

@ -0,0 +1,87 @@
PODS:
- barcode_scan2 (0.0.1):
- Flutter
- MTBBarcodeScanner
- SwiftProtobuf
- easy_app_installer (0.0.1):
- Flutter
- Flutter (1.0.0)
- fluttertoast (0.0.2):
- Flutter
- Toast
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- MTBBarcodeScanner (5.0.11)
- package_info_plus (0.4.5):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- permission_handler_apple (9.0.4):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.2):
- Flutter
- FMDB (>= 2.7.5)
- SwiftProtobuf (1.20.3)
- Toast (4.0.0)
DEPENDENCIES:
- barcode_scan2 (from `.symlinks/plugins/barcode_scan2/ios`)
- easy_app_installer (from `.symlinks/plugins/easy_app_installer/ios`)
- Flutter (from `Flutter`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
SPEC REPOS:
trunk:
- FMDB
- MTBBarcodeScanner
- SwiftProtobuf
- Toast
EXTERNAL SOURCES:
barcode_scan2:
:path: ".symlinks/plugins/barcode_scan2/ios"
easy_app_installer:
:path: ".symlinks/plugins/easy_app_installer/ios"
Flutter:
:path: Flutter
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/ios"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
SPEC CHECKSUMS:
barcode_scan2: 0af2bb63c81b4565aab6cd78278e4c0fa136dbb0
easy_app_installer: 29abe397da7d86721fee853281202f414373f45c
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
fluttertoast: eb263d302cc92e04176c053d2385237e9f43fad0
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
SwiftProtobuf: b02b5075dcf60c9f5f403000b3b0c202a11b6ae1
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
COCOAPODS: 1.11.3

View File

@ -3,11 +3,12 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 50; objectVersion = 54;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
28FEB91C01FFFF1F3AF03958 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2946B4F99A9B9A85D9A4DC4F /* Pods_Runner.framework */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
@ -31,7 +32,11 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
24CA4A0209E683A311335098 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
2946B4F99A9B9A85D9A4DC4F /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
74181747FCF55E0339265087 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
7435055C04EA907D4DF9DEFB /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
@ -49,12 +54,24 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
28FEB91C01FFFF1F3AF03958 /* Pods_Runner.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
53E3B75A4BA5D03DDDC74903 /* Pods */ = {
isa = PBXGroup;
children = (
74181747FCF55E0339265087 /* Pods-Runner.debug.xcconfig */,
7435055C04EA907D4DF9DEFB /* Pods-Runner.release.xcconfig */,
24CA4A0209E683A311335098 /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = { 9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -72,6 +89,8 @@
9740EEB11CF90186004384FC /* Flutter */, 9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */, 97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */, 97C146EF1CF9000F007C117D /* Products */,
53E3B75A4BA5D03DDDC74903 /* Pods */,
B81885F5B040F93E6F30E902 /* Frameworks */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
}; };
@ -98,6 +117,14 @@
path = Runner; path = Runner;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
B81885F5B040F93E6F30E902 /* Frameworks */ = {
isa = PBXGroup;
children = (
2946B4F99A9B9A85D9A4DC4F /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
@ -105,12 +132,14 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = ( buildPhases = (
961512EDE7FE1573CFAF92FB /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */, 9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */, 97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */, 97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */, 97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
CC94AAA4981E9E5E5B1BC9E4 /* [CP] Embed Pods Frameworks */,
); );
buildRules = ( buildRules = (
); );
@ -171,6 +200,7 @@
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -183,8 +213,31 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
}; };
961512EDE7FE1573CFAF92FB /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = { 9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -197,6 +250,23 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
}; };
CC94AAA4981E9E5E5B1BC9E4 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */

View File

@ -4,4 +4,7 @@
<FileRef <FileRef
location = "group:Runner.xcodeproj"> location = "group:Runner.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace> </Workspace>

View File

@ -0,0 +1,30 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:unit2/model/profile/basic_info.dart';
import 'package:unit2/model/profile/basic_information/primary-information.dart';
import 'package:unit2/model/profile/profileInfomation.dart';
import 'package:unit2/sevices/profile/profile_service.dart';
import '../../model/profile/basic_info.dart';
import '../../model/profile/basic_info.dart';
part 'profile_event.dart';
part 'profile_state.dart';
class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
ProfileBloc() : super(ProfileInitial()) {
ProfileInformation? _profileInformation;
on<LoadProfile>((event, emit) async {
try {
emit(ProfileLoading());
ProfileInformation? profileInformation =
await ProfileService.instance.getProfile(event.token, event.userID);
_profileInformation = profileInformation;
emit(ProfileLoaded(
profileInformation: _profileInformation!));
} catch (e) {
emit(ProfileErrorState(mesage: e.toString()));
}
});
}
}

View File

@ -0,0 +1,23 @@
part of 'profile_bloc.dart';
abstract class ProfileEvent extends Equatable {
const ProfileEvent();
@override
List<Object> get props => [];
}
class LoadProfile extends ProfileEvent{
final String token;
final int userID;
const LoadProfile({required this.token, required this.userID});
@override
List<Object> get props => [token,userID];
}
class LoadProfileInformation extends ProfileEvent{
@override
List<Object> get props => [];
}

View File

@ -0,0 +1,29 @@
part of 'profile_bloc.dart';
abstract class ProfileState extends Equatable {
const ProfileState();
@override
List<Object> get props => [];
}
class ProfileInitial extends ProfileState {}
class ProfileLoaded extends ProfileState{
final ProfileInformation profileInformation;
const ProfileLoaded({required this.profileInformation});
@override
List<Object> get props => [profileInformation];
}
class ProfileErrorState extends ProfileState{
final String mesage;
const ProfileErrorState({required this.mesage});
@override
List<Object> get props => [mesage];
}
class ProfileLoading extends ProfileState{
}

View File

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:device_preview/device_preview.dart'; import 'package:device_preview/device_preview.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unit2/bloc/bloc/user_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/utils/app_router.dart'; import 'package:unit2/utils/app_router.dart';
import 'package:unit2/utils/global_context.dart'; import 'package:unit2/utils/global_context.dart';
import 'package:unit2/utils/global_context.dart'; import 'package:unit2/utils/global_context.dart';

View File

@ -0,0 +1,9 @@
import 'package:unit2/model/profile/basic_information/contact_information.dart';
import 'package:unit2/model/profile/basic_information/primary-information.dart';
class BasicInfo{
PrimaryInformation primaryInformation;
List<ContactInfo> contactInformation;
BasicInfo({required this.contactInformation, required this.primaryInformation});
}

View File

@ -0,0 +1,180 @@
// To parse this JSON data, do
//
// final contactInformation = contactInformationFromJson(jsonString);
class ContactInfo {
ContactInfo({
required this.id,
required this.active,
required this.primary,
required this.numbermail,
required this.commService,
});
int? id;
bool? active;
bool? primary;
String? numbermail;
CommService? commService;
factory ContactInfo.fromJson(Map<String, dynamic> json) => ContactInfo(
id: json["id"],
active: json["active"],
primary: json["primary"],
numbermail: json["numbermail"],
commService: json["comm_service"]==null?null: CommService.fromJson(json["comm_service"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"active": active,
"primary": primary,
"numbermail": numbermail,
"comm_service": commService!.toJson(),
};
}
class CommService {
CommService({
required this.id,
required this.serviceType,
required this.serviceProvider,
});
int? id;
ServiceType? serviceType;
ServiceProvider? serviceProvider;
factory CommService.fromJson(Map<String, dynamic> json) => CommService(
id: json["id"],
serviceType: ServiceType.fromJson(json["service_type"]),
serviceProvider: ServiceProvider.fromJson(json["service_provider"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"service_type": serviceType!.toJson(),
"service_provider": serviceProvider!.toJson(),
};
}
class ServiceProvider {
ServiceProvider({
required this.id,
required this.alias,
required this.agency,
});
int? id;
String? alias;
Agency? agency;
factory ServiceProvider.fromJson(Map<String, dynamic> json) => ServiceProvider(
id: json["id"],
alias: json["alias"],
agency: Agency.fromJson(json["agency"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"alias": alias,
"agency": agency!.toJson(),
};
}
class Agency {
Agency({
required this.id,
required this.name,
required this.category,
required this.privateEntity,
});
int? id;
String? name;
Category? category;
bool? privateEntity;
factory Agency.fromJson(Map<String, dynamic> json) => Agency(
id: json["id"],
name: json["name"],
category: Category.fromJson(json["category"]),
privateEntity: json["private_entity"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"category": category!.toJson(),
"private_entity": privateEntity,
};
}
class Category {
Category({
required this.id,
required this.name,
required this.industryClass,
});
int? id;
String? name;
IndustryClass? industryClass;
factory Category.fromJson(Map<String, dynamic> json) => Category(
id: json["id"],
name: json["name"],
industryClass: IndustryClass.fromJson(json["industry_class"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"industry_class": industryClass!.toJson(),
};
}
class IndustryClass {
IndustryClass({
required this.id,
required this.name,
this.description,
});
int? id;
String? name;
String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"],
name: json["name"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"description": description,
};
}
class ServiceType {
ServiceType({
required this.id,
required this.name,
});
int? id;
String? name;
factory ServiceType.fromJson(Map<String, dynamic> json) => ServiceType(
id: json["id"],
name: json["name"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
};
}

View File

@ -0,0 +1,95 @@
import 'dart:convert';
class PrimaryInformation {
PrimaryInformation({
required this.id,
required this.lastName,
required this.firstName,
required this.middleName,
required this.nameExtension,
required this.sex,
required this.birthdate,
required this.civilStatus,
required this.bloodType,
required this.heightM,
required this.weightKg,
required this.photoPath,
required this.esigPath,
required this.maidenName,
required this.deceased,
required this.gender,
required this.uuidQrcode,
required this.titlePrefix,
required this.titleSuffix,
required this.showTitleId,
});
int? id;
String? lastName;
String? firstName;
String? middleName;
String? nameExtension;
String? sex;
DateTime? birthdate;
String? civilStatus;
String? bloodType;
double? heightM;
double? weightKg;
String? photoPath;
String? esigPath;
String? maidenName;
bool? deceased;
String? gender;
String? uuidQrcode;
String? titlePrefix;
String? titleSuffix;
bool? showTitleId;
factory PrimaryInformation.fromJson(Map<String, dynamic> json) =>
PrimaryInformation(
id: json["id"],
lastName: json["last_name"],
firstName: json["first_name"],
middleName: json["middle_name"],
nameExtension: json["name_extension"],
sex: json["sex"],
birthdate: json['birthdate']==null?null:DateTime.parse(json["birthdate"]),
civilStatus: json["civil_status"],
bloodType: json["blood_type"],
heightM: json["height_m"]?.toDouble(),
weightKg: json["weight_kg"],
photoPath: json["photo_path"],
esigPath: json["esig_path"],
maidenName: json["maiden_name"],
deceased: json["deceased"],
gender: json["gender"],
uuidQrcode: json["uuid_qrcode"],
titlePrefix: json["title_prefix"],
titleSuffix: json["title_suffix"],
showTitleId: json["show_title_id"],
);
Map<String, dynamic> toJson() => {
"id": id,
"last_name": lastName,
"first_name": firstName,
"middle_name": middleName,
"name_extension": nameExtension,
"sex": sex,
"birthdate":
"${birthdate!.year.toString().padLeft(4, '0')}-${birthdate!.month.toString().padLeft(2, '0')}-${birthdate!.day.toString().padLeft(2, '0')}",
"civil_status": civilStatus,
"blood_type": bloodType,
"height_m": heightM,
"weight_kg": weightKg,
"photo_path": photoPath,
"esig_path": esigPath,
"maiden_name": maidenName,
"deceased": deceased,
"gender": gender,
"uuid_qrcode": uuidQrcode,
"title_prefix": titlePrefix,
"title_suffix": titleSuffix,
"show_title_id": showTitleId,
};
}

View File

@ -0,0 +1,7 @@
import 'package:unit2/model/profile/basic_info.dart';
import 'package:unit2/model/profile/basic_information/primary-information.dart';
class ProfileInformation{
BasicInfo basicInfo;
ProfileInformation({required this.basicInfo});
}

View File

@ -0,0 +1,80 @@
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:unit2/model/profile/basic_information/contact_information.dart';
import 'package:unit2/theme-data.dart/colors.dart';
class ContactInformation extends StatefulWidget {
final List<ContactInfo> contacts;
const ContactInformation({super.key, required this.contacts});
@override
State<ContactInformation> createState() => _ContactInformationState();
}
class _ContactInformationState extends State<ContactInformation> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: const Text("Contact Information"),
centerTitle: true,
backgroundColor: primary,
),
body: ListView.builder(
itemCount: widget.contacts.length,
itemBuilder: (BuildContext context, int index) {
return Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: const BorderRadius.all(Radius.circular(12))),
padding: const EdgeInsets.symmetric(horizontal: 12,vertical: 8),
child: Row(
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(widget.contacts[index].numbermail.toString(),style: Theme.of(context).textTheme.titleLarge,),
const SizedBox(height: 5,),
Row(
children: [
Text(widget.contacts[index].commService!
.serviceProvider!.alias
.toString()),
const SizedBox(width: 15,),
widget.contacts[index].active==true? const Badge(backgroundColor: Colors.green, label: Text("Active",),):const SizedBox(),
const SizedBox(width: 8),
widget.contacts[index].primary==true? const Badge(backgroundColor: Colors.blue, label: Text("Primary"),):const SizedBox()
],
),
const SizedBox(height: 5,),
Text(widget.contacts[index].commService!
.serviceProvider!.agency!.name
.toString()),
]),
),
IconButton(onPressed: (){}, icon: const Icon(Icons.more_vert))
],
),
),
const SizedBox(height: 5,),
],
),
);
}),
),
);
}
}

View File

@ -0,0 +1,163 @@
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:intl/intl.dart';
import 'package:unit2/model/profile/basic_information/primary-information.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/global.dart';
class PrimaryInfo extends StatefulWidget {
final PrimaryInformation primaryInformation;
const PrimaryInfo({super.key, required this.primaryInformation});
@override
State<PrimaryInfo> createState() => _PrimaryInfoState();
}
class _PrimaryInfoState extends State<PrimaryInfo> {
@override
Widget build(BuildContext context) {
final _formKey = GlobalKey<FormBuilderState>();
bool enabled = false;
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: const Text("Primary Information"),
centerTitle: true,
backgroundColor: primary,
),
body: Container(
padding: const EdgeInsets.symmetric(vertical: 24, horizontal: 24),
child: FormBuilder(
child: Column(
children: [
FormBuilderTextField(
enabled: enabled,
name: 'lastname',
initialValue: widget.primaryInformation.lastName!,
decoration: normalTextFieldStyle("Last name", ""),
),
const SizedBox(height: 15,),
FormBuilderTextField(
enabled: enabled,
name: 'firstname',
initialValue: widget.primaryInformation.firstName!,
decoration: normalTextFieldStyle("First name", ""),
),
const SizedBox(height: 15,),
SizedBox(
width: screenWidth,
child: Row(children: [
Flexible(
flex: 2,
child: FormBuilderTextField(
enabled: enabled,
name: 'middlename',
initialValue: widget.primaryInformation.middleName!,
decoration: normalTextFieldStyle("Middle name", ""),
),),
const SizedBox(width: 10,),
Flexible(
flex: 1,
child: FormBuilderTextField(
enabled: enabled,
name: 'extension-name',
initialValue: widget.primaryInformation.nameExtension??='N/A',
decoration: normalTextFieldStyle("Name extension", ""),
),)
]),
),
const SizedBox(height: 15,),
SizedBox(width: screenWidth,
child: Row(children: [
Flexible(
flex: 1,
child: FormBuilderTextField(
enabled: enabled,
name: 'bday',
initialValue: dteFormat2.format(widget.primaryInformation.birthdate!),
decoration: normalTextFieldStyle("Birth date", ""),
),),
const SizedBox(width: 10,),
Flexible(
flex: 1,
child: FormBuilderTextField(
enabled: enabled,
name: 'sex',
initialValue: widget.primaryInformation.sex!,
decoration: normalTextFieldStyle("Sex", ""),
),)
]),),
const SizedBox(height: 15,),
SizedBox(width: screenWidth,
child: Row(children: [
Flexible(
flex: 1,
child: FormBuilderTextField(
enabled: enabled,
name: 'bloodtype',
initialValue:widget.primaryInformation.bloodType!,
decoration: normalTextFieldStyle("Blood type", ""),
),),
const SizedBox(width: 10,),
Flexible(
flex: 1,
child: FormBuilderTextField(
enabled: enabled,
name: 'civil-status',
initialValue: widget.primaryInformation.civilStatus!,
decoration: normalTextFieldStyle("Civil Status", ""),
),),
const SizedBox(width: 10,),
Flexible(
flex: 1,
child: FormBuilderTextField(
enabled: enabled,
name: 'gender',
initialValue:widget.primaryInformation.gender??="N/A",
decoration: normalTextFieldStyle("Gender", ""),
),),
]),),
const SizedBox(height: 15,),
SizedBox(width: screenWidth,
child: Row(children: [
Flexible(
flex: 1,
child: FormBuilderTextField(
enabled: enabled,
name: 'height',
initialValue:widget.primaryInformation.heightM!.toString(),
decoration: normalTextFieldStyle("Height", ""),
),),
const SizedBox(width: 10,),
Flexible(
flex: 1,
child: FormBuilderTextField(
enabled: enabled,
name: 'Weight',
initialValue: widget.primaryInformation.weightKg!.toString(),
decoration: normalTextFieldStyle("Weight", ""),
),),
const SizedBox(width: 10,),
Flexible(
flex: 1,
child: FormBuilderTextField(
enabled: enabled,
name: 'prefix&suffix',
initialValue:"${widget.primaryInformation.titlePrefix??="NA"} | ${widget.primaryInformation.titleSuffix??="N/A"}",
decoration: normalTextFieldStyle("Title Prefix and Suffix", ""),
),),
]),),
],
)),
)),
);
}
}

View File

@ -0,0 +1,132 @@
import 'package:expandable_group/expandable_group_widget.dart';
import 'package:flutter/material.dart';
import 'package:fluttericon/brandico_icons.dart';
import 'package:fluttericon/elusive_icons.dart';
import 'package:fluttericon/entypo_icons.dart';
import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:fluttericon/modern_pictograms_icons.dart';
import 'package:unit2/screens/profile/components/main_menu.dart';
import 'package:unit2/screens/profile/components/submenu.dart';
import '../../../theme-data.dart/colors.dart';
class LoadingScreen extends StatelessWidget {
const LoadingScreen({super.key});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(
vertical: 12, horizontal: 12),
child: ListView(
children: [
const Text(
"View and Update your Profile Information"),
ExpandableGroup(
collapsedIcon:
const Icon(Icons.keyboard_arrow_down),
expandedIcon:
const Icon(Icons.keyboard_arrow_up),
header: const ListTile(
leading: Icon(
Elusive.address_book,
color: primary,
),
title: Text(
"Basic Information",
style:
TextStyle(fontWeight: FontWeight.bold),
),
),
items: [
subMenu(Icons.person, "Primary",(){}),
subMenu(Icons.home, "Home Addresses",(){}),
subMenu(
Icons.contact_mail, "Identifications",(){}),
subMenu(Icons.contact_phone, "Contact Info",(){}),
subMenu(Icons.flag, "Citizenships",(){}),
]),
const Divider(),
const MainMenu(
icon: Elusive.group,
title: "Family",
),
const Divider(),
const MainMenu(
icon: FontAwesome5.graduation_cap,
title: "Education",
),
const Divider(),
const MainMenu(
icon: Icons.stars,
title: "Eligibility",
),
const Divider(),
const MainMenu(
icon: FontAwesome5.shopping_bag,
title: "Work History",
),
const Divider(),
const MainMenu(
icon: FontAwesome5.walking,
title: "Voluntary Work & Civic Services",
),
const Divider(),
const MainMenu(
icon: Elusive.lightbulb,
title: "Learning & Development",
),
const Divider(),
const MainMenu(
icon: Brandico.codepen,
title: "Personal References",
),
ExpandableGroup(
collapsedIcon:
const Icon(Icons.keyboard_arrow_down),
expandedIcon:
const Icon(Icons.keyboard_arrow_up),
header: const ListTile(
leading: Icon(
Icons.info,
color: primary,
),
title: Text(
"Other Information",
style:
TextStyle(fontWeight: FontWeight.bold),
),
),
items: [
subMenu(
Icons.fitness_center, "Skills & Hobbies",(){}),
subMenu(FontAwesome5.certificate,
"Organization Memberships",(){}),
subMenu(Entypo.doc_text,
"Non-Academic Recognitions",(){}),
]),
ExpandableGroup(
collapsedIcon:
const Icon(Icons.keyboard_arrow_down),
expandedIcon:
const Icon(Icons.keyboard_arrow_up),
header: const ListTile(
leading: Icon(
FontAwesome5.laptop_house,
color: primary,
),
title: Text(
"Assets",
style:
TextStyle(fontWeight: FontWeight.bold),
),
),
items: [
subMenu(ModernPictograms.home,
"Real Property Tax",(){}),
]),
],
),
);
}
}

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
ListTile subMenu(IconData icon, String title) { ListTile subMenu(IconData icon, String title,Function() onTap) {
return ListTile( return ListTile(
leading: Container( leading: Container(
margin: const EdgeInsets.only(left: 20), margin: const EdgeInsets.only(left: 20),
@ -15,5 +15,6 @@ ListTile subMenu(IconData icon, String title) {
style: const TextStyle(), style: const TextStyle(),
), ),
trailing: const Icon(Icons.keyboard_arrow_right), trailing: const Icon(Icons.keyboard_arrow_right),
onTap: onTap,
); );
} }

View File

@ -1,19 +1,18 @@
import 'package:expandable_group/expandable_group_widget.dart'; import 'package:expandable_group/expandable_group_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.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:fluttericon/brandico_icons.dart'; import 'package:fluttericon/brandico_icons.dart';
import 'package:fluttericon/elusive_icons.dart'; import 'package:fluttericon/elusive_icons.dart';
import 'package:fluttericon/entypo_icons.dart'; import 'package:fluttericon/entypo_icons.dart';
import 'package:fluttericon/font_awesome5_icons.dart'; import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:fluttericon/font_awesome_icons.dart';
import 'package:fluttericon/modern_pictograms_icons.dart'; import 'package:fluttericon/modern_pictograms_icons.dart';
import 'package:fluttericon/typicons_icons.dart'; import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/bloc/bloc/user_bloc.dart'; import 'package:unit2/screens/profile/components/basic_information/contact_information.dart';
import 'package:unit2/screens/profile/components/basic_information/primary_information.dart';
import 'package:unit2/screens/profile/components/loading_screen.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import '../../bloc/user/user_bloc.dart';
import 'components/main_menu.dart'; import 'components/main_menu.dart';
import 'components/submenu.dart'; import 'components/submenu.dart';
@ -34,22 +33,38 @@ class _ProfileInfoState extends State<ProfileInfo> {
centerTitle: true, centerTitle: true,
title: const Text('Profile'), title: const Text('Profile'),
), ),
body: BlocConsumer<UserBloc, UserState>( body: ProgressHUD(
child:
BlocBuilder<UserBloc, UserState>(builder: (context, state) {
if (state is UserLoggedIn) {
return BlocConsumer<ProfileBloc, ProfileState>(
listener: (context, state) { listener: (context, state) {
// TODO: implement listener if (state is ProfileLoading) {
final progress = ProgressHUD.of(context);
progress?.showWithText(
'Loading Profile',
);
}
if (state is ProfileLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, },
builder: (context, state) { builder: (context, state) {
if (state is UserLoggedIn) { if (state is ProfileLoaded) {
return Container( return Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
vertical: 12, horizontal: 12), vertical: 12, horizontal: 12),
child: ListView( child: ListView(
children: [ children: [
const Text("View and Update your Profile Information"), const Text(
"View and Update your Profile Information"),
ExpandableGroup( ExpandableGroup(
collapsedIcon: collapsedIcon:
const Icon(Icons.keyboard_arrow_down), const Icon(Icons.keyboard_arrow_down),
expandedIcon: const Icon(Icons.keyboard_arrow_up), expandedIcon:
const Icon(Icons.keyboard_arrow_up),
header: const ListTile( header: const ListTile(
leading: Icon( leading: Icon(
Elusive.address_book, Elusive.address_book,
@ -57,15 +72,26 @@ class _ProfileInfoState extends State<ProfileInfo> {
), ),
title: Text( title: Text(
"Basic Information", "Basic Information",
style: TextStyle(fontWeight: FontWeight.bold), style: TextStyle(
fontWeight: FontWeight.bold),
), ),
), ),
items: [ items: [
subMenu(Icons.person, "Primary"), subMenu(Icons.person, "Primary",(){
subMenu(Icons.home, "Home Addresses"), Navigator.push(context,MaterialPageRoute(builder: (BuildContext context){
subMenu(Icons.contact_mail, "Identifications"), return PrimaryInfo(primaryInformation: state.profileInformation.basicInfo.primaryInformation);
subMenu(Icons.contact_phone, "Contact Info"), }) );
subMenu(Icons.flag, "Citizenships"), }),
subMenu(Icons.home, "Home Addresses",(){}),
subMenu(
Icons.contact_mail, "Identifications",(){}),
subMenu(
Icons.contact_phone, "Contact Info",(){
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return ContactInformation(contacts: state.profileInformation.basicInfo.contactInformation,);
}));
}),
subMenu(Icons.flag, "Citizenships",(){}),
]), ]),
const Divider(), const Divider(),
const MainMenu( const MainMenu(
@ -105,7 +131,8 @@ class _ProfileInfoState extends State<ProfileInfo> {
ExpandableGroup( ExpandableGroup(
collapsedIcon: collapsedIcon:
const Icon(Icons.keyboard_arrow_down), const Icon(Icons.keyboard_arrow_down),
expandedIcon: const Icon(Icons.keyboard_arrow_up), expandedIcon:
const Icon(Icons.keyboard_arrow_up),
header: const ListTile( header: const ListTile(
leading: Icon( leading: Icon(
Icons.info, Icons.info,
@ -113,20 +140,23 @@ class _ProfileInfoState extends State<ProfileInfo> {
), ),
title: Text( title: Text(
"Other Information", "Other Information",
style: TextStyle(fontWeight: FontWeight.bold), style: TextStyle(
fontWeight: FontWeight.bold),
), ),
), ),
items: [ items: [
subMenu(Icons.fitness_center, "Skills & Hobbies"), subMenu(Icons.fitness_center,
"Skills & Hobbies",(){}),
subMenu(FontAwesome5.certificate, subMenu(FontAwesome5.certificate,
"Organization Memberships"), "Organization Memberships",(){}),
subMenu( subMenu(Entypo.doc_text,
Entypo.doc_text, "Non-Academic Recognitions"), "Non-Academic Recognitions",(){}),
]), ]),
ExpandableGroup( ExpandableGroup(
collapsedIcon: collapsedIcon:
const Icon(Icons.keyboard_arrow_down), const Icon(Icons.keyboard_arrow_down),
expandedIcon: const Icon(Icons.keyboard_arrow_up), expandedIcon:
const Icon(Icons.keyboard_arrow_up),
header: const ListTile( header: const ListTile(
leading: Icon( leading: Icon(
FontAwesome5.laptop_house, FontAwesome5.laptop_house,
@ -134,21 +164,28 @@ class _ProfileInfoState extends State<ProfileInfo> {
), ),
title: Text( title: Text(
"Assets", "Assets",
style: TextStyle(fontWeight: FontWeight.bold), style: TextStyle(
fontWeight: FontWeight.bold),
), ),
), ),
items: [ items: [
subMenu( subMenu(ModernPictograms.home,
ModernPictograms.home, "Real Property Tax"), "Real Property Tax",(){}),
]), ]),
], ],
), ),
); );
} }
return const Center( if (state is ProfileLoading) {
child: Text("default"), return const LoadingScreen();
); }
return Container();
}, },
);
}
return Container();
}),
))); )));
} }
} }

View File

@ -5,11 +5,11 @@ import 'package:flutter_svg/svg.dart';
import 'package:fluttericon/font_awesome5_icons.dart'; import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
import 'package:unit2/bloc/bloc/user_bloc.dart';
import 'package:unit2/model/login_data/user_info/user_data.dart'; import 'package:unit2/model/login_data/user_info/user_data.dart';
import 'package:unit2/theme-data.dart/btn-style.dart'; import 'package:unit2/theme-data.dart/btn-style.dart';
import 'package:unit2/utils/global.dart'; import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import '../../../bloc/user/user_bloc.dart';
import '../../../theme-data.dart/colors.dart'; import '../../../theme-data.dart/colors.dart';
import '../../../widgets/splash_screen.dart'; import '../../../widgets/splash_screen.dart';
import './components/cover-image.dart'; import './components/cover-image.dart';

View File

@ -1,7 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart'; import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart';
import 'package:unit2/test_data.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
class DashBoard extends StatelessWidget { class DashBoard extends StatelessWidget {
@ -62,7 +60,7 @@ class DashBoard extends StatelessWidget {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.button! .labelLarge!
.copyWith( .copyWith(
fontSize: 11, fontSize: 11,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),

View File

@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_zoom_drawer/config.dart'; import 'package:flutter_zoom_drawer/config.dart';
import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart'; import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart';
import 'package:unit2/bloc/bloc/user_bloc.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import '../../../../bloc/user/user_bloc.dart';
import '../../../../widgets/splash_screen.dart'; import '../../../../widgets/splash_screen.dart';
import 'menu-screen.dart'; import 'menu-screen.dart';
import '../module-screen.dart'; import '../module-screen.dart';

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:unit2/model/login_data/employee_info/employee_info.dart';
import 'package:unit2/model/login_data/user_info/user_data.dart'; import 'package:unit2/model/login_data/user_info/user_data.dart';
import 'package:unit2/utils/alerts.dart'; import 'package:unit2/utils/alerts.dart';
import '../../../../theme-data.dart/colors.dart'; import '../../../../theme-data.dart/colors.dart';
@ -20,9 +21,19 @@ Widget getTile(
confirmAlert(context, () { confirmAlert(context, () {
Navigator.pushReplacementNamed (context,"/"); Navigator.pushReplacementNamed (context,"/");
}); });
} else { }if(title.toLowerCase() == 'profile'){
ProfileArguments profileArguments = ProfileArguments(token: userData.user!.login!.token!, userID:userData.user!.login!.user!.profileId!);
Navigator.pushNamed(context, route,arguments: profileArguments);
}
else {
Navigator.pushNamed(context, route); Navigator.pushNamed(context, route);
} }
}, },
); );
} }
class ProfileArguments{
final int userID;
final String token;
const ProfileArguments({required this.token, required this.userID});
}

View File

@ -7,8 +7,7 @@ import 'package:fluttericon/typicons_icons.dart';
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard.dart'; import 'package:unit2/screens/unit2/homepage.dart/components/dashboard.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import '../../../bloc/user/user_bloc.dart';
import '../../../bloc/bloc/user_bloc.dart';
import '../../../model/login_data/user_info/role.dart'; import '../../../model/login_data/user_info/role.dart';
import 'components/empty_module.dart'; import 'components/empty_module.dart';
@ -21,8 +20,8 @@ class MainScreen extends StatefulWidget {
class _MainScreenState extends State<MainScreen> { class _MainScreenState extends State<MainScreen> {
List<Module> roles = [ List<Module> roles = [
Module(name: 'UniT2 roles', roles: []), Module(name: 'UniT2 module operations', roles: []),
Module(name: 'DocSms roles', roles: []) Module(name: 'DocSms module operations', roles: [])
]; ];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

@ -9,10 +9,10 @@ import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:unit2/bloc/bloc/user_bloc.dart';
import 'package:unit2/screens/unit2/login/components/showAlert.dart'; import 'package:unit2/screens/unit2/login/components/showAlert.dart';
import 'package:unit2/theme-data.dart/btn-style.dart'; import 'package:unit2/theme-data.dart/btn-style.dart';
import '../../../../bloc/user/user_bloc.dart';
import '../../../../theme-data.dart/colors.dart'; import '../../../../theme-data.dart/colors.dart';
import '../../../../utils/cpu_architecture.dart'; import '../../../../utils/cpu_architecture.dart';
import '../../../../utils/text_container.dart'; import '../../../../utils/text_container.dart';

View File

@ -6,10 +6,10 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:fluttericon/font_awesome5_icons.dart'; import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:unit2/bloc/bloc/user_bloc.dart';
import 'package:unit2/screens/unit2/login/components/update_required.dart'; import 'package:unit2/screens/unit2/login/components/update_required.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import '../../../bloc/user/user_bloc.dart';
import '../../../widgets/splash_screen.dart'; import '../../../widgets/splash_screen.dart';
import '../../../widgets/wave.dart'; import '../../../widgets/wave.dart';
import '../../../utils/global.dart'; import '../../../utils/global.dart';
@ -212,12 +212,15 @@ class _UniT2LoginState extends State<UniT2Login> {
BlocProvider.of<UserBloc>(context) BlocProvider.of<UserBloc>(context)
.add(UserLogin( .add(UserLogin(
username: _formKey username: "rjvincentlopeplopez",
.currentState! password: "shesthequ33n",
.value['username'], // username: _formKey
password: _formKey // .currentState!
.currentState! // .value['username'],
.value['password'])); // password: _formKey
// .currentState!
// .value['password'])
));
} }
}, },
), ),

View File

@ -10,8 +10,7 @@ import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:unit2/theme-data.dart/btn-style.dart'; import 'package:unit2/theme-data.dart/btn-style.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import 'package:unit2/widgets/wave.dart'; import 'package:unit2/widgets/wave.dart';
import '../../../bloc/user/user_bloc.dart';
import '../../../bloc/bloc/user_bloc.dart';
import '../../../theme-data.dart/colors.dart'; import '../../../theme-data.dart/colors.dart';
import '../../../theme-data.dart/form-style.dart'; import '../../../theme-data.dart/form-style.dart';
import '../../../utils/global.dart'; import '../../../utils/global.dart';

View File

@ -1,8 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart';
import 'package:unit2/model/login_data/user_info/user_data.dart'; import 'package:unit2/model/login_data/user_info/user_data.dart';
import 'package:unit2/model/login_data/version_info.dart'; import 'package:unit2/model/login_data/version_info.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
@ -30,11 +28,7 @@ class AuthService {
Map data = jsonDecode(response.body); Map data = jsonDecode(response.body);
versionInfo = VersionInfo.fromJson(data['data']); versionInfo = VersionInfo.fromJson(data['data']);
} }
} on TimeoutException catch (_) { }catch (e) {
throw (timeoutError);
} on SocketException catch (_) {
throw (timeoutError);
} catch (e) {
throw (e.toString()); throw (e.toString());
} }
return versionInfo; return versionInfo;

View File

@ -0,0 +1,50 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:unit2/model/login_data/employee_info/employee_info.dart';
import 'package:unit2/model/profile/basic_info.dart';
import 'package:unit2/model/profile/basic_information/contact_information.dart';
import 'package:unit2/model/profile/profileInfomation.dart';
import 'package:unit2/utils/request.dart';
import 'package:unit2/utils/urls.dart';
import '../../model/profile/basic_information/primary-information.dart';
class ProfileService {
static final ProfileService _instance = ProfileService();
static ProfileService get instance => _instance;
Future<ProfileInformation?> getProfile(String token, int id) async {
String url = Url.instance.profileInformation();
String path = url + id.toString();
ProfileInformation? _profileInformation;
ContactInfo contactInfo;
List<ContactInfo> contactInformation = [];
PrimaryInformation primaryInformation;
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': "Token $token"
};
try{
http.Response response = await Request.instance
.getRequest(path: path, param: {}, headers: headers);
if (response.statusCode == 200) {
Map data = jsonDecode(response.body);
// get primary information
primaryInformation = PrimaryInformation.fromJson(
data['data']['basic_information']['primary_information']);
// get all contacts
data['data']['basic_information']['contact_information']
.forEach((var contact) {
contactInfo = ContactInfo.fromJson(contact['contact_info']);
contactInformation.add(contactInfo);
});
BasicInfo basicInfo = BasicInfo(contactInformation: contactInformation, primaryInformation: primaryInformation);
ProfileInformation profileInformation = ProfileInformation(basicInfo: basicInfo);
_profileInformation = profileInformation;
}
}catch(e){
throw(e.toString());
}
return _profileInformation;
}
}

View File

@ -1,8 +1,10 @@
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:unit2/bloc/bloc/user_bloc.dart'; import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/screens/unit2/homepage.dart/components/menu.dart';
import 'package:unit2/screens/unit2/login/login.dart'; import 'package:unit2/screens/unit2/login/login.dart';
import 'package:unit2/utils/global_context.dart'; import 'package:unit2/utils/global_context.dart';
import '../bloc/user/user_bloc.dart';
import '../screens/profile/profile.dart'; import '../screens/profile/profile.dart';
import '../screens/unit2/basic-info/basic-info.dart'; import '../screens/unit2/basic-info/basic-info.dart';
import '../screens/unit2/homepage.dart/components/drawer-screen.dart'; import '../screens/unit2/homepage.dart/components/drawer-screen.dart';
@ -33,7 +35,11 @@ class AppRouter {
}); });
case '/profile': case '/profile':
return MaterialPageRoute(builder: (_) { return MaterialPageRoute(builder: (_) {
return const ProfileInfo(); ProfileArguments arguments = routeSettings.arguments as ProfileArguments;
return BlocProvider(
create: (context) => ProfileBloc()..add(LoadProfile(token: arguments.token,userID: arguments.userID)),
child: const ProfileInfo(),
);
}); });
default: default:
return MaterialPageRoute(builder: (context) { return MaterialPageRoute(builder: (context) {

View File

@ -19,7 +19,7 @@ class Request {
Map<String, String>? param}) async { Map<String, String>? param}) async {
Response response; Response response;
try { try {
response = await get(Uri.https(host, path!, param), headers: headers) response = await get(Uri.http(host, path!, param), headers: headers)
.timeout(Duration(seconds: requestTimeout)); .timeout(Duration(seconds: requestTimeout));
} on TimeoutException catch (_) { } on TimeoutException catch (_) {
Fluttertoast.showToast( Fluttertoast.showToast(
@ -61,7 +61,8 @@ class Request {
Map<String, String>? param}) async { Map<String, String>? param}) async {
Response response; Response response;
try { try {
response = await post(Uri.https(host, path!, param), headers: headers,body: jsonEncode(body)) response = await post(Uri.http(host, path!, param),
headers: headers, body: jsonEncode(body))
.timeout(Duration(seconds: requestTimeout)); .timeout(Duration(seconds: requestTimeout));
} on TimeoutException catch (_) { } on TimeoutException catch (_) {
Fluttertoast.showToast( Fluttertoast.showToast(

View File

@ -1,19 +1,18 @@
class Url{ class Url {
static final Url _instance = Url(); static final Url _instance = Url();
static Url get instance => _instance; static Url get instance => _instance;
String host(){ String host() {
// return '192.168.10.219:3000'; // return '192.168.10.221:3003';
return 'agusandelnorte.gov.ph'; // return 'agusandelnorte.gov.ph';
return 'devweb.agusandelnorte.gov.ph';
} }
String authentication() {
String authentication(){
return '/api/account/auth/login/'; return '/api/account/auth/login/';
} }
String apkUrl(){ String profileInformation(){
return ""; return '/api/jobnet_app/profile/pds/';
} }
} }

View File

@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig"

View File

@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig"

View File

@ -6,8 +6,8 @@ import FlutterMacOS
import Foundation import Foundation
import package_info_plus import package_info_plus
import path_provider_macos import path_provider_foundation
import shared_preferences_macos import shared_preferences_foundation
import sqflite import sqflite
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {

40
macos/Podfile 100644
View File

@ -0,0 +1,40 @@
platform :osx, '10.14'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_macos_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end

File diff suppressed because it is too large Load Diff

View File

@ -67,6 +67,7 @@ dependencies:
cool_alert: ^1.1.0 cool_alert: ^1.1.0
permission_handler: ^10.2.0 permission_handler: ^10.2.0
expandable_group: ^0.0.8 expandable_group: ^0.0.8
badges: ^3.0.2
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: