diff --git a/lib/unit_details.dart b/lib/unit_details.dart index f30a665..a610a42 100644 --- a/lib/unit_details.dart +++ b/lib/unit_details.dart @@ -609,6 +609,7 @@ class _UnitDetailsState extends State { succeed = (result!=null); if(!succeed) { i = blobList.length; + errMsg = "Gagal menyimpan foto unit!"; } } if(succeed){ @@ -616,132 +617,25 @@ class _UnitDetailsState extends State { _currentUnit.flag = 'TRUE'; var result = await DBHelper.database.updateUnit(_currentUnit); succeed = (result!=null); + if(!succeed) { + errMsg = "Gagal menyimpan data unit!"; + } } } else{ succeed = false; - errMsg ='Please take all the pictures'; + errMsg ='Tolong lengkapi data foto'; } } else{ succeed = false; - errMsg ='Failed getting current location. Please check gps.'; + errMsg ='Gagal mengamil koordinat lokasi. Tolong cek gps.'; } }); Navigator.pop(context); -// if(!ModalRoute.of(context).isCurrent)Navigator.popUntil(context,ModalRoute.withName('/unitdetails') ); if(!ModalRoute.of(context).isCurrent)Navigator.pop(context); if(succeed) Navigator.pop(context,succeed); - util.showFlushbar(context, (succeed)?'Data updated':errMsg,color: (succeed)?Colors.grey:Colors.red); - -// bool valid = false; -// String errMsg= ''; -// if(widget.idInsert==null){ -// bool not_empty = (stateController.text!='-'&&mesinController.text!='-'&&tahunController.text!='-'&&kodeController.text!='-'&&colorController.text!='-'&&rangkaController.text!='-'&&tipeController.text!='-'); -// if(not_empty&&images.length==jenisLength){ -// valid = true; -// } -// else{ -// if(!not_empty) errMsg='Please fill all the Unit details'; -// else errMsg='You must atleast take required pictures of unit'; -// } -// } -// else{ -// checkChanges(); -// valid = true; -// } -// if(valid){ -// bool succeed = false; -// util.showLoading(context); -// await Future.sync(()async{ -// if(currentPosisiton!=null){ -// if(widget.idInsert==null){ -// var result = await DBHelper.database.checkUnitbyMesin(mesinController.text.replaceAll('-', '')); -// if(result==0){ -// insertUnit input = new insertUnit( -// mesin: mesinController.text, -// timestamp:DateFormat('dd-MM-yyyy HH:mm:ss').format(DateTime.now()), -// ); -// var insertID = await DBHelper.database.newInsertUnit(input); -// if(insertID!=null){ -// for(int i=0;i