Skip to content

Commit

Permalink
[PDA-45] fix: 비품 추가, 수정, 삭제 시 비품 화면 새로고침 될 수 있게 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
chayoosang committed Dec 3, 2023
1 parent 050771f commit 1e86eef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
7 changes: 2 additions & 5 deletions lib/View/equipment/screen/equipment_add_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class _EquipmentAddScreen extends State<EquipmentAddScreen> {
appBar: SubAppBar(
titleText: widget.equipment == null ? '신규 비품 추가' : "비품 수정",
),
body: futureBody(),
body: SingleChildScrollView(child: futureBody()),
bottomNavigationBar: PurpleBottomButton(
title: widget.equipment == null ? '추가' : "수정",
onPressed: checkEssential,
Expand Down Expand Up @@ -542,10 +542,7 @@ class _EquipmentAddScreen extends State<EquipmentAddScreen> {
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)}
});
}
}
Expand Down
24 changes: 14 additions & 10 deletions lib/View/equipment/screen/equipment_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -45,6 +46,10 @@ class EquipmentScreenState extends State<EquipmentScreen>
return FutureBuilder<dynamic>(
future: fetchData(),
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState != ConnectionState.done) {
return const CircularProgressIndicator();
}

if (snapshot.hasError) {
return noDataBody();
}
Expand Down Expand Up @@ -434,12 +439,11 @@ class EquipmentScreenState extends State<EquipmentScreen>
],
),
);
}).then((value) {
setState(() {});
});
});
}

void showDeleteSheet(EquipmentModel equipment) {
Navigator.of(context).pop();
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
Expand Down Expand Up @@ -512,7 +516,9 @@ class EquipmentScreenState extends State<EquipmentScreen>
),
);
}).then((value) {
setState(() {});
setState(() {
reloadData();
});
});
}

Expand All @@ -538,6 +544,7 @@ class EquipmentScreenState extends State<EquipmentScreen>
}

void editEquipment(EquipmentModel equipment) {
Navigator.of(context).pop();
Navigator.of(context)
.push(MaterialPageRoute(
builder: (_) => EquipmentAddScreen(equipment: equipment)))
Expand All @@ -549,12 +556,9 @@ class EquipmentScreenState extends State<EquipmentScreen>
void deleteEquipment(EquipmentModel equipment) {
Future<dynamic> 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() {
Expand Down

0 comments on commit 1e86eef

Please sign in to comment.