|
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'main.dart';
- import 'util/Models.dart';
- import 'util/dbHandler.dart';
- import 'asset_details.dart';
-
- class Stocking extends StatefulWidget {
- Stocking({Key key}) : super(key: key);
-
- @override
- _StockingState createState() => _StockingState();
- }
-
- class _StockingState extends State<Stocking> with TickerProviderStateMixin {
- final searchCon = new TextEditingController();
- String search = '';
- TabController _tabController;
- List<Asset> refAsset = [];
- List<Asset> insertAsset = [];
- bool isLoading = false;
- List<String> lokasi = [];
- List<String> ruangan = [];
- String _currentloc='All';
- String _currentruang='All';
-
- loadAsset({loading=false})async{
- if(loading) {
- setState(() {
- isLoading = true;
- });
- }
- var result = (search=='')?await DBHelper.database.getAllAsset():await DBHelper.database.filterAllAsset(search.toUpperCase());
- if(result!=null){
- if(_currentloc!='All') result.removeWhere((element) => (element.lantai!=_currentloc));
- if(_currentruang!='All') result.removeWhere((element) => (element.ruangan!=_currentruang));
- setState(() {
- refAsset = result;
- });
- // print(result.length);
- }
- result = (search=='')?await DBHelper.database.getAllInsertAsset():await DBHelper.database.filterAllInsertAsset(search.toUpperCase());
- if(result!=null){
- print(result.length);
- if(_currentloc!='All'){
- if(_currentloc!='Appended'){
- result.removeWhere((element) => (element.lantai!=_currentloc));
- }
- else{
- result.removeWhere((element) => (element.asset_desc!=''));
- }
- }
- if(_currentruang!='All') result.removeWhere((element) => (element.ruangan!=_currentruang));
- setState(() {
- insertAsset = result.reversed.toList();
- });
- }
- if(lokasi.length==0){
- var results = await DBHelper.database.getAllLocation();
- if(results!=null){
- lokasi.clear();
- lokasi = new List<String>.from(results.map((item)=>item.lantai));
- lokasi.add('Appended');
- lokasi.add('All');
- }
- }
- ruangan.clear();
- var results = (_currentloc=='All')?await DBHelper.database.getAllRuangan():await DBHelper.database.getLantaiRuangan(_currentloc);
- setState(() {
- if(results!=null){
- ruangan = new List<String>.from(results.map((item)=>item.ruangan));
- ruangan.add('All');
- }
- });
-
-
- if(loading) {
- setState(() {
- isLoading = false;
- });
- }
- }
-
- @override
- void initState() {
- // TODO: implement initState
- super.initState();
- _tabController = new TabController(length: 2, vsync: this);
- loadAsset(loading: true);
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- resizeToAvoidBottomInset: false,
- body: Stack(
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(top: 10),
- color: Colors.grey.withOpacity(0.3),
- child: Column(
- children: <Widget>[
- Expanded(
- flex: 2,
- child: Container(
- alignment: Alignment.bottomCenter,
- padding: const EdgeInsets.all(8.0),
- child: Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(20),
- ),
- // padding: EdgeInsets.all(8),
- child: TextField(
- controller: searchCon,
- onSubmitted: (value)async{
- setState(() {
- search = value;
- // searchCon.text = value;
- });
- await loadAsset(loading: true);
- },
- decoration: InputDecoration(
- border: InputBorder.none,
- focusedBorder: InputBorder.none,
- enabledBorder: InputBorder.none,
- errorBorder: InputBorder.none,
- disabledBorder: InputBorder.none,
- suffixIcon: InkWell(
- onTap: ()async{
- var result = await util.scan();
- if(result['STATUS']==1){
- searchCon.text = result['DATA'];
- search = searchCon.text;
- await loadAsset();
- setState(() {
-
- });
- }
- },
- child: Icon(Icons.center_focus_strong,color: Colors.blueGrey,)),
- contentPadding: EdgeInsets.only(left: 10,right: 10,top: 15,bottom: 15),
- hintText: "Search Tag Number"
- ),
- ),
- ),
- ),
- ),
- Expanded(
- flex: 1,
- child: Container(
- alignment: Alignment.bottomCenter,
- padding: const EdgeInsets.all(8.0),
- child: Container(
- // padding: EdgeInsets.all(8),
- child: Row(
- children: [
- Container(
- child: Text("Lantai : ",style: TextStyle(fontSize: 16),),
- ),
- Container(
- width: 100,
- child: DropdownButtonFormField(
- decoration: InputDecoration.collapsed(hintText: null),
- value: _currentloc,
- items: new List<DropdownMenuItem<String>>.from(lokasi.reversed.map((value){
- return DropdownMenuItem(
- child: Text(value),
- value: value,
- );
- })),
- onChanged: (value){
- if(_currentloc!= value){
- setState(() {
- _currentruang = 'All';
- _currentloc=value;
- });
- loadAsset(loading: true);
- }
-
- },
- ),
- ),
- Container(
- child: Text("Ruang : ",style: TextStyle(fontSize: 16)),
- ),
- Expanded(
- child: DropdownButtonFormField(
- decoration: InputDecoration.collapsed(hintText: null),
- value: _currentruang,
- items: new List<DropdownMenuItem<String>>.from(ruangan.reversed.map((value){
- String _string = value;
- if(_string.length>18) _string = _string.substring(0,18);
- return DropdownMenuItem(
- child: Text(_string),
- value: value,
- );
- })),
- onChanged: (value){
- setState(() {
- _currentruang=value;
- });
- loadAsset(loading: true);
- },
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- Expanded(
- flex:16,
- child: Column(
- children: <Widget>[
- Flexible(
- flex: 1,
- child: Stack(
- children: <Widget>[
- Positioned.fill(child: Row(
- children: <Widget>[
- Expanded(
- flex:1,
- child: Container(
- alignment: Alignment.center,
- child:(insertAsset.length==0)?null:Row(
- mainAxisSize: MainAxisSize.min,
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.all(10.0),
- child: Text('Completed ',style: TextStyle(fontSize: 18,color: Colors.transparent),),
- ),
- Container(padding: EdgeInsets.all(8),
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: Colors.green,
- ),
- child: Text('${insertAsset.length}',style: TextStyle(color: Colors.white,fontSize: 14/(insertAsset.length.toString().length/10+1)),)),
- ],
- )
- ),
- ),
- Expanded(
- flex:1,
- child: Container(
- alignment: Alignment.center,
- child:(refAsset.length==0)?null:Row(
- mainAxisSize: MainAxisSize.min,
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.all(10.0),
- child: Text('InProgress ',style: TextStyle(fontSize: 18,color: Colors.transparent),),
- ),
- Container(padding: EdgeInsets.all(8),
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: Colors.red,
- ),
- 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)),)),
- ],
- )
- ),
- ),
- ],
- ),),
- TabBar(
- labelColor: Colors.blueGrey,
- labelStyle: TextStyle(fontSize: 16,fontWeight: FontWeight.bold),
- unselectedLabelStyle: TextStyle(fontSize: 15),
- controller: _tabController,
- tabs: <Widget>[
- Tab(
- text: 'Completed',
- ),
- Tab(
- text: 'inProgress',
- ),
- ],
- ),
- ],
- ),
- ),
- Expanded(
- flex: 12,
- child: TabBarView(
- controller: _tabController,
- children: <Widget>[
- (insertAsset.length==0)?Center(child: Text('No Asset Data',style: TextStyle(color: Colors.grey,fontSize: 16,fontWeight: FontWeight.bold),),):
- Scrollbar(
- isAlwaysShown: false,
- child: ListView.builder(
- padding: EdgeInsets.all(0),
- itemCount: insertAsset.length,
- itemBuilder: (context,index){
- return InkWell(
- onTap: ()async{
- await Navigator.push(context, MaterialPageRoute(builder: (context) => new AssetDetails(no:insertAsset[index].no,lokasi: lokasi,)));
- // await Navigator.pushNamed(context, "/details");
- await loadAsset();
- },
- child: Padding(
- padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
- child: Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(5)
- ),
- height: 100,
- child: Row(
- children: <Widget>[
- Container(height: 100,width: 100,decoration:BoxDecoration(
- image:insertAsset[index].blob==null?null: DecorationImage(
- image: MemoryImage(insertAsset[index].blob,),
- fit: BoxFit.cover
- ),
- color:Colors.grey,
- borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
- ),child:insertAsset[index].blob==null?Icon(Icons.image):null,),
- Expanded(
- flex: 7,
- child: Container(padding: EdgeInsets.all(5),
- height: 180,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: <Widget>[
- Row(
- children: <Widget>[
- Expanded(flex:3,child: Text("Tag Number",style: TextStyle(fontSize: 14,),)),
- Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- 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))),
- Expanded(flex: 1,child: InkWell(onTap: ()async{
- await showDialog(context: context,
- barrierDismissible: true,
- builder: (context)=>AlertDialog(
- title: Text('Delete Asset?'),
- content: Text("Delete this asset (${insertAsset[index].tag_number})?"),
- actions: [
- FlatButton(
- child: Text('Delete'),
- onPressed: ()async{
- var res = await DBHelper.database.deleteInsertAsset(insertAsset[index].no);
- if(res!=null){
- setState(() {
- insertAsset.removeAt(index);
- });
- util.showToast('SUCCESS', 'Deleted');
- }
- else{
- util.showToast('ERROR', 'Delete failed');
- }
- Navigator.pop(context);
- },
- )
- ],
- ));
- },child: Container(alignment: Alignment.centerRight,child: Icon(Icons.cancel,color: Colors.red,),)),),
- ],
- ),
- Row(
- children: <Widget>[
- Expanded(flex:3,child: Container(height: 16,child: Text("Asset Desc",style: TextStyle(fontSize: 14,),))),
- Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- 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)))))
- ],
- ),
- Row(
- children: <Widget>[
- Expanded(flex:3,child: Container(height: 16,child: Text("Lokasi",style: TextStyle(fontSize: 14,),))),
- Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].lantai,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
- ],
- ),
- Row(
- children: <Widget>[
- Expanded(flex:3,child: Container(height: 16,child: Text("Ruang",style: TextStyle(fontSize: 14,),))),
- Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].ruangan,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
- ],
- ),
- Row(
- children: <Widget>[
- Expanded(flex:3,child: Container(height: 16,child: Text("Keterangan",style: TextStyle(fontSize: 14,),))),
- Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].keterangan,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
- ],
- ),
- ],
- ),),
- )
- ],
- ),
- ),
- ),
- );
- // String keyString = insertAsset[index].tag_number+insertAsset[index].asset_desc+insertAsset[index].ruangan+insertAsset[index].lantai+insertAsset[index].ruangan;
- // if(search=='') return InkWell(
- // onTap: ()async{
- // await Navigator.push(context, MaterialPageRoute(builder: (context) => new AssetDetails(tagNumber: insertAsset[index].tag_number,)));
- //// await Navigator.pushNamed(context, "/details");
- // await loadAsset();
- // },
- // child: Padding(
- // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
- // child: Container(
- // decoration: BoxDecoration(
- // color: Colors.white,
- // borderRadius: BorderRadius.circular(5)
- // ),
- // height: 100,
- // child: Row(
- // children: <Widget>[
- // Container(height: 100,width: 100,decoration:BoxDecoration(
- // image:insertAsset[index].blob==null?null: DecorationImage(
- // image: MemoryImage(insertAsset[index].blob,),
- // fit: BoxFit.cover
- // ),
- // color:Colors.grey,
- // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
- // ),child:insertAsset[index].blob==null?Icon(Icons.image):null,),
- // Expanded(
- // flex: 7,
- // child: Container(padding: EdgeInsets.all(5),
- // height: 180,
- // child: Column(
- // mainAxisAlignment: MainAxisAlignment.spaceAround,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Text("Tag Number",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text(insertAsset[index].tag_number,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Container(height: 16,child: Text("Asset Desc",style: TextStyle(fontSize: 14,),))),
- // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- // 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)))))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Container(height: 16,child: Text("Ruang",style: TextStyle(fontSize: 14,),))),
- // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- // 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)))))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Container(height: 16,child: Text("Gedung",style: TextStyle(fontSize: 14,),))),
- // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].gedung,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
- // ],
- // ),
- // ],
- // ),),
- // )
- // ],
- // ),
- // ),
- // ),
- // );
- // else{
- // if(keyString.toUpperCase().contains(search.toUpperCase())) return InkWell(
- // onTap: ()async{
- // await Navigator.push(context, MaterialPageRoute(builder: (context) => new AssetDetails(tagNumber: insertAsset[index].tag_number,)));
- //// await Navigator.pushNamed(context, "/details");
- // await loadAsset();
- // },
- // child: Padding(
- // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
- // child: Container(
- // decoration: BoxDecoration(
- // color: Colors.white,
- // borderRadius: BorderRadius.circular(5)
- // ),
- // height: 100,
- // child: Row(
- // children: <Widget>[
- // Container(height: 100,width: 100,decoration:BoxDecoration(
- // image:insertAsset[index].blob==null?null: DecorationImage(
- // image: MemoryImage(insertAsset[index].blob,),
- // fit: BoxFit.cover
- // ),
- // color:Colors.grey,
- // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
- // ),child:insertAsset[index].blob==null?Icon(Icons.image):null,),
- // Expanded(
- // flex: 7,
- // child: Container(padding: EdgeInsets.all(5),
- // height: 180,
- // child: Column(
- // mainAxisAlignment: MainAxisAlignment.spaceAround,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Text("Tag Number",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text(insertAsset[index].tag_number,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Container(height: 16,child: Text("Asset Desc",style: TextStyle(fontSize: 14,),))),
- // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- // 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)))))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Container(height: 16,child: Text("Ruang",style: TextStyle(fontSize: 14,),))),
- // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- // 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)))))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Container(height: 16,child: Text("Gedung",style: TextStyle(fontSize: 14,),))),
- // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- // Expanded(flex: 7,child: SingleChildScrollView(scrollDirection: Axis.horizontal,child: Container(height: 16,child: Text(insertAsset[index].gedung,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))))
- // ],
- // ),
- // ],
- // ),),
- // )
- // ],
- // ),
- // ),
- // ),
- // );
- // else return Container();
- // }
- }
- ),
- ),
- Scrollbar(
- isAlwaysShown: false,
- child: ListView.builder(
- padding: EdgeInsets.all(0),
- itemCount: refAsset.length,
- itemBuilder: (context,index){
- return Opacity(
- opacity: (refAsset[index].flag=='TRUE')?0.5:1,
- child: Padding(
- padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
- child: Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(5)
- ),
- height: 100,
- child: Row(
- children: <Widget>[
- // Container(height: 100,width: 100,decoration:BoxDecoration(
- // image:refAsset[index].blob==null?null: DecorationImage(
- // image: MemoryImage(refAsset[index].blob,),
- // fit: BoxFit.cover
- // ),
- // color:Colors.grey,
- // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
- // ),child:Icon(Icons.image,color: (refAsset[index].blob==null)?Colors.black:Colors.transparent,),),
- Expanded(
- flex: 7,
- child: Container(padding: EdgeInsets.all(5),
- height: 180,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: <Widget>[
- Row(
- children: <Widget>[
- Expanded(flex:3,child: Text("Tag Number",style: TextStyle(fontSize: 14,),)),
- Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- Expanded(flex: 7,child: Text(refAsset[index].tag_number,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold,color: Colors.black)))
- ],
- ),
- Row(
- children: <Widget>[
- Expanded(flex:3,child: Container(height: 16,child: Text("Asset Desc",style: TextStyle(fontSize: 14,),))),
- Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- 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)))))
- ],
- ),
- Row(
- children: <Widget>[
- Expanded(flex:3,child: Container(height: 16,child: Text("Ruang",style: TextStyle(fontSize: 14,),))),
- Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- 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)))))
- ],
- ),
- Row(
- children: <Widget>[
- Expanded(flex:3,child: Container(height: 16,child: Text("Lantai",style: TextStyle(fontSize: 14,),))),
- Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- 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)))))
- ],
- ),
- ],
- ),),
- )
- ],
- ),
- ),
- ),
- );
- // String keyString = refAsset[index].tag_number+refAsset[index].asset_desc+refAsset[index].ruangan+refAsset[index].lantai+refAsset[index].ruangan;
- // if(search=='') return Opacity(
- // opacity: (refAsset[index].flag=='TRUE')?0.5:1,
- // child: Padding(
- // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
- // child: Container(
- // decoration: BoxDecoration(
- // color: Colors.white,
- // borderRadius: BorderRadius.circular(5)
- // ),
- // height: 100,
- // child: Row(
- // children: <Widget>[
- // Container(height: 100,width: 100,decoration:BoxDecoration(
- // image:refAsset[index].blob==null?null: DecorationImage(
- // image: MemoryImage(refAsset[index].blob,),
- // fit: BoxFit.cover
- // ),
- // color:Colors.grey,
- // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
- // ),child:Icon(Icons.image),),
- // Expanded(
- // flex: 7,
- // child: Container(padding: EdgeInsets.all(5),
- // height: 180,
- // child: Column(
- // mainAxisAlignment: MainAxisAlignment.spaceAround,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Text("Tag Number",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text(refAsset[index].tag_number,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold,color: Colors.black)))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Container(height: 16,child: Text("Asset Desc",style: TextStyle(fontSize: 14,),))),
- // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- // 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)))))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Container(height: 16,child: Text("Ruang",style: TextStyle(fontSize: 14,),))),
- // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- // 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)))))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Container(height: 16,child: Text("Gedung",style: TextStyle(fontSize: 14,),))),
- // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- // 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)))))
- // ],
- // ),
- // ],
- // ),),
- // )
- // ],
- // ),
- // ),
- // ),
- // );
- // else{
- // if(keyString.toUpperCase().contains(search.toUpperCase())) return Opacity(
- // opacity: (refAsset[index].flag=='TRUE')?0.5:1,
- // child: Padding(
- // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
- // child: Container(
- // decoration: BoxDecoration(
- // color: Colors.white,
- // borderRadius: BorderRadius.circular(5)
- // ),
- // height: 100,
- // child: Row(
- // children: <Widget>[
- // Container(height: 100,width: 100,decoration:BoxDecoration(
- // image:refAsset[index].blob==null?null: DecorationImage(
- // image: MemoryImage(refAsset[index].blob,),
- // fit: BoxFit.cover
- // ),
- // color:Colors.grey,
- // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
- // ),child:Icon(Icons.image),),
- // Expanded(
- // flex: 7,
- // child: Container(padding: EdgeInsets.all(5),
- // height: 180,
- // child: Column(
- // mainAxisAlignment: MainAxisAlignment.spaceAround,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Text("Tag Number",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text(refAsset[index].tag_number,style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold,color: Colors.black)))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Container(height: 16,child: Text("Asset Desc",style: TextStyle(fontSize: 14,),))),
- // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- // 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)))))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Container(height: 16,child: Text("Ruang",style: TextStyle(fontSize: 14,),))),
- // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- // 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)))))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:3,child: Container(height: 16,child: Text("Gedung",style: TextStyle(fontSize: 14,),))),
- // Expanded(flex:1,child: Container(height: 16,child: Text(":",style: TextStyle(fontSize: 16,)))),
- // 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)))))
- // ],
- // ),
- // ],
- // ),),
- // )
- // ],
- // ),
- // ),
- // ),
- // );
- // else return Container();
- // }
- }
- ),
- ),
- // ListView(
- // padding: EdgeInsets.all(0),
- // children: <Widget>[
- // Padding(
- // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
- // child: Container(
- // decoration: BoxDecoration(
- // color: Colors.white,
- // borderRadius: BorderRadius.circular(5)
- // ),
- // height: 100,
- // child: Row(
- // children: <Widget>[
- // Container(height: 100,width: 100,decoration:BoxDecoration(
- // color:Colors.red,
- // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
- // ),child:Icon(Icons.image),),
- // Expanded(
- // flex: 7,
- // child: Container(padding: EdgeInsets.all(5),
- // child: Column(
- // mainAxisAlignment: MainAxisAlignment.spaceAround,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // Expanded(flex:2,child: Text("Kode",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:2,child: Text("Nama",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:2,child: Text("Ruang",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // ],
- // ),),
- // )
- // ],
- // ),
- // ),
- // ),
- // Padding(
- // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
- // child: Container(
- // decoration: BoxDecoration(
- // color: Colors.white,
- // borderRadius: BorderRadius.circular(5)
- // ),
- // height: 100,
- // child: Row(
- // children: <Widget>[
- // Container(height: 100,width: 100,decoration:BoxDecoration(
- // color:Colors.red,
- // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
- // ),child:Icon(Icons.image),),
- // Expanded(
- // flex: 7,
- // child: Container(padding: EdgeInsets.all(5),
- // child: Column(
- // mainAxisAlignment: MainAxisAlignment.spaceAround,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // Expanded(flex:2,child: Text("Kode",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:2,child: Text("Nama",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:2,child: Text("Ruang",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // ],
- // ),),
- // )
- // ],
- // ),
- // ),
- // ),
- // Padding(
- // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
- // child: Container(
- // decoration: BoxDecoration(
- // color: Colors.white,
- // borderRadius: BorderRadius.circular(5)
- // ),
- // height: 100,
- // child: Row(
- // children: <Widget>[
- // Container(height: 100,width: 100,decoration:BoxDecoration(
- // color:Colors.red,
- // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
- // ),child:Icon(Icons.image),),
- // Expanded(
- // flex: 7,
- // child: Container(padding: EdgeInsets.all(5),
- // child: Column(
- // mainAxisAlignment: MainAxisAlignment.spaceAround,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // Expanded(flex:2,child: Text("Kode",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:2,child: Text("Nama",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:2,child: Text("Ruang",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // ],
- // ),),
- // )
- // ],
- // ),
- // ),
- // ),
- // Padding(
- // padding: const EdgeInsets.only(bottom: 8,left: 8,right: 8),
- // child: Container(
- // decoration: BoxDecoration(
- // color: Colors.white,
- // borderRadius: BorderRadius.circular(5)
- // ),
- // height: 100,
- // child: Row(
- // children: <Widget>[
- // Container(height: 100,width: 100,decoration:BoxDecoration(
- // color:Colors.red,
- // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
- // ),child:Icon(Icons.image),),
- // Expanded(
- // flex: 7,
- // child: Container(padding: EdgeInsets.all(5),
- // child: Column(
- // mainAxisAlignment: MainAxisAlignment.spaceAround,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // Expanded(flex:2,child: Text("Kode",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:2,child: Text("Nama",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // Row(
- // children: <Widget>[
- // Expanded(flex:2,child: Text("Ruang",style: TextStyle(fontSize: 14,),)),
- // Expanded(flex:1,child: Text(":",style: TextStyle(fontSize: 16,))),
- // Expanded(flex: 7,child: Text("aaaa",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)))
- // ],
- // ),
- // ],
- // ),),
- // )
- // ],
- // ),
- // ),
- // ),
- // ],
- // ),
- ],
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- Container(
- alignment: Alignment.center,
- child: (isLoading)?CircularProgressIndicator():null,
- )
- ],
- ),
- floatingActionButton: FloatingActionButton(
- onPressed: ()async{
- await Navigator.push(context, MaterialPageRoute(builder: (context) => new AssetDetails(lokasi: lokasi,)));
- await loadAsset();
- },
- backgroundColor: Colors.blueGrey,
- child: Icon(Icons.add),
- ),
- );
- }
- }
|