Business Login Flutter Apps
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

833 satır
48 KiB

  1. import 'dart:typed_data';
  2. import '../Model/unit.dart';
  3. import '../Widgets/photo_viewer.dart';
  4. import 'package:flutter/cupertino.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:image_picker/image_picker.dart';
  7. import '../Utils/db_helper.dart';
  8. import '../main.dart';
  9. import 'package:intl/intl.dart';
  10. import 'package:flutter_bloc/flutter_bloc.dart';
  11. import '../Blocs/Units/Images/get_images_bloc.dart';
  12. import '../Blocs/Units/Save/save_unit_bloc.dart';
  13. class UnitDetails extends StatefulWidget {
  14. Unit unit;
  15. UnitDetails(this.unit);
  16. @override
  17. _UnitDetailsState createState() => _UnitDetailsState();
  18. }
  19. class _UnitDetailsState extends State<UnitDetails> {
  20. final tipeController = TextEditingController();
  21. final rangkaController = TextEditingController();
  22. final colorController = TextEditingController();
  23. final kodeController = TextEditingController();
  24. final mesinController = TextEditingController();
  25. final tahunController = TextEditingController();
  26. final stateController = TextEditingController();
  27. final channelController = TextEditingController();
  28. bool isChanged = false;
  29. List<Uint8List> images = [];
  30. List<int> blobIds = [];
  31. List<int> deleteBlobIds = [];
  32. List<ImageType> dropMenu = [];
  33. List<String> jenisImages = [];
  34. int jenisLength=0;
  35. late Unit _currentUnit;
  36. late GetImagesBloc _unitImagesBloc;
  37. late SaveUnitBloc _saveUnitBloc;
  38. List<Blob> blobList = [];
  39. loadUnitDetails(){
  40. _currentUnit = widget.unit;
  41. tipeController.text= _currentUnit.tipe;
  42. rangkaController.text = _currentUnit.rangka;
  43. colorController.text = _currentUnit.warna;
  44. kodeController.text = _currentUnit.kode;
  45. mesinController.text = _currentUnit.mesin;
  46. tahunController.text = _currentUnit.tahun;
  47. stateController.text = _currentUnit.state;
  48. channelController.text = (_currentUnit.channel==null||_currentUnit.channel==""||_currentUnit.channel=="null")?'-':_currentUnit.channel;
  49. _unitImagesBloc.add(GetImages(mesin:mesinController.text));
  50. }
  51. @override
  52. void dispose() {
  53. super.dispose();
  54. _unitImagesBloc.close();
  55. _saveUnitBloc.close();
  56. }
  57. @override
  58. void initState() {
  59. super.initState();
  60. _unitImagesBloc = GetImagesBloc();
  61. _saveUnitBloc = SaveUnitBloc();
  62. }
  63. @override
  64. Widget build(BuildContext context) {
  65. return Scaffold(
  66. resizeToAvoidBottomInset: true,
  67. appBar: AppBar(
  68. backgroundColor: Colors.transparent,
  69. elevation: 0.0,
  70. iconTheme: IconThemeData(
  71. color: Colors.indigo,
  72. ),
  73. title: Text((widget.unit.flag=='FALSE')?'Inserting New Unit':'Editing Unit',style: TextStyle(color: Colors.indigo),),
  74. ),
  75. body: WillPopScope(
  76. onWillPop: ()async{
  77. if(widget.unit.flag=='TRUE'){
  78. if(isChanged){
  79. await showDialog(context: context,builder: (context)=>
  80. Material(
  81. color: Colors.white.withOpacity(0.9),
  82. child: Center(
  83. child: Container(
  84. decoration: BoxDecoration(
  85. color: Colors.white,
  86. boxShadow: [
  87. BoxShadow(
  88. color: Colors.grey.withOpacity(0.5),
  89. spreadRadius: 2,
  90. blurRadius: 2,
  91. offset: Offset(0, 0), // changes position of shadow
  92. ),
  93. ],
  94. borderRadius: BorderRadius.circular(5)
  95. ),
  96. height:220,
  97. // height: MediaQuery.of(context).size.height/4.8,
  98. width: MediaQuery.of(context).size.width*0.75,
  99. child: Column(
  100. children: <Widget>[
  101. Flexible(
  102. flex:3,
  103. child: Container(
  104. padding: EdgeInsets.only(top:10,left: 10,right: 10),
  105. alignment: Alignment.center,
  106. decoration: BoxDecoration(
  107. // color: Colors.indigo,
  108. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5))
  109. ),
  110. child: Column(
  111. mainAxisSize: MainAxisSize.min,
  112. crossAxisAlignment: CrossAxisAlignment.center,
  113. children: <Widget>[
  114. Icon(Icons.warning,size: 70,color: Colors.indigo,),
  115. ],
  116. ),
  117. ),
  118. ),
  119. Flexible(
  120. flex: 1,
  121. child: Container(
  122. padding: EdgeInsets.only(left: 20,right: 20),
  123. alignment: Alignment.centerLeft,
  124. child: Text('Data belum disimpan. Lanjutkan ?',style: TextStyle(fontWeight: FontWeight.w500,fontSize: 14,color: Colors.black.withOpacity(0.6)),)
  125. ),
  126. ),
  127. Flexible(
  128. flex: 1,
  129. child: Container(
  130. padding: EdgeInsets.only(bottom:10),
  131. child: Row(
  132. mainAxisAlignment: MainAxisAlignment.end,
  133. children: <Widget>[
  134. TextButton(
  135. child: Text('Proceed'),
  136. // color: Colors.red,
  137. onPressed: (){
  138. Navigator.pop(context);
  139. Navigator.pop(context);
  140. },
  141. ),
  142. TextButton(
  143. child: Text('Cancel'),
  144. // color: Colors.grey,
  145. onPressed: (){
  146. Navigator.pop(context);
  147. },
  148. ),
  149. ],
  150. ),
  151. ),
  152. )
  153. ],
  154. ),
  155. ),
  156. ),
  157. ),
  158. );
  159. }
  160. else Navigator.pop(context);
  161. }
  162. else{
  163. bool not_empty = (stateController.text!='-'&&mesinController.text!='-'&&tahunController.text!='-'&&kodeController.text!='-'&&colorController.text!='-'&&rangkaController.text!='-'&&tipeController.text!='-');
  164. if(blobList.where((element) => element.bytes!=null).length!=0){
  165. await showDialog(context: context,builder: (context)=>
  166. Material(
  167. color: Colors.white.withOpacity(0.9),
  168. child: Center(
  169. child: Container(
  170. decoration: BoxDecoration(
  171. color: Colors.white,
  172. boxShadow: [
  173. BoxShadow(
  174. color: Colors.grey.withOpacity(0.5),
  175. spreadRadius: 2,
  176. blurRadius: 2,
  177. offset: Offset(0, 0), // changes position of shadow
  178. ),
  179. ],
  180. borderRadius: BorderRadius.circular(5)
  181. ),
  182. height:220,
  183. // height: MediaQuery.of(context).size.height/4.8,
  184. width: MediaQuery.of(context).size.width*0.75,
  185. child: Column(
  186. children: <Widget>[
  187. Flexible(
  188. flex:3,
  189. child: Container(
  190. padding: EdgeInsets.only(top:10,left: 10,right: 10),
  191. alignment: Alignment.center,
  192. decoration: BoxDecoration(
  193. // color: Colors.indigo,
  194. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5))
  195. ),
  196. child: Column(
  197. mainAxisSize: MainAxisSize.min,
  198. crossAxisAlignment: CrossAxisAlignment.center,
  199. children: <Widget>[
  200. Icon(Icons.warning,size: 70,color: Colors.indigo,),
  201. ],
  202. ),
  203. ),
  204. ),
  205. Flexible(
  206. flex: 1,
  207. child: Container(
  208. padding: EdgeInsets.only(left: 20,right: 20),
  209. alignment: Alignment.centerLeft,
  210. child: Text('Data belum disimpan. Lanjutkan ?',style: TextStyle(fontWeight: FontWeight.w500,fontSize: 14,color: Colors.black.withOpacity(0.6)),)
  211. ),
  212. ),
  213. Flexible(
  214. flex: 1,
  215. child: Container(
  216. padding: EdgeInsets.only(bottom:10),
  217. child: Row(
  218. mainAxisAlignment: MainAxisAlignment.end,
  219. children: <Widget>[
  220. TextButton(
  221. child: Text('Back',style: TextStyle(color: Colors.indigo),),
  222. onPressed: (){
  223. Navigator.pop(context);
  224. Navigator.pop(context);
  225. },
  226. ),
  227. TextButton(
  228. child: Text('Cancel',style: TextStyle(color: Colors.indigo)),
  229. onPressed: (){
  230. Navigator.pop(context);
  231. },
  232. ),
  233. ],
  234. ),
  235. ),
  236. )
  237. ],
  238. ),
  239. ),
  240. ),
  241. ),
  242. );
  243. }
  244. else Navigator.pop(context);
  245. }
  246. return false;
  247. },
  248. child: MultiBlocProvider(
  249. providers: [
  250. BlocProvider(
  251. create: (_)=>_unitImagesBloc,
  252. ),
  253. BlocProvider(
  254. create: (_)=>_saveUnitBloc,
  255. ),
  256. ],
  257. child:MultiBlocListener(
  258. listeners: [
  259. BlocListener<GetImagesBloc,GetImagesState>(
  260. listener: (context,state){
  261. if(state is GetImagesError){
  262. util.showFlushbar(context, state.err,color: Colors.red);
  263. }
  264. },
  265. ),
  266. BlocListener<SaveUnitBloc,SaveUnitState>(
  267. listener: (context,state){
  268. if(state is SaveFinish){
  269. if(state.success){
  270. Navigator.pop(context,true);
  271. }
  272. util.showFlushbar(context, state.msg,color: state.success?Colors.grey:Colors.red);
  273. }
  274. },
  275. ),
  276. ],
  277. child: BlocBuilder<GetImagesBloc,GetImagesState>(
  278. bloc: _unitImagesBloc,
  279. builder: (context,state){
  280. if(state is GetImagesLoading){
  281. return Center(
  282. child: Container(
  283. height: 15,
  284. width: 15,
  285. child: CircularProgressIndicator(),
  286. ),
  287. );
  288. }
  289. else if (state is GetImagesFinish){
  290. blobList = state.blobs;
  291. }
  292. else if (state is GetImagesInitial){
  293. loadUnitDetails();
  294. }
  295. return Container(
  296. padding: EdgeInsets.only(left:10,right: 10,bottom: 10),
  297. child: Column(
  298. children: <Widget>[
  299. Expanded(
  300. child: Row(
  301. children: <Widget>[
  302. Flexible(
  303. flex: 4,
  304. child: Container(
  305. height: MediaQuery.of(context).size.height,
  306. child:
  307. ListView.builder(
  308. // itemCount: ((images.length+1)>jenisLength)?jenisLength:images.length+1,
  309. itemCount: blobList.length,
  310. itemBuilder: (context, index){
  311. // Uint8List image = ((images.length==0)||(images.length<(index+1)))?null:images[index];
  312. Uint8List? image = blobList[index].bytes;
  313. return Padding(
  314. padding: const EdgeInsets.only(top: 10,right: 10),
  315. child: Material(
  316. child: InkWell(
  317. onTap: ()async{
  318. if(image==null){
  319. // var selected = await showDialog(
  320. // context: context,
  321. // builder: (context){
  322. // var selected = dropMenu[0].value;
  323. // return WillPopScope(
  324. // onWillPop: ()async{
  325. // Navigator.pop(context,false);
  326. // return false;
  327. // },
  328. // child: AlertDialog(
  329. // content: StatefulBuilder(
  330. // builder: (context,setState){
  331. // return DropdownButtonFormField(
  332. // decoration: InputDecoration.collapsed(),
  333. // value: selected,
  334. // onChanged: (value){
  335. // setState(() {
  336. // selected = value;
  337. // });
  338. // },
  339. // items: dropMenu.map((item) {
  340. // return new DropdownMenuItem<String>(
  341. // value: item.value,
  342. // child: Row(
  343. // children: <Widget>[
  344. // Text(item.value),
  345. //// (item.optional=='TRUE')?Container():Text(' *',style: TextStyle(color: Colors.red),)
  346. // ],
  347. // ),
  348. // );
  349. // }).toList(),
  350. // );
  351. // },
  352. // ),
  353. // actions: <Widget>[
  354. // TextButton(
  355. // child: Text('Done'),
  356. // onPressed: ()async{
  357. // jenisImages.add(selected);
  358. //
  359. // Navigator.pop(context,true);
  360. // },
  361. // ),
  362. // TextButton(
  363. // child: Text('Cancel'),
  364. // onPressed: (){
  365. // Navigator.pop(context,false);
  366. // },
  367. // ),
  368. // ],
  369. // ),
  370. // );
  371. // }
  372. // );
  373. // if (selected){
  374. XFile? temp = await ImagePicker().pickImage(source: ImageSource.camera,maxWidth: 800,imageQuality: 80);
  375. if(temp!=null){
  376. isChanged = true;
  377. blobList[index].bytes = await temp.readAsBytes();
  378. // if(widget.idInsert!=null) {
  379. // blobIds.add(null);
  380. // isChanged = true;
  381. // }
  382. setState(() {
  383. });
  384. }
  385. // else {
  386. // jenisImages.removeLast();
  387. // }
  388. // await loadDropMenu();
  389. // }
  390. }
  391. else {
  392. // List<ImageType> dropNewMenu = new List<ImageType>.from(dropMenu);
  393. // dropNewMenu.add(new ImageType(value: jenisImages[index]));
  394. var result = await Navigator.push(context, MaterialPageRoute(builder: (context) => PhotoViewer(image,id: widget.unit.id.toString()+'.$index',jenis: blobList[index].jenis,)));
  395. if(result!=null){
  396. blobList[index] = result['byte'];
  397. isChanged = true;
  398. // images[index] = result['byte'];
  399. // jenisImages[index] = result['jenis'];
  400. // await loadDropMenu();
  401. // if(widget.idInsert!=null) {
  402. // isChanged = true;
  403. // }
  404. setState(() {
  405. });
  406. }
  407. }
  408. },
  409. splashColor: Colors.grey,
  410. child: Column(
  411. children: <Widget>[
  412. Container(padding: EdgeInsets.all(5),child: Text(blobList[index].jenis)),
  413. Stack(
  414. children: <Widget>[
  415. Container(
  416. decoration: BoxDecoration(
  417. color: Colors.grey.withOpacity(0.7),
  418. image: (image!=null)?DecorationImage(
  419. image: MemoryImage(image),
  420. fit: BoxFit.cover
  421. ):null,
  422. ),
  423. height: MediaQuery.of(context).size.width*0.35,
  424. width: MediaQuery.of(context).size.width*0.35,
  425. child: (image==null)?Icon(Icons.add):null,
  426. ),
  427. (image!=null)?Container(
  428. height: MediaQuery.of(context).size.width*0.35,
  429. width: MediaQuery.of(context).size.width*0.35,
  430. alignment: Alignment.topRight,
  431. child: InkWell(
  432. onTap: ()async{
  433. // if(widget.idInsert!=null){
  434. // isChanged = true;
  435. // deleteBlobIds.add(blobIds[index]);
  436. // blobIds.removeAt(index);
  437. // }
  438. setState(() {
  439. blobList[index].bytes = null;
  440. // images.removeAt(index);
  441. // jenisImages.removeAt(index);
  442. });
  443. // await loadDropMenu();
  444. },
  445. child: Container(
  446. padding: EdgeInsets.all(5),
  447. child: Icon(Icons.cancel,color: Colors.red,)),
  448. ),
  449. ):Container(),
  450. ],
  451. ),
  452. ],
  453. ),
  454. ),
  455. ),
  456. );
  457. })
  458. ),
  459. ),
  460. Flexible(
  461. flex: 6,
  462. child: Container(
  463. alignment: Alignment.topLeft,
  464. padding: EdgeInsets.only(top: 10),
  465. child: SingleChildScrollView(
  466. scrollDirection: Axis.vertical,
  467. child: Column(
  468. mainAxisAlignment: MainAxisAlignment.start,
  469. children: <Widget>[
  470. // Divider(),
  471. // Row(
  472. // mainAxisAlignment: MainAxisAlignment.spaceBetween,
  473. // children: <Widget>[
  474. // Expanded(
  475. // child:
  476. // textfield??Container(),
  477. // ),
  478. // ],
  479. // ),
  480. Padding(
  481. padding: const EdgeInsets.all(5.0),
  482. child: Text('Units Details',style: TextStyle(fontSize: 18,fontWeight: FontWeight.bold),),
  483. ),
  484. Divider(),
  485. Row(
  486. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  487. children: <Widget>[
  488. Text('Tipe : '),
  489. Expanded(
  490. child:
  491. TextFormField(
  492. enabled: false,
  493. style: TextStyle(color: Colors.grey),
  494. controller: tipeController,
  495. decoration: InputDecoration.collapsed(hintText: null),
  496. ),
  497. ),
  498. ],
  499. ),
  500. Divider(),
  501. Row(
  502. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  503. children: <Widget>[
  504. Text('Mesin : '),
  505. Expanded(
  506. child: TextFormField(
  507. enabled: false,
  508. style: TextStyle(color: Colors.grey),
  509. controller: mesinController,
  510. decoration: InputDecoration.collapsed(hintText: null),
  511. ),
  512. ),
  513. ],
  514. ),
  515. Divider(),
  516. Row(
  517. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  518. children: <Widget>[
  519. Text('Rangka : '),
  520. Expanded(
  521. child: TextFormField(
  522. enabled: false,
  523. style: TextStyle(color: Colors.grey),
  524. controller: rangkaController,
  525. decoration: InputDecoration.collapsed(hintText: null),
  526. ),
  527. ),
  528. ],
  529. ),
  530. Divider(),
  531. Row(
  532. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  533. children: <Widget>[
  534. Text('Kode : '),
  535. Expanded(
  536. child: TextFormField(
  537. enabled: false,
  538. style: TextStyle(color: Colors.grey),
  539. controller: kodeController,
  540. decoration: InputDecoration.collapsed(hintText: null),
  541. ),
  542. ),
  543. ],
  544. ),
  545. Divider(),
  546. Row(
  547. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  548. children: <Widget>[
  549. Text('Tahun : '),
  550. Expanded(
  551. child: TextFormField(
  552. enabled: false,
  553. style: TextStyle(color: Colors.grey),
  554. controller: tahunController,
  555. decoration: InputDecoration.collapsed(hintText: null),
  556. ),
  557. ),
  558. ],
  559. ),
  560. Divider(),
  561. Row(
  562. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  563. children: <Widget>[
  564. Text('Warna : '),
  565. Expanded(
  566. child: TextFormField(
  567. enabled: false,
  568. style: TextStyle(color: Colors.grey),
  569. controller: colorController,
  570. decoration: InputDecoration.collapsed(hintText: null),
  571. ),
  572. ),
  573. ],
  574. ),
  575. Divider(),
  576. Row(
  577. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  578. children: <Widget>[
  579. Text('State : '),
  580. Expanded(
  581. child: TextFormField(
  582. enabled: false,
  583. style: TextStyle(color: Colors.grey),
  584. controller: stateController,
  585. decoration: InputDecoration.collapsed(hintText: null),
  586. ),
  587. ),
  588. ],
  589. ),
  590. Divider(),
  591. Row(
  592. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  593. children: <Widget>[
  594. Text('Channel : '),
  595. Expanded(
  596. child: TextFormField(
  597. enabled: false,
  598. style: TextStyle(color: Colors.grey),
  599. controller: channelController,
  600. decoration: InputDecoration.collapsed(hintText: null),
  601. ),
  602. ),
  603. ],
  604. ),
  605. Divider(),
  606. Row(
  607. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  608. children: <Widget>[
  609. TextButton(
  610. style: TextButton.styleFrom(
  611. backgroundColor: Colors.green,
  612. ),
  613. child: Text((widget.unit.flag=='FALSE')?'Add':'Save'),
  614. onPressed: ()async{
  615. if(currentPosisiton!=null) {
  616. if(blobList.where((element) => element.bytes!=null).length==blobList.length){
  617. _saveUnitBloc.add(Save(blobs: blobList, unit: _currentUnit));
  618. }
  619. else{
  620. util.showFlushbar(context, 'Tolong lengkapi data foto');
  621. }
  622. }
  623. else{
  624. util.showFlushbar(context, 'Gagal mengamil koordinat lokasi. Tolong cek gps.');
  625. }
  626. },
  627. ),
  628. TextButton(
  629. child: Text('Cancel'),
  630. onPressed: ()async {
  631. if(widget.unit.flag=='TRUE'){
  632. if(isChanged){
  633. await showDialog(context: context,builder: (context)=>
  634. Material(
  635. color: Colors.white.withOpacity(0.9),
  636. child: Center(
  637. child: Container(
  638. decoration: BoxDecoration(
  639. color: Colors.white,
  640. boxShadow: [
  641. BoxShadow(
  642. color: Colors.grey.withOpacity(0.5),
  643. spreadRadius: 2,
  644. blurRadius: 2,
  645. offset: Offset(0, 0), // changes position of shadow
  646. ),
  647. ],
  648. borderRadius: BorderRadius.circular(5)
  649. ),
  650. height:220,
  651. // height: MediaQuery.of(context).size.height/4.8,
  652. width: MediaQuery.of(context).size.width*0.75,
  653. child: Column(
  654. children: <Widget>[
  655. Flexible(
  656. flex:3,
  657. child: Container(
  658. padding: EdgeInsets.only(top:10,left: 10,right: 10),
  659. alignment: Alignment.center,
  660. decoration: BoxDecoration(
  661. // color: Colors.indigo,
  662. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5))
  663. ),
  664. child: Column(
  665. mainAxisSize: MainAxisSize.min,
  666. crossAxisAlignment: CrossAxisAlignment.center,
  667. children: <Widget>[
  668. Icon(Icons.warning,size: 70,color: Colors.indigo,),
  669. ],
  670. ),
  671. ),
  672. ),
  673. Flexible(
  674. flex: 1,
  675. child: Container(
  676. padding: EdgeInsets.only(left: 20,right: 20),
  677. alignment: Alignment.centerLeft,
  678. child: Text('Data belum disimpan. Lanjutkan ?',style: TextStyle(fontWeight: FontWeight.w500,fontSize: 14,color: Colors.black.withOpacity(0.6)),)
  679. ),
  680. ),
  681. Flexible(
  682. flex: 1,
  683. child: Container(
  684. padding: EdgeInsets.only(bottom:10),
  685. child: Row(
  686. mainAxisAlignment: MainAxisAlignment.end,
  687. children: <Widget>[
  688. TextButton(
  689. child: Text('Proceed'),
  690. onPressed: (){
  691. Navigator.pop(context);
  692. Navigator.popUntil(context,ModalRoute.withName('/stocking'));
  693. },
  694. ),
  695. TextButton(
  696. child: Text('Cancel'),
  697. // color: Colors.grey,
  698. onPressed: (){
  699. Navigator.pop(context);
  700. },
  701. ),
  702. ],
  703. ),
  704. ),
  705. )
  706. ],
  707. ),
  708. ),
  709. ),
  710. ),
  711. );
  712. }
  713. else Navigator.pop(context);
  714. }
  715. else {
  716. // bool not_empty = (stateController.text!='-'&&mesinController.text!='-'&&tahunController.text!='-'&&kodeController.text!='-'&&colorController.text!='-'&&rangkaController.text!='-'&&tipeController.text!='-');
  717. if(blobList.where((element) => element.bytes!=null).length!=0){
  718. await showDialog(context: context,builder: (context)=>
  719. Material(
  720. color: Colors.white.withOpacity(0.9),
  721. child: Center(
  722. child: Container(
  723. decoration: BoxDecoration(
  724. color: Colors.white,
  725. boxShadow: [
  726. BoxShadow(
  727. color: Colors.grey.withOpacity(0.5),
  728. spreadRadius: 2,
  729. blurRadius: 2,
  730. offset: Offset(0, 0), // changes position of shadow
  731. ),
  732. ],
  733. borderRadius: BorderRadius.circular(5)
  734. ),
  735. height:220,
  736. // height: MediaQuery.of(context).size.height/4.8,
  737. width: MediaQuery.of(context).size.width*0.75,
  738. child: Column(
  739. children: <Widget>[
  740. Flexible(
  741. flex:3,
  742. child: Container(
  743. padding: EdgeInsets.only(top:10,left: 10,right: 10),
  744. alignment: Alignment.center,
  745. decoration: BoxDecoration(
  746. // color: Colors.indigo,
  747. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5))
  748. ),
  749. child: Column(
  750. mainAxisSize: MainAxisSize.min,
  751. crossAxisAlignment: CrossAxisAlignment.center,
  752. children: <Widget>[
  753. Icon(Icons.warning,size: 70,color: Colors.indigo,),
  754. ],
  755. ),
  756. ),
  757. ),
  758. Flexible(
  759. flex: 1,
  760. child: Container(
  761. padding: EdgeInsets.only(left: 20,right: 20),
  762. alignment: Alignment.centerLeft,
  763. child: Text('Data belum disimpan. Lanjutkan ?',style: TextStyle(fontWeight: FontWeight.w500,fontSize: 14,color: Colors.black.withOpacity(0.6)),)
  764. ),
  765. ),
  766. Flexible(
  767. flex: 1,
  768. child: Container(
  769. padding: EdgeInsets.only(bottom:10),
  770. child: Row(
  771. mainAxisAlignment: MainAxisAlignment.end,
  772. children: <Widget>[
  773. TextButton(
  774. child: Text('Back'),
  775. onPressed: (){
  776. Navigator.pop(context);
  777. Navigator.popUntil(context,ModalRoute.withName('/stocking'));
  778. },
  779. ),
  780. TextButton(
  781. child: Text('Cancel'),
  782. onPressed: (){
  783. Navigator.pop(context);
  784. },
  785. ),
  786. ],
  787. ),
  788. ),
  789. )
  790. ],
  791. ),
  792. ),
  793. ),
  794. ),
  795. );
  796. }
  797. else Navigator.pop(context);
  798. }
  799. },
  800. style: TextButton.styleFrom(
  801. backgroundColor: Colors.redAccent,
  802. ),
  803. )
  804. ],
  805. )
  806. ],
  807. ),
  808. ),
  809. ),
  810. )
  811. ],
  812. ),
  813. ),
  814. ],
  815. ),
  816. );
  817. },
  818. ),
  819. ),
  820. ),
  821. ),
  822. );
  823. }
  824. }