diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index b0707b2..bb34049 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -11,7 +11,7 @@
-
+
{
util.showLoading(context);
await Future.sync(()async{
try{
- Directory documentsDirectory = await getExternalStorageDirectory();
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "UnitStocking.db");
File db = File(path);
if(db.existsSync()){
@@ -105,7 +105,7 @@ class _HomePageState extends State {
if(value != null)await prefs.setString(keyClass.stock_id, value.value);
}
String stock_taking_id = prefs.getString(keyClass.stock_id);
- if(prefs.getString(keyClass.backup_stock_id) == null) prefs.setString(keyClass.backup_stock_id,stock_taking_id);
+ if(prefs.getString(keyClass.backup_stock_id) == null && stock_taking_id!= null) prefs.setString(keyClass.backup_stock_id,stock_taking_id);
if(company!=null&&stock_taking_id!=null){
var result = await util.JsonDataPostRaw({"company":company,"stockTakingId":stock_taking_id}, '${prefs.getString(keyClass.hostAddress)}/stock_taking/state/');
if(result['STATUS']==1){
@@ -125,12 +125,15 @@ class _HomePageState extends State {
lastUpload = prefs.getString(keyClass.lastUpload)??'';
WidgetsBinding.instance.addPostFrameCallback((_) async {
await _check_Update();
- 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 {
+ // dak jadi pakek external karena butuh Full acces File yang ribet ngorosnyo di appstore dan playstore
+ // final androidVersion = await DeviceInfoPlugin().androidInfo;
+ // if ((androidVersion.version.sdkInt ?? 0) >= 30) {
+ // print(1);
+ // await util.permissionCheck(this.context,pHandler.Permission.manageExternalStorage,()async{print("storage permit granted!");},customMessage: " untuk menyimpan data backup ke external storage!!");
+ // } else {
+ // print(3);
await util.permissionCheck(this.context,pHandler.Permission.storage,()async{print("storage permit granted!");},customMessage: " untuk menyimpan data backup");
- }
+ // }
});
}
@@ -263,7 +266,7 @@ class _HomePageState extends State {
items: result['DATA'].map>((item){
return DropdownMenuItem(
value: item['RETURN_VALUE'],
- child: Text(item["DISPLAY_VALUE"]),
+ child: Container(width: MediaQuery.of(context).size.width*0.55,child: Text(item["DISPLAY_VALUE"])),
);
}).toList(),
),
@@ -291,7 +294,7 @@ class _HomePageState extends State {
lastDownload = '';
timeString = '';
try{
- Directory documentsDirectory = await getExternalStorageDirectory();
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "UnitStocking.db");
File db = File(path);
if(db.existsSync()){
@@ -319,73 +322,6 @@ class _HomePageState extends State {
),
),
),
-// AlertDialog(
-// title: Text('Set Cabang'),
-// content: DropdownButtonFormField(
-// value: selected,
-// onChanged: (value){
-// setState(() {
-// selected = value;
-// });
-// },
-// items: result['DATA'].map>((item){
-// return DropdownMenuItem(
-// value: item['RETURN_VALUE'],
-// child: Text(item["DISPLAY_VALUE"]),
-// );
-// }).toList(),
-// ),
-// actions: [
-// TextButton(
-// child: Text('OK'),
-// onPressed: ()async{
-// if(selected!=prefs.getString(keyClass.cabang_id)){
-// prefs.setString(keyClass.cabang_id,selected);
-// await Future.sync(()async{
-// await prefs.remove(keyClass.lastDownload);
-// await prefs.remove(keyClass.lastUpload);
-// await prefs.remove(keyClass.targetProccess);
-// await prefs.remove(keyClass.submitProccess);
-// lastUpload = '';
-// lastDownload = '';
-// timeString = '';
-//// var result = await DBHelper.database.deleteAll();
-//// if(result!=null) {
-//// await DBHelper.database.closeDb();
-//// if(result!=null){
-// try{
-// Directory documentsDirectory = await getExternalStorageDirectory();
-// String path = join(documentsDirectory.path, "UnitStocking.db");
-// File db = File(path);
-// if(db.existsSync()){
-// db.deleteSync();
-// }
-// }
-// catch(e){
-// print(e);
-// util.showFlushbar(context, 'Failed to delete database file',color: Colors.red);
-// }
-//// }
-//// else{
-//// errMsg = 'Failed to clear unit data';
-//// }
-//// }
-//// else{
-//// errMsg = 'Failed to clear unit data';
-//// }
-// });
-// Navigator.pop(context,true);
-// }
-// else{
-// Navigator.pop(context,false);
-// }
-//// util.showLoading(context);
-//
-//// Navigator.pop(context);
-// },
-// )
-// ],
-// ),
));
}
else{
@@ -741,7 +677,7 @@ class _HomePageState extends State {
if(isRestore??false){
var response;
bool isclear;
- Directory documentsDirectory = await getExternalStorageDirectory();
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "UnitStocking.db");
File db = File(path);
if(db.existsSync()){
@@ -859,7 +795,7 @@ class _HomePageState extends State {
a.start();
await Future.delayed(Duration(milliseconds: 200));
bool isclear;
- Directory documentsDirectory = await getExternalStorageDirectory();
+ Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "UnitStocking.db");
File db = File(path);
if(db.existsSync()){
diff --git a/lib/login_page.dart b/lib/login_page.dart
index b315a70..aad6d7c 100644
--- a/lib/login_page.dart
+++ b/lib/login_page.dart
@@ -101,6 +101,7 @@ class _LoginPageState extends State {
return false;
},
child: Container(
+ padding: EdgeInsets.only(bottom: MediaQuery.of(context).size.width*0.1),
decoration: BoxDecoration(
color: Colors.white
),
@@ -200,19 +201,8 @@ class _LoginPageState extends State {
),
),
),
- SizedBox(height: 30,),
- TextButton(
- onPressed: Login,
- style: TextButton.styleFrom(
- backgroundColor: Colors.indigo,
- padding: EdgeInsets.all(15),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(100.0),
- side: BorderSide(color: Colors.indigo)
- ),
- ),
- child: Container(width: MediaQuery.of(context).size.width*0.7,child: Text('Login',textAlign: TextAlign.center,style: TextStyle(color: Colors.white,fontSize: 21),)),
- )
+ // SizedBox(height: 30,),
+
],
),
),
@@ -291,7 +281,7 @@ class _LoginPageState extends State {
},
items: cabangDrop.map>((item)=>DropdownMenuItem(
value: item['RETURN_VALUE'],
- child: Text(item["DISPLAY_VALUE"]),
+ child: Container(width: MediaQuery.of(context).size.width*0.55,child: Text(item["DISPLAY_VALUE"])),
)).toList(),
),
),
@@ -338,121 +328,22 @@ class _LoginPageState extends State {
),
),
),
+ bottomSheet:
+ Padding(
+ padding: EdgeInsets.only(bottom: MediaQuery.of(context).size.width*0.06,left: MediaQuery.of(context).size.width*0.1,right: MediaQuery.of(context).size.width*0.1),
+ child: TextButton(
+ onPressed: Login,
+ style: TextButton.styleFrom(
+ backgroundColor: Colors.indigo,
+ padding: EdgeInsets.all(15),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(100.0),
+ side: BorderSide(color: Colors.indigo)
+ ),
+ ),
+ child: Container(width: MediaQuery.of(context).size.width,child: Text('Login',textAlign: TextAlign.center,style: TextStyle(color: Colors.white,fontSize: 21),)),
+ ),
+ ),
);
-// }
-// else{
-// return WillPopScope(
-// onWillPop: ()async{
-// setState(() {
-// prefs.setBool(keyClass.logged_in, false);
-// prefs.remove(keyClass.cabang_id);
-// prefs.remove(keyClass.company);
-// prefs.remove(keyClass.loginId);
-// });
-// return false;
-// },
-// child: Material(
-// child: Container(
-// color: Colors.grey.withOpacity(0.7),
-// child: Center(
-// child: Container(
-// decoration: BoxDecoration(
-// color: Colors.white,
-// borderRadius: BorderRadius.circular(5)
-// ),
-// height: MediaQuery.of(context).size.height/3.2,
-// width: MediaQuery.of(context).size.width*0.75,
-// child: Column(
-// children: [
-// Flexible(
-// flex:3,
-// child: Container(
-// padding: EdgeInsets.only(top:10,left: 10,right: 10),
-// alignment: Alignment.center,
-// decoration: BoxDecoration(
-//// color: Colors.indigo,
-// borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5))
-// ),
-// child: Column(
-// mainAxisSize: MainAxisSize.min,
-// crossAxisAlignment: CrossAxisAlignment.center,
-// children: [
-// Icon(Icons.business,size: 70,color: Colors.indigo,),
-// SizedBox(height: 5,),
-// Text('Pilih Cabang',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16,color: Colors.indigo),)
-// ],
-// ),
-// ),
-// ),
-// Flexible(
-// flex: 1,
-// child: Container(
-// padding: EdgeInsets.only(left: 20,right: 20),
-// alignment: Alignment.centerLeft,
-// child: Theme(
-// data: ThemeData(
-// canvasColor: Colors.white,
-// primaryColor: Colors.indigo,
-// accentColor: Colors.indigo,
-// hintColor: Colors.indigo
-// ),
-// child: DropdownButtonFormField(
-// style: TextStyle(color: Colors.black.withOpacity(0.6),fontWeight: FontWeight.w500,fontSize: 14,),
-// decoration: InputDecoration(
-// contentPadding: EdgeInsets.all(8.0),
-// ),
-// value: selected,
-// onChanged: (value){
-// setState(() {
-// selected = value;
-// });
-// },
-// items: cabangDrop.map>((item)=>DropdownMenuItem(
-// value: item['RETURN_VALUE'],
-// child: Text(item["DISPLAY_VALUE"]),
-// )).toList(),
-// ),
-// ),
-// ),
-// ),
-// Flexible(
-// flex: 1,
-// child: Container(
-// child: Row(
-// mainAxisAlignment: MainAxisAlignment.end,
-// children: [
-// ButtonTheme(
-// minWidth: 10,
-// child: TextButton(
-// onPressed: (){
-// prefs.setString(keyClass.cabang_id, selected);
-// Navigator.pushNamed(context, '/home');
-// },
-// child: Text('Set',style: TextStyle(color: Colors.indigo),),
-// ),
-// ),
-// TextButton(
-// onPressed: (){
-// setState(() {
-// prefs.setBool(keyClass.logged_in, false);
-// prefs.remove(keyClass.cabang_id);
-// prefs.remove(keyClass.company);
-// prefs.remove(keyClass.loginId);
-// });
-// },
-// child: Text('Cancel',style: TextStyle(color: Colors.indigo)),
-// )
-// ],
-// ),
-// ),
-// )
-// ],
-// ),
-// ),
-// ),
-// ),
-// ),
-// );
-// }
}
}
\ No newline at end of file
diff --git a/pubspec.lock b/pubspec.lock
index 1f6de15..38c5e2d 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,7 +42,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.1"
charcode:
dependency: transitive
description:
@@ -56,7 +56,7 @@ packages:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
collection:
dependency: transitive
description:
@@ -133,7 +133,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.3.1"
ffi:
dependency: transitive
description:
@@ -281,21 +281,21 @@ 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"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.0"
oauth2:
dependency: "direct main"
description:
@@ -316,7 +316,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.1"
+ version: "1.8.2"
path_provider:
dependency: "direct main"
description:
@@ -510,7 +510,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:
@@ -545,7 +545,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
synchronized:
dependency: transitive
description:
@@ -559,14 +559,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: