简体   繁体   中英

How to change background color in a text button in flutter

How should I change the background color of the text and icon at the same time in a text button in flutter???? I used flat button before but the "vs code " editor said its deprecated.

        TextButton(onPressed: (){}, child: Text("test"),style: ButtonStyle(
        minimumSize: MaterialStateProperty.all(
            Size(80, 29)),
        padding: MaterialStateProperty.all(
            EdgeInsets.zero),
        backgroundColor:
        MaterialStateProperty.all(
            Color(0xFF3D7FFF))),)
TextButton(
    child: Text('test'),
    style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Colors.red)),
    onPressed: () {},
),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM