From 225a47e0a8a9f5f62c9bb5e71209af78e4b67b8a Mon Sep 17 00:00:00 2001 From: mht-sarina-ooba Date: Sat, 31 Oct 2020 19:34:53 +0900 Subject: [PATCH 1/5] =?UTF-8?q?Card=E8=A1=A8=E7=A4=BA=E8=AA=AD=E3=81=BF?= =?UTF-8?q?=E8=BE=BC=E3=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/card_list.dart | 0 lib/main.dart | 41 ++++++++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 lib/card_list.dart diff --git a/lib/card_list.dart b/lib/card_list.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/main.dart b/lib/main.dart index d04fa1b..eaa1bba 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_list_app/card_list.dart'; void main() { runApp(MyApp()); @@ -29,6 +30,27 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { + var _cardList = List(); + + @override + void initState() { + _cardList.add(CardList( + 'Text1', + )); + _cardList.add(CardList( + 'Text2', + )); + _cardList.add(CardList( + 'Text3', + )); + _cardList.add(CardList( + 'Text4', + )); + _cardList.add(CardList( + 'Text5', + )); + super.initState(); + } @override Widget build(BuildContext context) { @@ -37,17 +59,14 @@ class _MyHomePageState extends State { appBar: AppBar( title: Text('ListViewApp'), ), - body: ListView( - children: [ - _menueItem('メニュー1'), - _menueItem('メニュー2'), - _menueItem('メニュー3'), - _menueItem('メニュー4'), - _menueItem('メニュー5'), - _menueItem('メニュー6'), - _menueItem('メニュー7'), - ] - ), + body: Container( + child: ListView.builder( + itemCount: _cardList.length, + itemBuilder: (BuildContext context, int index) { + return _cardList[index]; + }, + ), + ) ), ); } From 628b41f23bde6215ec1dd0e9765bc3fb29bc7104 Mon Sep 17 00:00:00 2001 From: mht-sarina-ooba Date: Sat, 31 Oct 2020 19:35:10 +0900 Subject: [PATCH 2/5] =?UTF-8?q?Card=E3=81=AE=E3=83=87=E3=82=B6=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=95=E3=81=9B=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/card_list.dart | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/card_list.dart b/lib/card_list.dart index e69de29..93b3894 100644 --- a/lib/card_list.dart +++ b/lib/card_list.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; + +class CardList extends StatelessWidget { + final String _text; + + CardList(this._text); + + @override + Widget build(BuildContext context) { + return Card( + child: Column(mainAxisSize: MainAxisSize.max, children: [ + ListTile( + trailing: Icon(Icons.more_vert), + title: Text(_text), + subtitle: Text( + "This is subtitle. Subtitle is very long and use three lines."), + selected: true, + ) + ]), + ); + } +} From d0d135e1446547c75c933ba120593f1ab1b7c449 Mon Sep 17 00:00:00 2001 From: mht-sarina-ooba Date: Sat, 31 Oct 2020 19:36:03 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=83=89=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index eaa1bba..b30fc97 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -70,26 +70,4 @@ class _MyHomePageState extends State { ), ); } - - Widget _menueItem(String title) { - return GestureDetector( - child: Container( - padding: EdgeInsets.all(8.0), - decoration: new BoxDecoration( - border: new Border(bottom: BorderSide(width: 1.0, color: Colors.red)) - ), - child: Row( - children: [ - Text( - title, - style: TextStyle( - color: Colors.black, - fontSize: 20.0 - ) - ), - ], - ), - ), - ); - } } From e98afe93c58a645c13ecd34571b97351dafba8cd Mon Sep 17 00:00:00 2001 From: mht-sarina-ooba Date: Sat, 31 Oct 2020 20:22:51 +0900 Subject: [PATCH 4/5] =?UTF-8?q?Card=E3=81=ABFlutterLogo=E3=82=92=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=81=95=E3=81=9B=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/card_list.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/card_list.dart b/lib/card_list.dart index 93b3894..0340941 100644 --- a/lib/card_list.dart +++ b/lib/card_list.dart @@ -10,7 +10,7 @@ class CardList extends StatelessWidget { return Card( child: Column(mainAxisSize: MainAxisSize.max, children: [ ListTile( - trailing: Icon(Icons.more_vert), + leading: FlutterLogo(), title: Text(_text), subtitle: Text( "This is subtitle. Subtitle is very long and use three lines."), From ae3ef4409cb13edb23aa1847b1cd5047222ba4ae Mon Sep 17 00:00:00 2001 From: mht-sarina-ooba Date: Sat, 31 Oct 2020 20:26:28 +0900 Subject: [PATCH 5/5] =?UTF-8?q?List=E3=82=9211=E4=BB=B6=E3=81=BE=E3=81=A7?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index b30fc97..343ea68 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,9 +21,10 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); + MyHomePage({Key key, this.title, this.thumbnail}) : super(key: key); final String title; + final thumbnail; @override _MyHomePageState createState() => _MyHomePageState(); @@ -49,6 +50,24 @@ class _MyHomePageState extends State { _cardList.add(CardList( 'Text5', )); + _cardList.add(CardList( + 'Text6', + )); + _cardList.add(CardList( + 'Text7', + )); + _cardList.add(CardList( + 'Text8', + )); + _cardList.add(CardList( + 'Text9', + )); + _cardList.add(CardList( + 'Text10', + )); + _cardList.add(CardList( + 'Text11', + )); super.initState(); }