码迷,mamicode.com
首页 > 其他好文 > 详细

flutter 长列表

时间:2020-01-07 00:47:47      阅读:100      评论:0      收藏:0      [点我收藏+]

标签:one   dex   appbar   mat   build   item   列表   style   index   

 

import package:flutter/foundation.dart;
import package:flutter/material.dart;

void main() {
  runApp(new MyApp(
    items: new List<String>.generate(10000, (i) => "Item $i"),
  ));
}

class MyApp extends StatelessWidget {
  final List<String> items;

  MyApp({Key key, @required this.items}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final title = Long List;

    return new MaterialApp(
      title: title,
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text(title),
        ),
        body: new ListView.builder(
          itemCount: items.length,
          itemBuilder: (context, index) {
            return new ListTile(
              title: new Text(${items[index]}),
            );
          },
        ),
      ),
    );
  }
}

 

 

 

 

flutter 长列表

标签:one   dex   appbar   mat   build   item   列表   style   index   

原文地址:https://www.cnblogs.com/sea-stream/p/12159067.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!