diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 890041c..124a61c 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -9,7 +9,7 @@
-
+
CFBundleVersion
1.0
MinimumOSVersion
- 8.0
+ 11.0
diff --git a/ios/Podfile b/ios/Podfile
index 1e8c3c9..88359b2 100644
--- a/ios/Podfile
+++ b/ios/Podfile
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
-# platform :ios, '9.0'
+# platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index 251779c..7d4516a 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -3,13 +3,14 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 46;
+ objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
+ 7F97140DDC9766C8BCC9DB1F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB5A9940CDB629A1BBA2BC51 /* Pods_Runner.framework */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
@@ -31,10 +32,12 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
+ 1ADB1407455DE034E10C911C /* 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 = ""; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
+ 88873868416AD783785E81C7 /* 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 = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -42,6 +45,8 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ B25627757AF10282201C5B03 /* 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 = ""; };
+ FB5A9940CDB629A1BBA2BC51 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -49,6 +54,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 7F97140DDC9766C8BCC9DB1F /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -72,6 +78,8 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
+ E778508E83C915897E28B2CA /* Pods */,
+ BF2BAC820406AD7785E66AA3 /* Frameworks */,
);
sourceTree = "";
};
@@ -106,6 +114,25 @@
name = "Supporting Files";
sourceTree = "";
};
+ BF2BAC820406AD7785E66AA3 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ FB5A9940CDB629A1BBA2BC51 /* Pods_Runner.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
+ E778508E83C915897E28B2CA /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ B25627757AF10282201C5B03 /* Pods-Runner.debug.xcconfig */,
+ 88873868416AD783785E81C7 /* Pods-Runner.release.xcconfig */,
+ 1ADB1407455DE034E10C911C /* Pods-Runner.profile.xcconfig */,
+ );
+ name = Pods;
+ path = Pods;
+ sourceTree = "";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -113,12 +140,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
+ 161D032BEF51F13F0F798179 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+ B9FAECD78F48C1C5410BD713 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -135,7 +164,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 1020;
+ LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@@ -177,6 +206,28 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
+ 161D032BEF51F13F0F798179 /* [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;
+ };
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -205,6 +256,23 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
+ B9FAECD78F48C1C5410BD713 /* [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 */
/* Begin PBXSourcesBuildPhase section */
@@ -241,7 +309,6 @@
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
@@ -281,7 +348,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -303,7 +370,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
@@ -318,7 +388,6 @@
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
@@ -364,7 +433,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -374,7 +443,6 @@
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
@@ -414,7 +482,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -437,7 +505,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
@@ -464,7 +535,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
@@ -503,4 +577,4 @@
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
-}
\ No newline at end of file
+}
diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
index 1d526a1..919434a 100644
--- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -2,6 +2,6 @@
+ location = "self:">
diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index a28140c..3db53b6 100644
--- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -1,6 +1,6 @@
+
+
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 9849e45..8b54232 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -41,5 +41,7 @@
UIViewControllerBasedStatusBarAppearance
+ CADisableMinimumFrameDurationOnPhone
+
diff --git a/lib/asset_details.dart b/lib/asset_details.dart
index a400e51..24014a3 100644
--- a/lib/asset_details.dart
+++ b/lib/asset_details.dart
@@ -529,7 +529,7 @@ class _AssetDetailsState extends State with TickerProviderStateMix
children: [
Expanded(
flex: 5,
- child: FlatButton(
+ child: TextButton(
onPressed: ()async{
if(barCode.text!=''&&prefixCode.text!='')await findAsset(prefixCode.text+barCode.text,silent: true);
else _asset.tag_number = null;
@@ -546,13 +546,13 @@ class _AssetDetailsState extends State with TickerProviderStateMix
title: Text('Append New Asset'),
content: Text('${(widget.no==null)?'Insert':'Update'} brand new asset?'),
actions: [
- FlatButton(
+ TextButton(
onPressed: ()async{
Navigator.pop(context,true);
},
child: Text('Save'),
),
- FlatButton(
+ TextButton(
onPressed: ()async{
Navigator.pop(context,false);
},
@@ -591,19 +591,23 @@ class _AssetDetailsState extends State with TickerProviderStateMix
util.showToast('ERROR', 'Please complete the asset data');
}
},
- color: Colors.green,
+ style: TextButton.styleFrom(
+ backgroundColor: Colors.green,
+ ),
child: Container(alignment: Alignment.center,height: 50,
- child: Text('Save')),
+ child: Text('Save',style: TextStyle(color: Colors.white),)),
),
),
Expanded(
flex: 5,
- child: FlatButton(
+ child: TextButton(
+ style: TextButton.styleFrom(
+ backgroundColor: Colors.red,
+ ),
onPressed: (){
Navigator.pop(context);
},
- color: Colors.red,
- child: Container(alignment: Alignment.center,height:50,child: Text('Cancel')),
+ child: Container(alignment: Alignment.center,height:50,child: Text('Cancel',style: TextStyle(color: Colors.white))),
),
),
],
diff --git a/lib/asset_logs.dart b/lib/asset_logs.dart
index 3f98ad2..9f085de 100644
--- a/lib/asset_logs.dart
+++ b/lib/asset_logs.dart
@@ -53,7 +53,7 @@ class _AssetLogsState extends State {
title: Text('Pick nonAuditAsset'),
content: Text("Select Asset ${idxAsset.tag_number}"),
actions: [
- FlatButton(
+ TextButton(
onPressed: (){
Navigator.pop(context,true);
},
diff --git a/lib/home.dart b/lib/home.dart
index bdb45e2..0bc2a9c 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -48,18 +48,18 @@ class _HomeState extends State {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
// await loadMenu();
- final androidVersion = await DeviceInfoPlugin().androidInfo;
- if ((androidVersion.version.sdkInt ?? 0) >= 30) {
- await util.permissionCheck(this.context,pHandler.Permission.manageExternalStorage,()async{print("storage permit granted!");},customMessage: " untuk menyimpan data backup");
- } else {
+// final androidVersion = await DeviceInfoPlugin().androidInfo;
+// if ((androidVersion.version.sdkInt ?? 0) >= 30) {
+// await util.permissionCheck(this.context,pHandler.Permission.manageExternalStorage,()async{print("storage permit granted!");},customMessage: " untuk menyimpan data backup");
+// } else {
await util.permissionCheck(this.context,pHandler.Permission.storage,()async{print("storage permit granted!");},customMessage: " untuk menyimpan data backup");
- }
+ // }
});
}
clearData(context)async{
String errMsg;
- Directory documentsDirectory = await getExternalStorageDirectory();
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "assets.db");
File db = File(path);
if(db.existsSync()){
@@ -72,7 +72,7 @@ class _HomeState extends State {
title: Text('Clear Data ?'),
content: Text('Proceed to clear any remaining units data on this device?'),
actions: [
- FlatButton(
+ TextButton(
child: Text('Proceed'),
onPressed: ()async{
util.showLoading(context);
@@ -112,7 +112,7 @@ class _HomeState extends State {
util.showToast(errMsg==null?"SUCCESS":"ERROR",errMsg??'Data Cleared');
},
),
- FlatButton(
+ TextButton(
child: Text('Cancel'),
onPressed: (){Navigator.pop(context,false);},
)
@@ -131,7 +131,7 @@ class _HomeState extends State {
padding: const EdgeInsets.only(bottom:45.0),
child: FloatingActionButton(
onPressed: ()async{
- Directory documentsDirectory = await getExternalStorageDirectory();
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "assets.db");
File db = File(path);
if(db.existsSync()){
@@ -214,7 +214,7 @@ class _HomeState extends State {
},
),
actions: [
- FlatButton(
+ TextButton(
child: Text('OK'),
onPressed: (){
prefs.setString(keyClass.hostAddress,(hostAddress.text=='')?'https://asset.thamringroup.web.id':hostAddress.text);
@@ -246,7 +246,7 @@ class _HomeState extends State {
],
));
if(isBackup??false){
- var result = await DBHelper.database.backupDb(context);
+ var result = await DBHelper.database.backupDb(context:context);
util.showToast(result["STATUS"]==1?'NORMAL':'ERROR', result['MSG']);
}
}
@@ -281,7 +281,7 @@ class _HomeState extends State {
if(isRestore??false){
var response;
bool isclear;
- Directory documentsDirectory = await getExternalStorageDirectory();
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "assets.db");
File db = File(path);
if(db.existsSync()){
@@ -375,13 +375,13 @@ class _HomeState extends State {
})),
),
actions: [
- FlatButton(
+ TextButton(
onPressed: ()async{
Navigator.pop(context,true);
},
child: Text('Next'),
),
- FlatButton(
+ TextButton(
onPressed: ()async{
Navigator.pop(context,false);
},
@@ -418,13 +418,13 @@ class _HomeState extends State {
})),
),
actions: [
- FlatButton(
+ TextButton(
onPressed: ()async{
Navigator.pop(context,true);
},
child: Text('Get'),
),
- FlatButton(
+ TextButton(
onPressed: ()async{
Navigator.pop(context,false);
},
@@ -512,7 +512,7 @@ class _HomeState extends State {
child: InkWell(
onTap: ()async{
await Future.delayed(Duration(milliseconds: 300));
- Directory documentsDirectory = await getExternalStorageDirectory();
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "assets.db");
File db = File(path);
if(db.existsSync()) Navigator.pushNamed(context, '/stocking');
@@ -544,7 +544,7 @@ class _HomeState extends State {
InkWell(
onTap: ()async{
final file = File(
- "${(await getExternalStorageDirectory()).path}/assets.db");
+ "${(await getApplicationDocumentsDirectory()).path}/assets.db");
if(file.existsSync()){
TextEditingController sendingUser = new TextEditingController();
sendingUser.text = prefs.getString(keyClass.user)??'';
@@ -557,7 +557,7 @@ class _HomeState extends State {
controller: sendingUser,
),
actions: [
- FlatButton(
+ TextButton(
child: Text('Send'),
onPressed: ()async{
if(sendingUser.text!='') Navigator.pop(context,true);
@@ -631,7 +631,7 @@ class _HomeState extends State {
),
InkWell(
onTap: ()async{
- Directory documentsDirectory = await getExternalStorageDirectory();
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "assets.db");
File db = File(path);
if(db.existsSync()) await clearData(context);
diff --git a/lib/stocking.dart b/lib/stocking.dart
index 874d8fc..1f260f2 100644
--- a/lib/stocking.dart
+++ b/lib/stocking.dart
@@ -392,7 +392,7 @@ class _StockingState extends State with TickerProviderStateMixin {
title: Text('Delete Asset?'),
content: Text("Delete this asset (${insertAsset[index].tag_number})?"),
actions: [
- FlatButton(
+ TextButton(
child: Text('Delete'),
onPressed: ()async{
var res = await DBHelper.database.deleteInsertAsset(insertAsset[index].no);
diff --git a/lib/util/dbHandler.dart b/lib/util/dbHandler.dart
index 5220c5f..604bbfb 100644
--- a/lib/util/dbHandler.dart
+++ b/lib/util/dbHandler.dart
@@ -25,7 +25,7 @@ class DBHelper{
return _db;
}
- backupDb(context) async{
+ backupDb({context}) async{
var result = {"STATUS":0,"MSG":"Backup gagal!"};
var stock_id = prefs.getString(keyClass.dbName)??'';
if(stock_id != ''){
@@ -39,9 +39,9 @@ class DBHelper{
await prefs.remove(keyClass.backup_stock_id);
if(stock_id !='' && stock_id != null ) await prefs.setString(keyClass.backup_stock_id,stock_id);
//backupDatabase
- print(["aaaaaa",dbPath]);
- String backupPath = join(dbPath.substring(0,dbPath.indexOf("/Android"))+"/Download", "${prefs.getString(keyClass.backup_stock_id)}_assets.db");
- print("bbbbbb");
+ // String backupPath = join(dbPath.substring(0,dbPath.indexOf("/Android"))+"/Download", "${prefs.getString(keyClass.backup_stock_id)}_assets.db");
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
+ String backupPath = join(documentsDirectory.path, "${prefs.getString(keyClass.backup_stock_id)}_assets.db");
File backupFile = new File(backupPath);
File dbFile = File(dbPath);
if(dbFile.existsSync()){
@@ -71,8 +71,9 @@ class DBHelper{
var result = {"STATUS":0,"MSG":"File Backup tidak ditemukan!"};
if(prefs.getString(keyClass.backup_stock_id)!=null){
await util.permissionCheck(context,pHandler.Permission.storage,()async{
- Directory documentsDirectory = await getExternalStorageDirectory();
- String backupPath = join(documentsDirectory.path.substring(0,documentsDirectory.path.indexOf("/Android"))+"/Download", "${prefs.getString(keyClass.backup_stock_id)}_assets.db");
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
+ // String backupPath = join(documentsDirectory.path.substring(0,documentsDirectory.path.indexOf("/Android"))+"/Download", "${prefs.getString(keyClass.backup_stock_id)}_assets.db");
+ String backupPath = join(documentsDirectory.path, "${prefs.getString(keyClass.backup_stock_id)}_assets.db");
File backupdbFile = File(backupPath);
if(backupdbFile.existsSync()){
File dbFile = new File(join(documentsDirectory.path, "assets.db"));
@@ -88,7 +89,7 @@ class DBHelper{
}
initDb() async {
- Directory documentsDirectory = await getExternalStorageDirectory();
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "assets.db");
var theDb = await openDatabase(path, version: 1,onCreate: _onCreate);
return theDb;
@@ -102,17 +103,27 @@ class DBHelper{
}
void _onCreate(Database db, int version) async {
- Directory documentsDirectory = await getExternalStorageDirectory();
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "assets.db");
File file = File(path);
print('Database created, ${file.lengthSync()}');
}
+ autoBackup(database)async{
+ var checkCount = await database.query(tableName.insert,where: "${columnName.blob} is not null");
+ return checkCount.isNotEmpty&& checkCount.length%5==0;
+ }
+
insertAsset(Asset newAsset) async{
try{
final database = await db;
await database.rawInsert("Insert into ${tableName.insert} (${columnName.tag_number},${columnName.blob},${columnName.keterangan}) VALUES(?,?,?)", [newAsset.tag_number,newAsset.blob,newAsset.keterangan]);
await database.rawQuery("UPDATE ${tableName.ref} SET ${columnName.flag} = 'TRUE' WHERE ${columnName.tag_number} = '${newAsset.tag_number}'");
+
+ if(await autoBackup(database)){
+ backupDb();
+ }
+
return true;
}
catch(e){
@@ -125,6 +136,11 @@ class DBHelper{
try{
final database = await db;
await database.rawUpdate("Update ${tableName.insert} SET ${columnName.blob} = ?, ${columnName.tag_number} = ?, ${columnName.keterangan} = ? WHERE ${columnName.no} = ?", [newAsset.blob,newAsset.tag_number,newAsset.keterangan,newAsset.no]);
+
+ if(await autoBackup(database)){
+ backupDb();
+ }
+
return true;
}
catch(e){
diff --git a/lib/util/download_Upload_Handler.dart b/lib/util/download_Upload_Handler.dart
index 88495d9..3f9c432 100644
--- a/lib/util/download_Upload_Handler.dart
+++ b/lib/util/download_Upload_Handler.dart
@@ -49,7 +49,7 @@ class file_Trans_Handler {
_progress.add(0.0);
print('Finish Download');
final file = File(
- "${(await getExternalStorageDirectory()).path}/$fileName");
+ "${(await getApplicationDocumentsDirectory()).path}/$fileName");
await file.writeAsBytes(_bytes);
_path = file.path;
})
@@ -72,7 +72,7 @@ class file_Trans_Handler {
List _bytes = [];
_finish = false;
final file = File(
- "${(await getExternalStorageDirectory()).path}/$fileName");
+ "${(await getApplicationDocumentsDirectory()).path}/$fileName");
_total = file.lengthSync();
print(_total/1024);
try{
diff --git a/lib/util/utils.dart b/lib/util/utils.dart
index 939dc2d..24244d8 100644
--- a/lib/util/utils.dart
+++ b/lib/util/utils.dart
@@ -13,7 +13,7 @@ class Util{
permissionCheck(context,pHandler.Permission permissionType,ifGranted,{customMessage=''})async{
pHandler.PermissionStatus permission = await permissionType.status;
- if(permission!= pHandler.PermissionStatus.granted){
+ if(permission!= pHandler.PermissionStatus.granted && context != null){
if(permission== pHandler.PermissionStatus.denied || permission== pHandler.PermissionStatus.restricted){
showToast('NORMAL', '${permissionType.toString().substring(permissionType.toString().lastIndexOf('.')+1)} permission is needed$customMessage. Please grant the permission!');
await Future.delayed(Duration(seconds: 3));
diff --git a/pubspec.lock b/pubspec.lock
index 96c3288..93ca60a 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -21,7 +21,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.8.2"
+ version: "2.9.0"
barcode_scan2:
dependency: "direct main"
description:
@@ -42,21 +42,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
- charcode:
- dependency: transitive
- description:
- name: charcode
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.3.1"
+ version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
collection:
dependency: transitive
description:
@@ -133,7 +126,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.3.1"
ffi:
dependency: transitive
description:
@@ -267,14 +260,14 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.11"
+ version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.4"
+ version: "0.1.5"
matrix_gesture_detector:
dependency: "direct main"
description:
@@ -288,14 +281,14 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.1"
+ version: "1.8.2"
path_provider:
dependency: "direct main"
description:
@@ -489,7 +482,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.2"
+ version: "1.9.0"
sqflite:
dependency: "direct main"
description:
@@ -524,7 +517,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
synchronized:
dependency: transitive
description:
@@ -538,14 +531,14 @@ packages:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.4.9"
+ version: "0.4.12"
typed_data:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index e7188e6..fffd891 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -13,7 +13,7 @@ description: Application to check assets
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
-version: 1.0.4+6
+version: 1.0.5+7
environment:
sdk: ">=2.7.0 <3.0.0"