Skip to content

Commit

Permalink
책추가 다이얼로그 취소했을때 쓰레기 값 안들어가게 하기
Browse files Browse the repository at this point in the history
책 눌렀을때랑, 꾹눌렀을때 gesture 추가
  • Loading branch information
kangsudal committed Nov 13, 2019
1 parent 610b7d3 commit 57092d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
8 changes: 6 additions & 2 deletions lib/page/book_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ class BookItem extends StatelessWidget {
);
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[Flexible(child: image), Text('$item.name')],
child: GestureDetector(
onTap: (){print("상세보기페이지");},
onLongPress: (){print("책 수정 방법을 선택해주세요.");},
child: Column(
children: <Widget>[Flexible(child: image), Text('$item.name')],
),
));
}
}
17 changes: 10 additions & 7 deletions lib/page/shelfdetailpage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ class _ShelfDetailPageState extends State<ShelfDetailPage> {
void _addBook() async {
dynamic newBook = await _asyncInputDialog(context);
print("New book name is $newBook");
int index = selectedItem == null
? _bookList.length
: _bookList.indexOf(selectedItem);
setState(() {
_bookList.insert(index, newBook);
});
print(_bookList.length);
//dissmiss 처리
if (newBook != null && newBook != '') {
int index = selectedItem == null
? _bookList.length
: _bookList.indexOf(selectedItem);
setState(() {
_bookList.insert(index, newBook);
});
print(_bookList.length);
}
}

Future<String> _asyncInputDialog(BuildContext context) async {
Expand Down

0 comments on commit 57092d0

Please sign in to comment.