Flutter(十一)基础控件-Button

感君一回顾,思君朝与暮。

<一> Flutter中的Button有ElevatedButton、TextButton、OutlinedButton、IconButton等

  • 代码
    class ButtonDemo extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return Column(
        children: [
          ElevatedButton(
            onPressed: () {
              print('点击事件');
            },
            child: Text('漂浮按钮'),
          ),
          TextButton(
            onPressed: () {
              print('点击事件');
            },
            child: Text("漂浮按钮"),
          ),
          TextButton.icon(
              label: Text("data"),
              onPressed: () {
                print('点击事件');
              },
              icon: Icon(Icons.add),
              style: TextButton.styleFrom(backgroundColor: Colors.red)
          ),
          OutlinedButton(onPressed: () {}, child: Text("OutlinedButton")),
          IconButton(onPressed: () {}, icon: Icon(Icons.home))
        ],
      );
    }
    }
    
image.png

你可能感兴趣的:(Flutter(十一)基础控件-Button)