flutter从0开始自学

flutter画第一个界面

2020-03-09  本文已影响0人  it奔跑在路上
image.png
class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colors.grey[400],
        appBar: AppBar(
          title: Text("Flutter开发的第一个页面"),
          centerTitle: true,
        ),
        body: Padding(
          padding: const EdgeInsets.all(12.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Image.network(
                  "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2218073646,118578367&fm=26&gp=0.jpg"),
              SizedBox(height: 10),
              Text(
                "左侧",
                style: TextStyle(fontSize: 20, color: Colors.red),
              ),
              SizedBox(
                height: 10,//设置高度的间距
              ),
              Center(
                child: Container(
                  color: Colors.amberAccent,//设置背景色
                  child: Text(
                    "居中",
                    style: TextStyle(fontSize: 20, color: Colors.red),
                  ),
                ),
              ),
              SizedBox(
                height: 10,
              ),
              Text(
                "还不会靠右",
                style: TextStyle(fontSize: 20, color: Colors.red),
              ),
              SizedBox(
                height: 10,
              ),
              Row(
                children: <Widget>[
                  Icon(
                    Icons.mail,
                    color: Colors.red,
                  ),
                  SizedBox(width: 10),
                  Text(
                    "runitwolf@163.com",
                    style:
                        TextStyle(fontSize: 15, color: Colors.amberAccent[300]),
                  ),
                ],
              )
            ],
          ),
        ));
  }
}
上一篇 下一篇

猜你喜欢

热点阅读