From fef6d1abfb0881795b46b415815b22797d417fd3 Mon Sep 17 00:00:00 2001 From: kangsudal Date: Wed, 6 Nov 2019 04:56:18 +0900 Subject: [PATCH] =?UTF-8?q?Stack=EC=9C=BC=EB=A1=9C=20=EB=B0=B0=EA=B2=BDcon?= =?UTF-8?q?tainer=20=EB=84=A3=EC=9D=8C,=20=20BookItem=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=EC=95=84=EB=9E=98=EC=97=90=20=EC=B1=85=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 하단에 overflow 되는 문제 Flexible() 위젯으로 해결 --- lib/page/book_item.dart | 9 +++++++-- lib/page/shelfdetailpage.dart | 20 +++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/page/book_item.dart b/lib/page/book_item.dart index 4994027..300a092 100644 --- a/lib/page/book_item.dart +++ b/lib/page/book_item.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; class BookItem extends StatelessWidget { - // final String bookName; + final String bookName='book name'; // final int bookNum; // const BookItem({Key key, this.bookName, this.bookNum}) : super(key: key); @@ -15,7 +15,12 @@ class BookItem extends StatelessWidget { return Padding( padding: const EdgeInsets.all(8.0), child: - image + Column( + children: [ + Flexible(child: image), + Text('$bookName') + ], + ) ); } diff --git a/lib/page/shelfdetailpage.dart b/lib/page/shelfdetailpage.dart index 0832d04..409edaf 100644 --- a/lib/page/shelfdetailpage.dart +++ b/lib/page/shelfdetailpage.dart @@ -53,11 +53,16 @@ class _ShelfDetailPageState extends State { ) ], ), - body: - Center( - child: Container( - padding: EdgeInsets.only(top:10), - color: Colors.deepPurple[300], + body: Stack( + children: [ + Container( + decoration: new BoxDecoration( + color: Colors.deepPurple[300], + ), + ), + Container( + padding: EdgeInsets.only(top: 10), + child: GridView.builder( shrinkWrap: true, itemCount: _bookCounter, @@ -66,8 +71,9 @@ class _ShelfDetailPageState extends State { itemBuilder: _buildItem, ), ), - ) - , + ], + ), + floatingActionButton: FloatingActionButton( onPressed: _incrementCounter, tooltip: 'Increment',