Skip to content

Commit

Permalink
Stack으로 배경container 넣음, BookItem 이미지 아래에 책이름 표시
Browse files Browse the repository at this point in the history
하단에 overflow 되는 문제 Flexible() 위젯으로 해결
  • Loading branch information
kangsudal committed Nov 5, 2019
1 parent d10ec70 commit fef6d1a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
9 changes: 7 additions & 2 deletions lib/page/book_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -15,7 +15,12 @@ class BookItem extends StatelessWidget {
return Padding(
padding: const EdgeInsets.all(8.0),
child:
image
Column(
children: <Widget>[
Flexible(child: image),
Text('$bookName')
],
)

);
}
Expand Down
20 changes: 13 additions & 7 deletions lib/page/shelfdetailpage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ class _ShelfDetailPageState extends State<ShelfDetailPage> {
)
],
),
body:
Center(
child: Container(
padding: EdgeInsets.only(top:10),
color: Colors.deepPurple[300],
body: Stack(
children: <Widget>[
Container(
decoration: new BoxDecoration(
color: Colors.deepPurple[300],
),
),
Container(
padding: EdgeInsets.only(top: 10),

child: GridView.builder(
shrinkWrap: true,
itemCount: _bookCounter,
Expand All @@ -66,8 +71,9 @@ class _ShelfDetailPageState extends State<ShelfDetailPage> {
itemBuilder: _buildItem,
),
),
)
,
],
),

floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
Expand Down

0 comments on commit fef6d1a

Please sign in to comment.