Flutter app for Asset Management
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

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