这只是其中几种简单的方法,后续会补充,请持续关注
这是完整dome代码,直接复制放入main.dart就可以了
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
primarySwatch: Colors.red,
),
home: Scaffold(
appBar: AppBar(
title: Text("text实例dome"),
),
body: Center(
child: Column(
//垂直居中
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.person),
SizedBox(
height: 10,
),
//可以互交的icon
IconButton(icon: Icon(Icons.error), onPressed: () {}),
SizedBox(
height: 10,
),
RaisedButton(
onPressed: () {},
child: Text("RaisedButton"),
)
],
),
),
));
}
}