美文网首页flutter从0开始自学
flutter从零开始使用(四)

flutter从零开始使用(四)

作者: it奔跑在路上 | 来源:发表于2020-03-08 20:37 被阅读0次
设置icon
image.png
image.png
设置button
image.png
icon和button一起使用
image.png
iconButton的使用
image.png

所有代码:


class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          "标题",
          style: TextStyle(
            fontWeight: FontWeight.bold,
            fontSize: 25,
          ),
        ),
        backgroundColor: Colors.red[300],
        centerTitle: true,
      ),
      body: Center(
        child: IconButton(
            icon: Icon(Icons.print),
            onPressed: () {
              print("IconButton被点击了");
            }),

//        child: RaisedButton.icon(
//          onPressed: () {
//            print("RaisedButton.icon被点击了");
//          },
//          icon: Icon(Icons.account_circle),
//          label: Text("RaisedButton.icon"),
//          color: Colors.red,
//        ),

//        child: RaisedButton(
//          onPressed: () {
//            print("RaisedButton被点击了");
//          },
//          child: Text("按钮"),
//          color: Colors.blueAccent[400],//这里设置的是按钮的背景色,改文字的背景色在Text("按钮")里面改
//        ),

//        child: Icon(
//          Icons.access_alarm,//可以调用系统的一些图片
//          color: Colors.amberAccent[300],
//          size: 80,
//        ),
      ),
    );
  }
}

相关文章

网友评论

    本文标题:flutter从零开始使用(四)

    本文链接:https://www.haomeiwen.com/subject/opbjdhtx.html