//引入库
import 'package:flutter/material.dart';
//主函数
void main() => runApp(MyApp());
//类,继承无状态组件
class MyApp extends StatelessWidget {
//重写函数
@override
//返回值为Widget类型
Widget build(BuildContext context) {
//对应函数类型返回值
return MaterialApp(
//dart结构,title和home
title: 'flutter study',
//home,故用脚手架
home: Scaffold(
//顶上一个appBar
appBar: AppBar(
title: Text('ListView Widget'),
),
//中间是身体
body: ListView(
//当其中的内容超出屏幕尺寸时可通过下拉查看
children: <Widget>[
Image.network(
'http://s1.52poke.wiki/wiki/thumb/0/0d/025Pikachu.png/260px-025Pikachu.png'),
ListTile(leading: Icon(Icons.favorite), title: Text('favorite')),
ListTile(
leading: Icon(Icons.access_alarm),
title: Text('access_alarm')),
ListTile(
leading: Icon(Icons.directions_run),
title: Text('pikachu'),
subtitle: Text('running'),
),
ListTile(
leading: Icon(Icons.home),
title: Text('home'),
),
],
)),
);
}
}
运行效果: