Flutter app for Asset Management
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

959 строки
65 KiB

  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'main.dart';
  4. import 'util/Models.dart';
  5. import 'util/dbHandler.dart';
  6. import 'asset_details.dart';
  7. class Stocking extends StatefulWidget {
  8. Stocking({Key key}) : super(key: key);
  9. @override
  10. _StockingState createState() => _StockingState();
  11. }
  12. class _StockingState extends State<Stocking> with TickerProviderStateMixin {
  13. final searchCon = new TextEditingController();
  14. String search = '';
  15. TabController _tabController;
  16. List<Asset> refAsset = [];
  17. List<Asset> insertAsset = [];
  18. bool isLoading = false;
  19. List<String> lokasi = [];
  20. List<String> ruangan = [];
  21. String _currentloc='All';
  22. String _currentruang='All';
  23. loadAsset({loading=false})async{
  24. if(loading) {
  25. setState(() {
  26. isLoading = true;
  27. });
  28. }
  29. var result = (search=='')?await DBHelper.database.getAllAsset():await DBHelper.database.filterAllAsset(search.toUpperCase());
  30. if(result!=null){
  31. if(_currentloc!='All') result.removeWhere((element) => (element.lantai!=_currentloc));
  32. if(_currentruang!='All') result.removeWhere((element) => (element.ruangan!=_currentruang));
  33. setState(() {
  34. refAsset = result;
  35. });
  36. // print(result.length);
  37. }
  38. result = (search=='')?await DBHelper.database.getAllInsertAsset():await DBHelper.database.filterAllInsertAsset(search.toUpperCase());
  39. if(result!=null){
  40. print(result.length);
  41. if(_currentloc!='All'){
  42. if(_currentloc!='Appended'){
  43. result.removeWhere((element) => (element.lantai!=_currentloc));
  44. }
  45. else{
  46. result.removeWhere((element) => (element.asset_desc!=''));
  47. }
  48. }
  49. if(_currentruang!='All') result.removeWhere((element) => (element.ruangan!=_currentruang));
  50. setState(() {
  51. insertAsset = result.reversed.toList();
  52. });
  53. }
  54. if(lokasi.length==0){
  55. var results = await DBHelper.database.getAllLocation();
  56. if(results!=null){
  57. lokasi.clear();
  58. lokasi = new List<String>.from(results.map((item)=>item.lantai));
  59. lokasi.add('Appended');
  60. lokasi.add('All');
  61. }
  62. }
  63. ruangan.clear();
  64. var results = (_currentloc=='All')?await DBHelper.database.getAllRuangan():await DBHelper.database.getLantaiRuangan(_currentloc);
  65. setState(() {
  66. if(results!=null){
  67. ruangan = new List<String>.from(results.map((item)=>item.ruangan));
  68. ruangan.add('All');
  69. }
  70. });
  71. if(loading) {
  72. setState(() {
  73. isLoading = false;
  74. });
  75. }
  76. }
  77. @override
  78. void initState() {
  79. // TODO: implement initState
  80. super.initState();
  81. _tabController = new TabController(length: 2, vsync: this);
  82. loadAsset(loading: true);
  83. }
  84. @override
  85. Widget build(BuildContext context) {
  86. return Scaffold(
  87. resizeToAvoidBottomInset: false,
  88. body: Stack(
  89. children: <Widget>[
  90. Container(
  91. padding: EdgeInsets.only(top: 10),
  92. color: Colors.grey.withOpacity(0.3),
  93. child: Column(
  94. children: <Widget>[
  95. Expanded(
  96. flex: 2,
  97. child: Container(
  98. alignment: Alignment.bottomCenter,
  99. padding: const EdgeInsets.all(8.0),
  100. child: Container(
  101. decoration: BoxDecoration(
  102. color: Colors.white,
  103. borderRadius: BorderRadius.circular(20),
  104. ),
  105. // padding: EdgeInsets.all(8),
  106. child: TextField(
  107. controller: searchCon,
  108. onSubmitted: (value)async{
  109. setState(() {
  110. search = value;
  111. // searchCon.text = value;
  112. });
  113. await loadAsset(loading: true);
  114. },
  115. decoration: InputDecoration(
  116. border: InputBorder.none,
  117. focusedBorder: InputBorder.none,
  118. enabledBorder: InputBorder.none,
  119. errorBorder: InputBorder.none,
  120. disabledBorder: InputBorder.none,
  121. suffixIcon: InkWell(
  122. onTap: ()async{
  123. var result = await util.scan();
  124. if(result['STATUS']==1){
  125. searchCon.text = result['DATA'];
  126. search = searchCon.text;
  127. await loadAsset();
  128. setState(() {
  129. });
  130. }
  131. },
  132. child: Icon(Icons.center_focus_strong,color: Colors.blueGrey,)),
  133. contentPadding: EdgeInsets.only(left: 10,right: 10,top: 15,bottom: 15),
  134. hintText: "Search Tag Number"
  135. ),
  136. ),
  137. ),
  138. ),
  139. ),
  140. Expanded(
  141. flex: 1,
  142. child: Container(
  143. alignment: Alignment.bottomCenter,
  144. padding: const EdgeInsets.all(8.0),
  145. child: Container(
  146. // padding: EdgeInsets.all(8),
  147. child: Row(
  148. children: [
  149. Container(
  150. child: Text("Lantai : ",style: TextStyle(fontSize: 16),),
  151. ),
  152. Container(
  153. width: 100,
  154. child: DropdownButtonFormField(
  155. decoration: InputDecoration.collapsed(hintText: null),
  156. value: _currentloc,
  157. items: new List<DropdownMenuItem<String>>.from(lokasi.reversed.map((value){
  158. return DropdownMenuItem(
  159. child: Text(value),
  160. value: value,
  161. );
  162. })),
  163. onChanged: (value){
  164. if(_currentloc!= value){
  165. setState(() {
  166. _currentruang = 'All';
  167. _currentloc=value;
  168. });
  169. loadAsset(loading: true);
  170. }
  171. },
  172. ),
  173. ),
  174. Container(
  175. child: Text("Ruang : ",style: TextStyle(fontSize: 16)),
  176. ),
  177. Expanded(
  178. child: DropdownButtonFormField(
  179. decoration: InputDecoration.collapsed(hintText: null),
  180. value: _currentruang,
  181. items: new List<DropdownMenuItem<String>>.from(ruangan.reversed.map((value){
  182. String _string = value;
  183. if(_string.length>18) _string = _string.substring(0,18);
  184. return DropdownMenuItem(
  185. child: Text(_string),
  186. value: value,
  187. );
  188. })),
  189. onChanged: (value){
  190. setState(() {
  191. _currentruang=value;
  192. });
  193. loadAsset(loading: true);
  194. },
  195. ),
  196. ),
  197. ],
  198. ),
  199. ),
  200. ),
  201. ),
  202. Expanded(
  203. flex:16,
  204. child: Column(
  205. children: <Widget>[
  206. Flexible(
  207. flex: 1,
  208. child: Stack(
  209. children: <Widget>[
  210. Positioned.fill(child: Row(
  211. children: <Widget>[
  212. Expanded(
  213. flex:1,
  214. child: Container(
  215. alignment: Alignment.center,
  216. child:(insertAsset.length==0)?null:Row(
  217. mainAxisSize: MainAxisSize.min,
  218. children: <Widget>[
  219. Padding(
  220. padding: const EdgeInsets.all(10.0),
  221. child: Text('Completed ',style: TextStyle(fontSize: 18,color: Colors.transparent),),
  222. ),
  223. Container(padding: EdgeInsets.all(8),
  224. decoration: BoxDecoration(
  225. shape: BoxShape.circle,
  226. color: Colors.green,
  227. ),
  228. child: Text('${insertAsset.length}',style: TextStyle(color: Colors.white,fontSize: 14/(insertAsset.length.toString().length/10+1)),)),
  229. ],
  230. )
  231. ),
  232. ),
  233. Expanded(
  234. flex:1,
  235. child: Container(
  236. alignment: Alignment.center,
  237. child:(refAsset.length==0)?null:Row(
  238. mainAxisSize: MainAxisSize.min,
  239. children: <Widget>[
  240. Padding(
  241. padding: const EdgeInsets.all(10.0),
  242. child: Text('InProgress ',style: TextStyle(fontSize: 18,color: Colors.transparent),),
  243. ),
  244. Container(padding: EdgeInsets.all(8),
  245. decoration: BoxDecoration(
  246. shape: BoxShape.circle,
  247. color: Colors.red,
  248. ),
  249. child: Text('${refAsset.length-insertAsset.where((element) => (element.asset_desc!='')).length}',style: TextStyle(color: Colors.white,fontSize: 14/((refAsset.length-insertAsset.length).toString().length/10+1)),)),
  250. ],
  251. )
  252. ),
  253. ),
  254. ],
  255. ),),
  256. TabBar(
  257. labelColor: Colors.blueGrey,
  258. labelStyle: TextStyle(fontSize: 16,fontWeight: FontWeight.bold),
  259. unselectedLabelStyle: TextStyle(fontSize: 15),
  260. controller: _tabController,
  261. tabs: <Widget>[
  262. Tab(
  263. text: 'Completed',
  264. ),
  265. Tab(
  266. text: 'inProgress',
  267. ),
  268. ],
  269. ),
  270. ],
  271. ),
  272. ),
  273. Expanded(
  274. flex: 12,
  275. child: TabBarView(
  276. controller: _tabController,
  277. children: <Widget>[
  278. (insertAsset.length==0)?Center(child: Text('No Asset Data',style: TextStyle(color: Colors.grey,fontSize: 16,fontWeight: FontWeight.bold),),):
  279. Scrollbar(
  280. isAlwaysShown: false,
  281. child: ListView.builder(
  282. padding: EdgeInsets.all(0),
  283. itemCount: insertAsset.length,
  284. itemBuilder: (context,index){
  285. return InkWell(
  286. onTap: ()async{
  287. await Navigator.push(context, MaterialPageRoute(builder: (context) => new AssetDetails(no:insertAsset[index].no,lokasi: lokasi,)));
  288. // await Navigator.pushNamed(context, "/details");
  289. await loadAsset();
  290. },
  291. child: Padding(
  292. padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
  293. child: Container(
  294. decoration: BoxDecoration(
  295. color: Colors.white,
  296. borderRadius: BorderRadius.circular(5)
  297. ),
  298. height: 100,
  299. child: Row(
  300. children: <Widget>[
  301. Container(height: 100,width: 100,decoration:BoxDecoration(
  302. image:insertAsset[index].blob==null?null: DecorationImage(
  303. image: MemoryImage(insertAsset[index].blob,),
  304. fit: BoxFit.cover
  305. ),
  306. color:Colors.grey,
  307. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
  308. ),child:insertAsset[index].blob==null?Icon(Icons.image):null,),
  309. Expanded(
  310. flex: 7,
  311. child: Container(padding: EdgeInsets.all(5),
  312. height: 180,
  313. child: Column(
  314. mainAxisAlignment: MainAxisAlignment.spaceAround,
  315. children: <Widget>[
  316. Row(
  317. children: <Widget>[
  318. Expanded(flex:3,child: Text("Tag Number",style: TextStyle(fontSize: 14,),)),
  319. Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  320. Expanded(flex: 6,child: Text(insertAsset[index].tag_number,style: TextStyle(color: (insertAsset[index].asset_desc!='')?Colors.black:Colors.red,fontSize: 16,fontWeight: FontWeight.bold))),
  321. Expanded(flex: 1,child: InkWell(onTap: ()async{
  322. await showDialog(context: context,
  323. barrierDismissible: true,
  324. builder: (context)=>AlertDialog(
  325. title: Text('Delete Asset?'),
  326. content: Text("Delete this asset (${insertAsset[index].tag_number})?"),
  327. actions: [
  328. FlatButton(
  329. child: Text('Delete'),
  330. onPressed: ()async{
  331. var res = await DBHelper.database.deleteInsertAsset(insertAsset[index].no);
  332. if(res!=null){
  333. setState(() {
  334. insertAsset.removeAt(index);
  335. });
  336. util.showToast('SUCCESS', 'Deleted');
  337. }
  338. else{
  339. util.showToast('ERROR', 'Delete failed');
  340. }
  341. Navigator.pop(context);
  342. },
  343. )
  344. ],
  345. ));
  346. },child: Container(alignment: Alignment.centerRight,child: Icon(Icons.cancel,color: Colors.red,),)),),
  347. ],
  348. ),
  349. Row(
  350. children: <Widget>[
  351. Expanded(flex:3,child: Container(height: 16,child: Text("Asset Desc",style: TextStyle(fontSize: 14,),))),
  352. Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  353. Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].asset_desc,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
  354. ],
  355. ),
  356. Row(
  357. children: <Widget>[
  358. Expanded(flex:3,child: Container(height: 16,child: Text("Lokasi",style: TextStyle(fontSize: 14,),))),
  359. Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  360. Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].lantai,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
  361. ],
  362. ),
  363. Row(
  364. children: <Widget>[
  365. Expanded(flex:3,child: Container(height: 16,child: Text("Ruang",style: TextStyle(fontSize: 14,),))),
  366. Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  367. Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].ruangan,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
  368. ],
  369. ),
  370. Row(
  371. children: <Widget>[
  372. Expanded(flex:3,child: Container(height: 16,child: Text("Keterangan",style: TextStyle(fontSize: 14,),))),
  373. Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  374. Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].keterangan,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
  375. ],
  376. ),
  377. ],
  378. ),),
  379. )
  380. ],
  381. ),
  382. ),
  383. ),
  384. );
  385. // String keyString = insertAsset[index].tag_number+insertAsset[index].asset_desc+insertAsset[index].ruangan+insertAsset[index].lantai+insertAsset[index].ruangan;
  386. // if(search=='') return InkWell(
  387. // onTap: ()async{
  388. // await Navigator.push(context, MaterialPageRoute(builder: (context) => new AssetDetails(tagNumber: insertAsset[index].tag_number,)));
  389. //// await Navigator.pushNamed(context, "/details");
  390. // await loadAsset();
  391. // },
  392. // child: Padding(
  393. // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
  394. // child: Container(
  395. // decoration: BoxDecoration(
  396. // color: Colors.white,
  397. // borderRadius: BorderRadius.circular(5)
  398. // ),
  399. // height: 100,
  400. // child: Row(
  401. // children: <Widget>[
  402. // Container(height: 100,width: 100,decoration:BoxDecoration(
  403. // image:insertAsset[index].blob==null?null: DecorationImage(
  404. // image: MemoryImage(insertAsset[index].blob,),
  405. // fit: BoxFit.cover
  406. // ),
  407. // color:Colors.grey,
  408. // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
  409. // ),child:insertAsset[index].blob==null?Icon(Icons.image):null,),
  410. // Expanded(
  411. // flex: 7,
  412. // child: Container(padding: EdgeInsets.all(5),
  413. // height: 180,
  414. // child: Column(
  415. // mainAxisAlignment: MainAxisAlignment.spaceAround,
  416. // children: <Widget>[
  417. // Row(
  418. // children: <Widget>[
  419. // Expanded(flex:3,child: Text("Tag Number",style: TextStyle(fontSize: 14,),)),
  420. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  421. // Expanded(flex: 7,child: Text(insertAsset[index].tag_number,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  422. // ],
  423. // ),
  424. // Row(
  425. // children: <Widget>[
  426. // Expanded(flex:3,child: Container(height: 16,child: Text("Asset Desc",style: TextStyle(fontSize: 14,),))),
  427. // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  428. // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].asset_desc,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
  429. // ],
  430. // ),
  431. // Row(
  432. // children: <Widget>[
  433. // Expanded(flex:3,child: Container(height: 16,child: Text("Ruang",style: TextStyle(fontSize: 14,),))),
  434. // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  435. // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].ruangan+' '+insertAsset[index].lantai,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
  436. // ],
  437. // ),
  438. // Row(
  439. // children: <Widget>[
  440. // Expanded(flex:3,child: Container(height: 16,child: Text("Gedung",style: TextStyle(fontSize: 14,),))),
  441. // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  442. // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].gedung,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
  443. // ],
  444. // ),
  445. // ],
  446. // ),),
  447. // )
  448. // ],
  449. // ),
  450. // ),
  451. // ),
  452. // );
  453. // else{
  454. // if(keyString.toUpperCase().contains(search.toUpperCase())) return InkWell(
  455. // onTap: ()async{
  456. // await Navigator.push(context, MaterialPageRoute(builder: (context) => new AssetDetails(tagNumber: insertAsset[index].tag_number,)));
  457. //// await Navigator.pushNamed(context, "/details");
  458. // await loadAsset();
  459. // },
  460. // child: Padding(
  461. // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
  462. // child: Container(
  463. // decoration: BoxDecoration(
  464. // color: Colors.white,
  465. // borderRadius: BorderRadius.circular(5)
  466. // ),
  467. // height: 100,
  468. // child: Row(
  469. // children: <Widget>[
  470. // Container(height: 100,width: 100,decoration:BoxDecoration(
  471. // image:insertAsset[index].blob==null?null: DecorationImage(
  472. // image: MemoryImage(insertAsset[index].blob,),
  473. // fit: BoxFit.cover
  474. // ),
  475. // color:Colors.grey,
  476. // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
  477. // ),child:insertAsset[index].blob==null?Icon(Icons.image):null,),
  478. // Expanded(
  479. // flex: 7,
  480. // child: Container(padding: EdgeInsets.all(5),
  481. // height: 180,
  482. // child: Column(
  483. // mainAxisAlignment: MainAxisAlignment.spaceAround,
  484. // children: <Widget>[
  485. // Row(
  486. // children: <Widget>[
  487. // Expanded(flex:3,child: Text("Tag Number",style: TextStyle(fontSize: 14,),)),
  488. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  489. // Expanded(flex: 7,child: Text(insertAsset[index].tag_number,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  490. // ],
  491. // ),
  492. // Row(
  493. // children: <Widget>[
  494. // Expanded(flex:3,child: Container(height: 16,child: Text("Asset Desc",style: TextStyle(fontSize: 14,),))),
  495. // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  496. // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].asset_desc,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
  497. // ],
  498. // ),
  499. // Row(
  500. // children: <Widget>[
  501. // Expanded(flex:3,child: Container(height: 16,child: Text("Ruang",style: TextStyle(fontSize: 14,),))),
  502. // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  503. // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].ruangan+' '+insertAsset[index].lantai,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
  504. // ],
  505. // ),
  506. // Row(
  507. // children: <Widget>[
  508. // Expanded(flex:3,child: Container(height: 16,child: Text("Gedung",style: TextStyle(fontSize: 14,),))),
  509. // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  510. // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].gedung,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
  511. // ],
  512. // ),
  513. // ],
  514. // ),),
  515. // )
  516. // ],
  517. // ),
  518. // ),
  519. // ),
  520. // );
  521. // else return Container();
  522. // }
  523. }
  524. ),
  525. ),
  526. Scrollbar(
  527. isAlwaysShown: false,
  528. child: ListView.builder(
  529. padding: EdgeInsets.all(0),
  530. itemCount: refAsset.length,
  531. itemBuilder: (context,index){
  532. return Opacity(
  533. opacity: (refAsset[index].flag=='TRUE')?0.5:1,
  534. child: Padding(
  535. padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
  536. child: Container(
  537. decoration: BoxDecoration(
  538. color: Colors.white,
  539. borderRadius: BorderRadius.circular(5)
  540. ),
  541. height: 100,
  542. child: Row(
  543. children: <Widget>[
  544. // Container(height: 100,width: 100,decoration:BoxDecoration(
  545. // image:refAsset[index].blob==null?null: DecorationImage(
  546. // image: MemoryImage(refAsset[index].blob,),
  547. // fit: BoxFit.cover
  548. // ),
  549. // color:Colors.grey,
  550. // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
  551. // ),child:Icon(Icons.image,color: (refAsset[index].blob==null)?Colors.black:Colors.transparent,),),
  552. Expanded(
  553. flex: 7,
  554. child: Container(padding: EdgeInsets.all(5),
  555. height: 180,
  556. child: Column(
  557. mainAxisAlignment: MainAxisAlignment.spaceAround,
  558. children: <Widget>[
  559. Row(
  560. children: <Widget>[
  561. Expanded(flex:3,child: Text("Tag Number",style: TextStyle(fontSize: 14,),)),
  562. Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  563. Expanded(flex: 7,child: Text(refAsset[index].tag_number,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold,color: Colors.black)))
  564. ],
  565. ),
  566. Row(
  567. children: <Widget>[
  568. Expanded(flex:3,child: Container(height: 16,child: Text("Asset Desc",style: TextStyle(fontSize: 14,),))),
  569. Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  570. Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(refAsset[index].asset_desc,style: TextStyle(fontSize: 16,color: Colors.black,fontWeight: FontWeight.bold)))))
  571. ],
  572. ),
  573. Row(
  574. children: <Widget>[
  575. Expanded(flex:3,child: Container(height: 16,child: Text("Ruang",style: TextStyle(fontSize: 14,),))),
  576. Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  577. Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(refAsset[index].ruangan,style: TextStyle(fontSize: 16,color: Colors.black,fontWeight: FontWeight.bold)))))
  578. ],
  579. ),
  580. Row(
  581. children: <Widget>[
  582. Expanded(flex:3,child: Container(height: 16,child: Text("Lantai",style: TextStyle(fontSize: 14,),))),
  583. Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  584. Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(refAsset[index].lantai,style: TextStyle(fontSize: 16,color: Colors.black,fontWeight: FontWeight.bold)))))
  585. ],
  586. ),
  587. ],
  588. ),),
  589. )
  590. ],
  591. ),
  592. ),
  593. ),
  594. );
  595. // String keyString = refAsset[index].tag_number+refAsset[index].asset_desc+refAsset[index].ruangan+refAsset[index].lantai+refAsset[index].ruangan;
  596. // if(search=='') return Opacity(
  597. // opacity: (refAsset[index].flag=='TRUE')?0.5:1,
  598. // child: Padding(
  599. // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
  600. // child: Container(
  601. // decoration: BoxDecoration(
  602. // color: Colors.white,
  603. // borderRadius: BorderRadius.circular(5)
  604. // ),
  605. // height: 100,
  606. // child: Row(
  607. // children: <Widget>[
  608. // Container(height: 100,width: 100,decoration:BoxDecoration(
  609. // image:refAsset[index].blob==null?null: DecorationImage(
  610. // image: MemoryImage(refAsset[index].blob,),
  611. // fit: BoxFit.cover
  612. // ),
  613. // color:Colors.grey,
  614. // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
  615. // ),child:Icon(Icons.image),),
  616. // Expanded(
  617. // flex: 7,
  618. // child: Container(padding: EdgeInsets.all(5),
  619. // height: 180,
  620. // child: Column(
  621. // mainAxisAlignment: MainAxisAlignment.spaceAround,
  622. // children: <Widget>[
  623. // Row(
  624. // children: <Widget>[
  625. // Expanded(flex:3,child: Text("Tag Number",style: TextStyle(fontSize: 14,),)),
  626. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  627. // Expanded(flex: 7,child: Text(refAsset[index].tag_number,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold,color: Colors.black)))
  628. // ],
  629. // ),
  630. // Row(
  631. // children: <Widget>[
  632. // Expanded(flex:3,child: Container(height: 16,child: Text("Asset Desc",style: TextStyle(fontSize: 14,),))),
  633. // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  634. // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(refAsset[index].asset_desc,style: TextStyle(fontSize: 16,color: Colors.black,fontWeight: FontWeight.bold)))))
  635. // ],
  636. // ),
  637. // Row(
  638. // children: <Widget>[
  639. // Expanded(flex:3,child: Container(height: 16,child: Text("Ruang",style: TextStyle(fontSize: 14,),))),
  640. // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  641. // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(refAsset[index].ruangan+' '+refAsset[index].lantai,style: TextStyle(fontSize: 16,color: Colors.black,fontWeight: FontWeight.bold)))))
  642. // ],
  643. // ),
  644. // Row(
  645. // children: <Widget>[
  646. // Expanded(flex:3,child: Container(height: 16,child: Text("Gedung",style: TextStyle(fontSize: 14,),))),
  647. // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  648. // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(refAsset[index].gedung,style: TextStyle(fontSize: 16,color: Colors.black,fontWeight: FontWeight.bold)))))
  649. // ],
  650. // ),
  651. // ],
  652. // ),),
  653. // )
  654. // ],
  655. // ),
  656. // ),
  657. // ),
  658. // );
  659. // else{
  660. // if(keyString.toUpperCase().contains(search.toUpperCase())) return Opacity(
  661. // opacity: (refAsset[index].flag=='TRUE')?0.5:1,
  662. // child: Padding(
  663. // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
  664. // child: Container(
  665. // decoration: BoxDecoration(
  666. // color: Colors.white,
  667. // borderRadius: BorderRadius.circular(5)
  668. // ),
  669. // height: 100,
  670. // child: Row(
  671. // children: <Widget>[
  672. // Container(height: 100,width: 100,decoration:BoxDecoration(
  673. // image:refAsset[index].blob==null?null: DecorationImage(
  674. // image: MemoryImage(refAsset[index].blob,),
  675. // fit: BoxFit.cover
  676. // ),
  677. // color:Colors.grey,
  678. // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
  679. // ),child:Icon(Icons.image),),
  680. // Expanded(
  681. // flex: 7,
  682. // child: Container(padding: EdgeInsets.all(5),
  683. // height: 180,
  684. // child: Column(
  685. // mainAxisAlignment: MainAxisAlignment.spaceAround,
  686. // children: <Widget>[
  687. // Row(
  688. // children: <Widget>[
  689. // Expanded(flex:3,child: Text("Tag Number",style: TextStyle(fontSize: 14,),)),
  690. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  691. // Expanded(flex: 7,child: Text(refAsset[index].tag_number,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold,color: Colors.black)))
  692. // ],
  693. // ),
  694. // Row(
  695. // children: <Widget>[
  696. // Expanded(flex:3,child: Container(height: 16,child: Text("Asset Desc",style: TextStyle(fontSize: 14,),))),
  697. // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  698. // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(refAsset[index].asset_desc,style: TextStyle(fontSize: 16,color: Colors.black,fontWeight: FontWeight.bold)))))
  699. // ],
  700. // ),
  701. // Row(
  702. // children: <Widget>[
  703. // Expanded(flex:3,child: Container(height: 16,child: Text("Ruang",style: TextStyle(fontSize: 14,),))),
  704. // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  705. // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(refAsset[index].ruangan+' '+refAsset[index].lantai,style: TextStyle(fontSize: 16,color: Colors.black,fontWeight: FontWeight.bold)))))
  706. // ],
  707. // ),
  708. // Row(
  709. // children: <Widget>[
  710. // Expanded(flex:3,child: Container(height: 16,child: Text("Gedung",style: TextStyle(fontSize: 14,),))),
  711. // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
  712. // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(refAsset[index].gedung,style: TextStyle(fontSize: 16,color: Colors.black,fontWeight: FontWeight.bold)))))
  713. // ],
  714. // ),
  715. // ],
  716. // ),),
  717. // )
  718. // ],
  719. // ),
  720. // ),
  721. // ),
  722. // );
  723. // else return Container();
  724. // }
  725. }
  726. ),
  727. ),
  728. // ListView(
  729. // padding: EdgeInsets.all(0),
  730. // children: <Widget>[
  731. // Padding(
  732. // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
  733. // child: Container(
  734. // decoration: BoxDecoration(
  735. // color: Colors.white,
  736. // borderRadius: BorderRadius.circular(5)
  737. // ),
  738. // height: 100,
  739. // child: Row(
  740. // children: <Widget>[
  741. // Container(height: 100,width: 100,decoration:BoxDecoration(
  742. // color:Colors.red,
  743. // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
  744. // ),child:Icon(Icons.image),),
  745. // Expanded(
  746. // flex: 7,
  747. // child: Container(padding: EdgeInsets.all(5),
  748. // child: Column(
  749. // mainAxisAlignment: MainAxisAlignment.spaceAround,
  750. // children: <Widget>[
  751. // Row(
  752. // children: <Widget>[
  753. // Expanded(flex:2,child: Text("Kode",style: TextStyle(fontSize: 14,),)),
  754. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  755. // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  756. // ],
  757. // ),
  758. // Row(
  759. // children: <Widget>[
  760. // Expanded(flex:2,child: Text("Nama",style: TextStyle(fontSize: 14,),)),
  761. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  762. // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  763. // ],
  764. // ),
  765. // Row(
  766. // children: <Widget>[
  767. // Expanded(flex:2,child: Text("Ruang",style: TextStyle(fontSize: 14,),)),
  768. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  769. // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  770. // ],
  771. // ),
  772. // ],
  773. // ),),
  774. // )
  775. // ],
  776. // ),
  777. // ),
  778. // ),
  779. // Padding(
  780. // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
  781. // child: Container(
  782. // decoration: BoxDecoration(
  783. // color: Colors.white,
  784. // borderRadius: BorderRadius.circular(5)
  785. // ),
  786. // height: 100,
  787. // child: Row(
  788. // children: <Widget>[
  789. // Container(height: 100,width: 100,decoration:BoxDecoration(
  790. // color:Colors.red,
  791. // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
  792. // ),child:Icon(Icons.image),),
  793. // Expanded(
  794. // flex: 7,
  795. // child: Container(padding: EdgeInsets.all(5),
  796. // child: Column(
  797. // mainAxisAlignment: MainAxisAlignment.spaceAround,
  798. // children: <Widget>[
  799. // Row(
  800. // children: <Widget>[
  801. // Expanded(flex:2,child: Text("Kode",style: TextStyle(fontSize: 14,),)),
  802. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  803. // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  804. // ],
  805. // ),
  806. // Row(
  807. // children: <Widget>[
  808. // Expanded(flex:2,child: Text("Nama",style: TextStyle(fontSize: 14,),)),
  809. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  810. // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  811. // ],
  812. // ),
  813. // Row(
  814. // children: <Widget>[
  815. // Expanded(flex:2,child: Text("Ruang",style: TextStyle(fontSize: 14,),)),
  816. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  817. // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  818. // ],
  819. // ),
  820. // ],
  821. // ),),
  822. // )
  823. // ],
  824. // ),
  825. // ),
  826. // ),
  827. // Padding(
  828. // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
  829. // child: Container(
  830. // decoration: BoxDecoration(
  831. // color: Colors.white,
  832. // borderRadius: BorderRadius.circular(5)
  833. // ),
  834. // height: 100,
  835. // child: Row(
  836. // children: <Widget>[
  837. // Container(height: 100,width: 100,decoration:BoxDecoration(
  838. // color:Colors.red,
  839. // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
  840. // ),child:Icon(Icons.image),),
  841. // Expanded(
  842. // flex: 7,
  843. // child: Container(padding: EdgeInsets.all(5),
  844. // child: Column(
  845. // mainAxisAlignment: MainAxisAlignment.spaceAround,
  846. // children: <Widget>[
  847. // Row(
  848. // children: <Widget>[
  849. // Expanded(flex:2,child: Text("Kode",style: TextStyle(fontSize: 14,),)),
  850. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  851. // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  852. // ],
  853. // ),
  854. // Row(
  855. // children: <Widget>[
  856. // Expanded(flex:2,child: Text("Nama",style: TextStyle(fontSize: 14,),)),
  857. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  858. // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  859. // ],
  860. // ),
  861. // Row(
  862. // children: <Widget>[
  863. // Expanded(flex:2,child: Text("Ruang",style: TextStyle(fontSize: 14,),)),
  864. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  865. // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  866. // ],
  867. // ),
  868. // ],
  869. // ),),
  870. // )
  871. // ],
  872. // ),
  873. // ),
  874. // ),
  875. // Padding(
  876. // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
  877. // child: Container(
  878. // decoration: BoxDecoration(
  879. // color: Colors.white,
  880. // borderRadius: BorderRadius.circular(5)
  881. // ),
  882. // height: 100,
  883. // child: Row(
  884. // children: <Widget>[
  885. // Container(height: 100,width: 100,decoration:BoxDecoration(
  886. // color:Colors.red,
  887. // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
  888. // ),child:Icon(Icons.image),),
  889. // Expanded(
  890. // flex: 7,
  891. // child: Container(padding: EdgeInsets.all(5),
  892. // child: Column(
  893. // mainAxisAlignment: MainAxisAlignment.spaceAround,
  894. // children: <Widget>[
  895. // Row(
  896. // children: <Widget>[
  897. // Expanded(flex:2,child: Text("Kode",style: TextStyle(fontSize: 14,),)),
  898. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  899. // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  900. // ],
  901. // ),
  902. // Row(
  903. // children: <Widget>[
  904. // Expanded(flex:2,child: Text("Nama",style: TextStyle(fontSize: 14,),)),
  905. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  906. // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  907. // ],
  908. // ),
  909. // Row(
  910. // children: <Widget>[
  911. // Expanded(flex:2,child: Text("Ruang",style: TextStyle(fontSize: 14,),)),
  912. // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
  913. // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
  914. // ],
  915. // ),
  916. // ],
  917. // ),),
  918. // )
  919. // ],
  920. // ),
  921. // ),
  922. // ),
  923. // ],
  924. // ),
  925. ],
  926. ),
  927. ),
  928. ],
  929. ),
  930. ),
  931. ],
  932. ),
  933. ),
  934. Container(
  935. alignment: Alignment.center,
  936. child: (isLoading)?CircularProgressIndicator():null,
  937. )
  938. ],
  939. ),
  940. floatingActionButton: FloatingActionButton(
  941. onPressed: ()async{
  942. await Navigator.push(context, MaterialPageRoute(builder: (context) => new AssetDetails(lokasi: lokasi,)));
  943. await loadAsset();
  944. },
  945. backgroundColor: Colors.blueGrey,
  946. child: Icon(Icons.add),
  947. ),
  948. );
  949. }
  950. }