Flutter app for Asset Management
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

687 lignes
34 KiB

  1. import 'dart:async';
  2. import 'dart:convert';
  3. import 'dart:io';
  4. import 'package:assetstock/util/download_Upload_Handler.dart';
  5. import 'package:flutter/services.dart';
  6. import 'package:path/path.dart';
  7. import 'package:flutter/cupertino.dart';
  8. import 'package:flutter/material.dart';
  9. import 'package:path_provider/path_provider.dart';
  10. import 'main.dart';
  11. import 'util/prefsKey.dart';
  12. import 'util/dbHandler.dart';
  13. import 'package:permission_handler/permission_handler.dart' as pHandler;
  14. import 'package:device_info_plus/device_info_plus.dart';
  15. class Home extends StatefulWidget {
  16. Home({Key key}) : super(key: key);
  17. @override
  18. _HomeState createState() => _HomeState();
  19. }
  20. class _HomeState extends State<Home> {
  21. List<Widget> Menus = [];
  22. final hostAddress = new TextEditingController();
  23. StreamSubscription _dlulStream;
  24. double progress,progressDL;
  25. loadMenu()async{
  26. Menus.add(Padding(
  27. padding: const EdgeInsets.all(8.0),
  28. child: Container(
  29. decoration: BoxDecoration(
  30. color: Colors.white,
  31. borderRadius: BorderRadius.circular(5)
  32. ),
  33. child: Text('Get Data'),
  34. ),
  35. ));
  36. setState(() {
  37. });
  38. }
  39. @override
  40. void initState() {
  41. // TODO: implement initState
  42. super.initState();
  43. WidgetsBinding.instance.addPostFrameCallback((_) async {
  44. // await loadMenu();
  45. // final androidVersion = await DeviceInfoPlugin().androidInfo;
  46. // if ((androidVersion.version.sdkInt ?? 0) >= 30) {
  47. // await util.permissionCheck(this.context,pHandler.Permission.manageExternalStorage,()async{print("storage permit granted!");},customMessage: " untuk menyimpan data backup");
  48. // } else {
  49. await util.permissionCheck(this.context,pHandler.Permission.storage,()async{print("storage permit granted!");},customMessage: " untuk menyimpan data backup");
  50. // }
  51. });
  52. }
  53. clearData(context)async{
  54. String errMsg;
  55. Directory documentsDirectory = await getApplicationDocumentsDirectory();
  56. String path = join(documentsDirectory.path, "assets.db");
  57. File db = File(path);
  58. if(db.existsSync()){
  59. bool result = await showDialog(context: context,builder: (context)=>WillPopScope(
  60. onWillPop: ()async{
  61. Navigator.pop(context,false);
  62. return false;
  63. },
  64. child: AlertDialog(
  65. title: Text('Clear Data ?'),
  66. content: Text('Proceed to clear any remaining units data on this device?'),
  67. actions: <Widget>[
  68. TextButton(
  69. child: Text('Proceed'),
  70. onPressed: ()async{
  71. util.showLoading(context);
  72. await Future.sync(()async{
  73. await prefs.remove(keyClass.dbName);
  74. // await prefs.setString(keyClass.lastDownload, null);
  75. // await prefs.setString(keyClass.lastUpload, null);
  76. // await prefs.setString(keyClass.targetProccess, null);
  77. setState(() {
  78. // lastUpload = '';
  79. // lastDownload = '';
  80. // timeString = '';
  81. });
  82. // var result = await DBHelper.database.deleteAll();
  83. // if(result!=null) {
  84. // if(result!=null){
  85. try{
  86. await DBHelper.database.closeDb();
  87. db.deleteSync();
  88. }
  89. catch(e){
  90. print(e);
  91. util.showToast('ERROR','Failed to delete database file');
  92. }
  93. // }
  94. // else{
  95. // errMsg = 'Failed to clear unit data';
  96. // }
  97. // }
  98. // else{
  99. // errMsg = 'Failed to clear unit data';
  100. // }
  101. });
  102. Navigator.pop(context);
  103. Navigator.pop(context,true);
  104. util.showToast(errMsg==null?"SUCCESS":"ERROR",errMsg??'Data Cleared');
  105. },
  106. ),
  107. TextButton(
  108. child: Text('Cancel'),
  109. onPressed: (){Navigator.pop(context,false);},
  110. )
  111. ],
  112. ),
  113. ));
  114. return result;
  115. }
  116. else return true;
  117. }
  118. @override
  119. Widget build(BuildContext context) {
  120. return Scaffold(
  121. floatingActionButton: Padding(
  122. padding: const EdgeInsets.only(bottom:45.0),
  123. child: FloatingActionButton(
  124. onPressed: ()async{
  125. Directory documentsDirectory = await getApplicationDocumentsDirectory();
  126. String path = join(documentsDirectory.path, "assets.db");
  127. File db = File(path);
  128. if(db.existsSync()){
  129. Navigator.pushNamed(context, '/logs');
  130. }
  131. else{
  132. util.showToast("ALERT", 'Get data Master first');
  133. }
  134. },
  135. child: Icon(Icons.description,size: 30,),
  136. ),
  137. ),
  138. body: Container(
  139. color: Colors.grey.withOpacity(0.3),
  140. child:
  141. // (Menus.length==0)?Container(alignment: Alignment.center,
  142. // child: Text('Empty',
  143. // style: TextStyle(fontSize: 20,color: Colors.black38,fontWeight: FontWeight.bold),),)
  144. // :
  145. Column(
  146. children: <Widget>[
  147. Expanded(
  148. flex: 1,
  149. child: Container(
  150. padding: const EdgeInsets.only(left: 10,top:10,right: 5),
  151. alignment: Alignment.bottomCenter,
  152. child: Row(
  153. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  154. children: <Widget>[
  155. Row(
  156. children: <Widget>[
  157. Icon(Icons.dashboard,color: Colors.blueGrey,size: 20,),
  158. SizedBox(width: 5,),
  159. Text('Menu')
  160. ],
  161. ),
  162. PopupMenuButton(
  163. itemBuilder: (context)=>[
  164. PopupMenuItem(
  165. value: "changeAddress",
  166. child: Row(
  167. children: <Widget>[
  168. Icon(Icons.network_wifi,color: Colors.blueGrey,),
  169. SizedBox(width: 10,),
  170. Text('Change Host Address',style: TextStyle(color: Colors.blueGrey,fontWeight: FontWeight.w500),)
  171. ],
  172. ),
  173. ),
  174. PopupMenuItem(
  175. value:'backup',
  176. child: Row(
  177. children: <Widget>[
  178. Icon(Icons.save,color: Colors.black,),
  179. SizedBox(width: 10,),
  180. Text('Backup Data')
  181. ],
  182. ),
  183. ),
  184. PopupMenuItem(
  185. value:'restore',
  186. child: Row(
  187. children: <Widget>[
  188. Icon(Icons.sync,color: Colors.black,),
  189. SizedBox(width: 10,),
  190. Text('Restore Data')
  191. ],
  192. ),
  193. ),
  194. ],
  195. onSelected: (value)async{
  196. if(value == "changeAddress"){
  197. hostAddress.text = prefs.getString(keyClass.hostAddress)??'https://asset.thamringroup.web.id';
  198. await showDialog(context: context,builder: (context)=>AlertDialog(
  199. title: Text('Set IP Address'),
  200. content: TextField(
  201. controller: hostAddress,
  202. onSubmitted: (value){
  203. prefs.setString(keyClass.hostAddress,(value=='')?'https://asset.thamringroup.web.id':value);
  204. Navigator.pop(context);
  205. },
  206. ),
  207. actions: <Widget>[
  208. TextButton(
  209. child: Text('OK'),
  210. onPressed: (){
  211. prefs.setString(keyClass.hostAddress,(hostAddress.text=='')?'https://asset.thamringroup.web.id':hostAddress.text);
  212. Navigator.pop(context);
  213. },
  214. )
  215. ],
  216. ));
  217. setState(() {
  218. });
  219. }
  220. if(value == 'backup'){
  221. if(prefs.getString(keyClass.dbName) != null){
  222. bool isBackup = await showDialog(context: context,builder: (context)=>AlertDialog(
  223. title: Text('Backup Data ?'),
  224. content: Text('Backup data akan menghapus dan mengganti data backup unit dan cabang sebelumnya.'),
  225. actions: <Widget>[
  226. TextButton(
  227. child: Text('OK'),
  228. onPressed: ()async{
  229. Navigator.pop(context,true);
  230. },
  231. ),
  232. TextButton(
  233. child: Text('Cancel'),
  234. onPressed: ()=>Navigator.pop(context,false),
  235. )
  236. ],
  237. ));
  238. if(isBackup??false){
  239. var result = await DBHelper.database.backupDb(context:context);
  240. util.showToast(result["STATUS"]==1?'NORMAL':'ERROR', result['MSG']);
  241. }
  242. }
  243. else{
  244. util.showToast('ERROR', "Data Unit cabang tidak ditemukan. Silakan get data terlbih dahulu.");
  245. }
  246. }
  247. if(value == 'restore'){
  248. if(prefs.getString(keyClass.dbName) == null){
  249. util.showToast('ERROR', "Data Unit cabang tidak ditemukan. Silakan get data terlbih dahulu.");
  250. }
  251. else{
  252. if(prefs.getString(keyClass.dbName) == prefs.getString(keyClass.backup_stock_id)){
  253. String stock_taking_id = prefs.getString(keyClass.dbName);
  254. if(stock_taking_id!=null){
  255. bool isRestore = await showDialog(context: context,builder: (context)=>AlertDialog(
  256. title: Text('Restore Data ?'),
  257. content: Text('Restore data akan menghapus dan mengganti data unit dan cabang yang ada dengan data backup.'),
  258. actions: <Widget>[
  259. TextButton(
  260. child: Text('OK'),
  261. onPressed: ()async{
  262. Navigator.pop(context,true);
  263. },
  264. ),
  265. TextButton(
  266. child: Text('Cancel'),
  267. onPressed: ()=>Navigator.pop(context,false),
  268. )
  269. ],
  270. ));
  271. if(isRestore??false){
  272. var response;
  273. bool isclear;
  274. Directory documentsDirectory = await getApplicationDocumentsDirectory();
  275. String path = join(documentsDirectory.path, "assets.db");
  276. File db = File(path);
  277. if(db.existsSync()){
  278. isclear = await clearData(context);
  279. }
  280. else{
  281. isclear = true;
  282. }
  283. if(isclear??false){
  284. var result = await DBHelper.database.restoreDb(context);
  285. if(result["STATUS"]==1){
  286. // await prefs.remove(keyClass.lastDownload);
  287. // await prefs.remove(keyClass.lastUpload);
  288. // await prefs.remove(keyClass.targetProccess);
  289. // await prefs.remove(keyClass.submitProccess);
  290. setState(() {
  291. // lastUpload = '';
  292. // lastDownload = '';
  293. // timeString = '';
  294. });
  295. // valueTab value = await DBHelper.database.getValue(keyClass.tgl_start);
  296. // if(value != null)await prefs.setString(keyClass.lastDownload, DateFormat('dd-MM-yyyy HH:mm:ss').parse(value.value).toIso8601String());
  297. // else {
  298. // await prefs.setString(keyClass.lastDownload, DateTime.now().toIso8601String());
  299. // }
  300. // value = await DBHelper.database.getValue(keyClass.stock_id);
  301. // if(value != null) await prefs.setString(keyClass.stock_id,value.value);
  302. // else {
  303. await prefs.setString(keyClass.dbName,prefs.getString(keyClass.backup_stock_id));
  304. // }
  305. // loadState();
  306. setState(() {
  307. // lastDownload = prefs.getString(keyClass.lastDownload);
  308. });
  309. }
  310. response = result["MSG"];
  311. }
  312. if(response != null)util.showToast('GENERAL', response);
  313. }
  314. }
  315. }
  316. else {
  317. util.showToast("ERROR", "File Backup tidak ditemukan atau sudah selesai");
  318. }
  319. }
  320. }
  321. },
  322. child: Padding(
  323. padding: const EdgeInsets.all(8.0),
  324. child: Icon(Icons.clear_all,color: Colors.blueGrey,size: 20,),
  325. ),
  326. ),
  327. ],
  328. ),
  329. ),
  330. ),
  331. Flexible(
  332. flex: 10,
  333. child: Container(
  334. alignment: Alignment.topCenter,
  335. child: GridView.count(
  336. padding: EdgeInsets.all(0),
  337. crossAxisCount: 2,
  338. children: [
  339. InkWell(
  340. onTap: ()async{
  341. String Address = prefs.getString(keyClass.hostAddress);
  342. // await Future.delayed(Duration(milliseconds: 300));
  343. util.showLoading(context,dissmissable: false);
  344. var bUnits = await util.JsonDataPostRaw({}, "${Address??"https://asset.thamringroup.web.id"}/admin/getBisnisList",timeout: true,duration: 5);
  345. Navigator.pop(context);
  346. if(bUnits["STATUS"]==1){
  347. var selectedBisnis= bUnits["DATA"][0]["id"];
  348. var bisnisPicked = await showDialog(context: context,builder: (context)=>StatefulBuilder(
  349. builder: (context,setState)=>AlertDialog(
  350. title: Text('Pick Bisnis Unit'),
  351. content: DropdownButtonFormField(
  352. onChanged: (value)async{
  353. setState(() {
  354. selectedBisnis = value;
  355. });
  356. },
  357. value: selectedBisnis,
  358. items: new List<DropdownMenuItem<dynamic>>.from(bUnits['DATA'].map((value){
  359. String showText = value["name"];
  360. if(showText.length>30) showText = showText.substring(0,30);
  361. return DropdownMenuItem(
  362. child: Text(showText),
  363. value: value["id"],
  364. );
  365. })),
  366. ),
  367. actions: <Widget>[
  368. TextButton(
  369. onPressed: ()async{
  370. Navigator.pop(context,true);
  371. },
  372. child: Text('Next'),
  373. ),
  374. TextButton(
  375. onPressed: ()async{
  376. Navigator.pop(context,false);
  377. },
  378. child: Text('Cancel'),
  379. )
  380. ],
  381. ),
  382. ));
  383. if(bisnisPicked??false){
  384. util.showLoading(context,dissmissable: false);
  385. var result = await util.JsonDataPostRaw({"bUnit":selectedBisnis}, "${Address??"https://asset.thamringroup.web.id"}/admin/getrefDbList");
  386. Navigator.pop(context);
  387. if(result['STATUS']==1){
  388. bool isClear = await clearData(context);
  389. if(isClear??false){
  390. String selected = result['DATA'][0]["fullName"];
  391. bool res =await showDialog(context: context,builder: (context)=>StatefulBuilder(
  392. builder: (context,setState)=>AlertDialog(
  393. title: Text('Pick Database'),
  394. content: DropdownButtonFormField(
  395. onChanged: (value){
  396. setState(() {
  397. selected = value;
  398. });
  399. },
  400. value: selected,
  401. items: new List<DropdownMenuItem<dynamic>>.from(result['DATA'].map((value){
  402. String showText = value["name"];
  403. if(showText.length>20) showText = showText.substring(0,20);
  404. return DropdownMenuItem(
  405. child: Text(showText),
  406. value: value["fullName"],
  407. );
  408. })),
  409. ),
  410. actions: <Widget>[
  411. TextButton(
  412. onPressed: ()async{
  413. Navigator.pop(context,true);
  414. },
  415. child: Text('Get'),
  416. ),
  417. TextButton(
  418. onPressed: ()async{
  419. Navigator.pop(context,false);
  420. },
  421. child: Text('Cancel'),
  422. )
  423. ],
  424. ),
  425. ));
  426. if(res??false){
  427. // util.showLoading(context,dissmissable: false);
  428. await prefs.setString(keyClass.dbName,selected);
  429. file_Trans_Handler trans = new file_Trans_Handler();
  430. await trans.downloadFile("assets.db", "${Address??"https://asset.thamringroup.web.id"}/admin/downloadDb/$selectedBisnis/$selected");
  431. _dlulStream = trans.progress.listen((value)async {
  432. setState(() {
  433. progressDL = (value!=-1.0)?value:null;
  434. });
  435. if(value!=null&&value >= 1.0) {
  436. _dlulStream.cancel();
  437. progressDL = null;
  438. // setState(() {
  439. // lastDownload = DateTime.now().toIso8601String();
  440. // });
  441. // await prefs.setString(keyClass.lastDownload, lastDownload);
  442. // await DBHelper.database.insertUpdateValue(new valueTab(name: 'TGL_START',value: DateFormat('dd-MM-yyyy HH:mm:ss').format(DateTime.parse(lastDownload))));
  443. // await DBHelper.database.insertUpdateValue(new valueTab(name: 'TGL_STOCK_TAKING',value: DateFormat('dd-MM-yyyy').format(DateTime.parse(lastDownload))));
  444. // await DBHelper.database.closeDb();
  445. // var allUnits = await DBHelper.database.getAllAsset();
  446. // print('${allUnits.length} Units');
  447. if(prefs.getString(keyClass.backup_stock_id) == null) prefs.setString(keyClass.backup_stock_id,selected);
  448. util.showToast('ALERT','Data Downloaded');
  449. }
  450. if(value==-1.0){
  451. util.showToast('ALERT','Data Error ${trans.error}');
  452. }
  453. });
  454. // Navigator.pop(context);
  455. setState(() {
  456. });
  457. }
  458. }
  459. }
  460. else{
  461. await util.showToast("ERROR",result['ERROR']??"Database tidak ditemukan");
  462. }
  463. }
  464. }
  465. else{
  466. await util.showToast("ERROR",bUnits['DATA']??'not responding');
  467. }
  468. },
  469. child: Padding(
  470. padding: const EdgeInsets.only(left: 10,top:10,right: 5),
  471. child: Container(
  472. decoration: BoxDecoration(
  473. color: Colors.white,
  474. borderRadius: BorderRadius.circular(10)
  475. ),
  476. child: Column(
  477. mainAxisAlignment: MainAxisAlignment.center,
  478. children: <Widget>[
  479. Expanded(
  480. flex: 4,
  481. child: Container(alignment: Alignment.center,child: (progressDL==null)?Icon(Icons.add_to_home_screen,size: 100,color: Colors.blueGrey,):Stack(
  482. children: <Widget>[
  483. Container(width: 100,height: 100,child: CircularProgressIndicator(backgroundColor: Color(0xFFB4B4B4),valueColor:new AlwaysStoppedAnimation<Color>(Colors.blueGrey),value: progressDL,)),
  484. Container(width: 100,height: 100,alignment: Alignment.center,child: Text("${(progressDL*100).floor().toString()}%",style: TextStyle(color: Colors.blueGrey,fontWeight: FontWeight.bold,fontSize: 25),),)
  485. ],
  486. )),
  487. ),
  488. Flexible(
  489. flex: 2,
  490. child: Text('Get Data Master',style: TextStyle(color: Colors.blueGrey,fontSize: 18,fontWeight: FontWeight.bold),),
  491. ),
  492. ],
  493. ),
  494. ),
  495. ),
  496. ),
  497. Padding(
  498. padding: const EdgeInsets.only(left: 5,top:10,right: 10),
  499. child: Material(
  500. color: Colors.white,
  501. child: InkWell(
  502. onTap: ()async{
  503. await Future.delayed(Duration(milliseconds: 300));
  504. Directory documentsDirectory = await getApplicationDocumentsDirectory();
  505. String path = join(documentsDirectory.path, "assets.db");
  506. File db = File(path);
  507. if(db.existsSync()) Navigator.pushNamed(context, '/stocking');
  508. else{
  509. util.showToast('Alert', 'Please download data master first');
  510. }
  511. },
  512. child: Container(
  513. decoration: BoxDecoration(
  514. borderRadius: BorderRadius.circular(10)
  515. ),
  516. child: Column(
  517. mainAxisAlignment: MainAxisAlignment.center,
  518. children: <Widget>[
  519. Expanded(
  520. flex: 4,
  521. child: Container(alignment: Alignment.center,child: Icon(Icons.aspect_ratio,size: 100,color: Colors.blueGrey,)),
  522. ),
  523. Flexible(
  524. flex: 2,
  525. child: Text('Start Stocking',style: TextStyle(color: Colors.blueGrey,fontSize: 18,fontWeight: FontWeight.bold),),
  526. ),
  527. ],
  528. ),
  529. ),
  530. ),
  531. ),
  532. ),
  533. InkWell(
  534. onTap: ()async{
  535. final file = File(
  536. "${(await getApplicationDocumentsDirectory()).path}/assets.db");
  537. if(file.existsSync()){
  538. TextEditingController sendingUser = new TextEditingController();
  539. sendingUser.text = prefs.getString(keyClass.user)??'';
  540. bool isUserDefined = await showDialog(context: context,
  541. barrierDismissible: false,
  542. builder: (context)=>AlertDialog(
  543. title: Text('Sender'),
  544. content: TextField(
  545. inputFormatters: [FilteringTextInputFormatter.allow(RegExp("[a-zA-Z0-9 ]"))],
  546. controller: sendingUser,
  547. ),
  548. actions: [
  549. TextButton(
  550. child: Text('Send'),
  551. onPressed: ()async{
  552. if(sendingUser.text!='') Navigator.pop(context,true);
  553. else Navigator.pop(context,false);
  554. },
  555. )
  556. ],
  557. ));
  558. if(isUserDefined??false){
  559. prefs.setString(keyClass.user, sendingUser.text);
  560. util.showToast("ALERT",'Preparing Data');
  561. await DBHelper.database.setOpenState();
  562. await DBHelper.database.closeDb();
  563. file_Trans_Handler trans = new file_Trans_Handler();
  564. util.showToast("ALERT",'Sending Data');
  565. setState(() {
  566. progress = 0;
  567. });
  568. trans.uploadFile("assets.db", "${prefs.getString(keyClass.hostAddress)??"https://asset.thamringroup.web.id"}/admin/uploadSqliteDb",sendingUser.text,context);
  569. _dlulStream = trans.progress.listen((value) async {
  570. setState(() {
  571. progress = (value!=-1.0)?value:null;
  572. });
  573. if(value!=null&&value >= 1.0) {
  574. if(trans.error==''&&trans.isFinish){
  575. _dlulStream.cancel();
  576. progress = null;
  577. util.showToast("SUCCESS",(trans.success!='')?trans.success:'Data uploaded');
  578. }
  579. }
  580. if(value==-1.0&&trans.isFinish){
  581. _dlulStream.cancel();
  582. progress = null;
  583. util.showToast("ERROR",'Data upload error. ${trans.error}');
  584. }
  585. });
  586. }
  587. else util.showToast("ALERT",'Sending user not filled');
  588. }
  589. else{
  590. util.showToast("ALERT",'No database file found');
  591. }
  592. },
  593. child: Padding(
  594. padding: const EdgeInsets.only(left: 10,top:10,right: 5),
  595. child: Container(
  596. decoration: BoxDecoration(
  597. color: Colors.white,
  598. borderRadius: BorderRadius.circular(10)
  599. ),
  600. child: Column(
  601. mainAxisAlignment: MainAxisAlignment.center,
  602. children: <Widget>[
  603. Expanded(
  604. flex: 4,
  605. child: Container(alignment: Alignment.center,child: (progress==null)?Icon(Icons.send,size: 100,color: Colors.blueGrey,):Stack(
  606. children: <Widget>[
  607. Container(width: 100,height: 100,child: CircularProgressIndicator(backgroundColor: Color(0xFFB4B4B4),valueColor:new AlwaysStoppedAnimation<Color>(Colors.blueGrey),value: progress,)),
  608. Container(width: 100,height: 100,alignment: Alignment.center,child: Text("${(progress*100).floor().toString()}%",style: TextStyle(color: Colors.blueGrey,fontWeight: FontWeight.bold,fontSize: 25),),)
  609. ],
  610. )),
  611. ),
  612. Flexible(
  613. flex: 2,
  614. child: Text('Send Data',style: TextStyle(color: Colors.blueGrey,fontSize: 18,fontWeight: FontWeight.bold),),
  615. ),
  616. ],
  617. ),
  618. ),
  619. ),
  620. ),
  621. InkWell(
  622. onTap: ()async{
  623. Directory documentsDirectory = await getApplicationDocumentsDirectory();
  624. String path = join(documentsDirectory.path, "assets.db");
  625. File db = File(path);
  626. if(db.existsSync()) await clearData(context);
  627. else util.showToast('Alert', 'No database file found');
  628. },
  629. child: Padding(
  630. padding: const EdgeInsets.only(left: 5,top:10,right: 10),
  631. child: Container(
  632. decoration: BoxDecoration(
  633. color: Colors.white,
  634. borderRadius: BorderRadius.circular(10)
  635. ),
  636. child: Column(
  637. mainAxisAlignment: MainAxisAlignment.center,
  638. children: <Widget>[
  639. Expanded(
  640. flex: 4,
  641. child: Container(alignment: Alignment.center,child: Icon(Icons.delete,size: 100,color: Colors.blueGrey,)),
  642. ),
  643. Flexible(
  644. flex: 2,
  645. child: Text('Clear Data',style: TextStyle(color: Colors.blueGrey,fontSize: 18,fontWeight: FontWeight.bold),),
  646. ),
  647. ],
  648. ),
  649. ),
  650. ),
  651. ),
  652. ],
  653. ),
  654. ),
  655. ),
  656. Flexible(
  657. flex: 2,
  658. child: Container(
  659. padding: EdgeInsets.all(8),
  660. alignment: Alignment.bottomRight,
  661. child: Column(
  662. crossAxisAlignment: CrossAxisAlignment.end,
  663. mainAxisAlignment: MainAxisAlignment.end,
  664. children: <Widget>[
  665. Text((prefs.getString(keyClass.dbName)!=null)?"Master Data : ${prefs.getString(keyClass.dbName)}":'',style: TextStyle(color: Colors.blueGrey),),
  666. Text('Connected to ${prefs.getString(keyClass.hostAddress)??'https://asset.thamringroup.web.id'}',style: TextStyle(color: Colors.blueGrey),),
  667. ],
  668. ),
  669. ),
  670. ),
  671. ],
  672. ),
  673. ),
  674. );
  675. }
  676. }