「Flutter/UI/ListView/基本」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「 <pre> class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { const data = [ "taro", "jiro", "saburo", ];...」) |
|||
行1: | 行1: | ||
− | + | 枠線なし | |
<pre> | <pre> | ||
class _MyHomePageState extends State<MyHomePage> { | class _MyHomePageState extends State<MyHomePage> { | ||
行26: | 行26: | ||
https://nzigen.com/flutter-reference/2018-04-17-list-view.html | https://nzigen.com/flutter-reference/2018-04-17-list-view.html | ||
+ | |||
+ | 枠線あり | ||
+ | <pre> | ||
+ | class _MyHomePageState extends State<MyHomePage> { | ||
+ | |||
+ | @override | ||
+ | Widget build(BuildContext context) { | ||
+ | const data = [ | ||
+ | "taro", "jiro", "saburo", | ||
+ | ]; | ||
+ | return Scaffold( | ||
+ | appBar: AppBar( | ||
+ | title: Text(widget.title), | ||
+ | ), | ||
+ | body: ListView.builder( | ||
+ | itemCount: data.length, | ||
+ | itemBuilder: (context, int index) { | ||
+ | return Card( | ||
+ | child: Padding( | ||
+ | child: Text(data[index],), | ||
+ | padding: EdgeInsets.all(20.0),), | ||
+ | ); | ||
+ | }, | ||
+ | ), | ||
+ | ); | ||
+ | } | ||
+ | } | ||
+ | </pre> |
2019年4月25日 (木) 19:08時点における版
枠線なし
class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { const data = [ "taro", "jiro", "saburo", ]; return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: ListView.builder( itemCount: data.length, itemBuilder: (context, int index) { return Padding( padding: EdgeInsets.all(8.0), child: Text( data[index], )); }, ), ); }
https://nzigen.com/flutter-reference/2018-04-17-list-view.html
枠線あり
class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { const data = [ "taro", "jiro", "saburo", ]; return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: ListView.builder( itemCount: data.length, itemBuilder: (context, int index) { return Card( child: Padding( child: Text(data[index],), padding: EdgeInsets.all(20.0),), ); }, ), ); } }