Home > Software design >  How to change background color in a text button in flutter
How to change background color in a text button in flutter

Time:06-27

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.

CodePudding user response:

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

CodePudding user response:

TextButton(
    child: Text('test'),
    style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Colors.red)),
    onPressed: () {},
),
  • Related