From 1e86eef0116cad4ce31e428ff7207a9e726ee1e9 Mon Sep 17 00:00:00 2001 From: chayoosang Date: Sun, 3 Dec 2023 22:56:29 +0900 Subject: [PATCH] =?UTF-8?q?[PDA-45]=20fix:=20=EB=B9=84=ED=92=88=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80,=20=EC=88=98=EC=A0=95,=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20=EC=8B=9C=20=EB=B9=84=ED=92=88=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EC=83=88=EB=A1=9C=EA=B3=A0=EC=B9=A8=20=EB=90=A0=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/equipment_add_screen.dart | 7 ++---- .../equipment/screen/equipment_screen.dart | 24 +++++++++++-------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/View/equipment/screen/equipment_add_screen.dart b/lib/View/equipment/screen/equipment_add_screen.dart index 9408884..2bcf5b8 100644 --- a/lib/View/equipment/screen/equipment_add_screen.dart +++ b/lib/View/equipment/screen/equipment_add_screen.dart @@ -93,7 +93,7 @@ class _EquipmentAddScreen extends State { appBar: SubAppBar( titleText: widget.equipment == null ? '신규 비품 추가' : "비품 수정", ), - body: futureBody(), + body: SingleChildScrollView(child: futureBody()), bottomNavigationBar: PurpleBottomButton( title: widget.equipment == null ? '추가' : "수정", onPressed: checkEssential, @@ -542,10 +542,7 @@ class _EquipmentAddScreen extends State { name, quantity); result.then((value) => { - if (value == true) - {Navigator.of(context).pop(), Navigator.of(context).pop()} - else - {showAlert(value)} + if (value == true) {moveToPop()} else {showAlert(value)} }); } } diff --git a/lib/View/equipment/screen/equipment_screen.dart b/lib/View/equipment/screen/equipment_screen.dart index 9da973c..574a796 100644 --- a/lib/View/equipment/screen/equipment_screen.dart +++ b/lib/View/equipment/screen/equipment_screen.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:frontend/Model/model/equipment/equipment_list_model.dart'; +import 'package:frontend/Model/model/general_model.dart'; import 'package:frontend/Presenter/equipment/equipment_service.dart'; import 'package:frontend/View/colors.dart'; import 'package:frontend/View/common/component/main_app_bar.dart'; @@ -45,6 +46,10 @@ class EquipmentScreenState extends State return FutureBuilder( future: fetchData(), builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState != ConnectionState.done) { + return const CircularProgressIndicator(); + } + if (snapshot.hasError) { return noDataBody(); } @@ -434,12 +439,11 @@ class EquipmentScreenState extends State ], ), ); - }).then((value) { - setState(() {}); - }); + }); } void showDeleteSheet(EquipmentModel equipment) { + Navigator.of(context).pop(); showModalBottomSheet( context: context, shape: RoundedRectangleBorder( @@ -512,7 +516,9 @@ class EquipmentScreenState extends State ), ); }).then((value) { - setState(() {}); + setState(() { + reloadData(); + }); }); } @@ -538,6 +544,7 @@ class EquipmentScreenState extends State } void editEquipment(EquipmentModel equipment) { + Navigator.of(context).pop(); Navigator.of(context) .push(MaterialPageRoute( builder: (_) => EquipmentAddScreen(equipment: equipment))) @@ -549,12 +556,9 @@ class EquipmentScreenState extends State void deleteEquipment(EquipmentModel equipment) { Future result = EquipmentService().deleteEquipment(equipment.equipmentId); - result.then((value) => { - if (value == true) - {Navigator.of(context).pop(), Navigator.of(context).pop()} - else - {Fluttertoast.showToast(msg: value)} - }); + + Navigator.of(context).pop(); + setState(() {}); } void popNavi() {