网页地址:网页演示
(网页比较慢)
参考:原文
一. 创建项目
flutter create example009_listview
二. AS打开
三. 添加依赖、放入资源文件
四. 编写代码
main.dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: new AppBar(title: new Text('ListView Widget')),
body: new ListView(
children: <Widget>[
new ListTile(
leading: new Icon(Icons.perm_camera_mic),
title: new Text('拍照')),
new ListTile(
leading: new Icon(Icons.add_call),
title: new Text('打电话')),
new ListTile(
leading: new Icon(Icons.add_shopping_cart),
title: new Text('购物')),
],
)
)
);
}
}
5. 调试运行
AS中先打开Android或者iOS模拟器,点运行按钮。
或在命令行中运行:
flutter run
6. 打包web
flutter build web
源码
https://gitee.com/ruik2080/example-flutter