ex:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Text示例'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(Icons.person),
SizedBox(
height: 10.0,
),
IconButton(icon: Icon(Icons.error), onPressed: () {}),
Container(
height: 20.0,
color: Colors.blue,
),
RaisedButton(
onPressed: () {},
child: Text('RaisedButton'),
),
],
),
),
),
);
}
}
结果:

本文详细介绍了一个使用Flutter框架搭建的应用示例,从导入包到主函数的设置,再到具体组件的使用,如Scaffold、AppBar、IconButton等,展示了Flutter构建美观且功能丰富的用户界面的过程。
2856

被折叠的 条评论
为什么被折叠?



