facebook twitter hatena line email

「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> {
 
 
   @override
 
   @override
 
   Widget build(BuildContext context) {
 
   Widget build(BuildContext context) {

2019年4月19日 (金) 18:05時点における版

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