Answers for "button background color flutter"

4

textbutton background color flutter

// first way (most upvoted)
TextButton(
    child: Text('test'),
    style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Colors.red)),
    onPressed: () {},
),

// second way 
TextButton(
  child: Text('Example'),
  onPressed: () {},
  style: TextButton.styleFrom(backgroundcolor: Colors.red),
)

// third way
TextButton(
  onPressed: () {},
  child: Container(
    padding: EdgeInsets.fromLTRB(30, 10, 30, 10),
    color: Colors.red,
    child: Text(""),
  ),
)
Posted by: Guest on June-15-2021
1

How to change background color of Elevated Button in flutter

ElevatedButton(
              style: ElevatedButton.styleFrom(
                primary: Colors.amber,
              ), 
              child: Text('ElevatedButton'),
              onPressed: () {},
            ),
Posted by: Guest on August-24-2021
0

add background color to button flutte

bool isButtonPressed = false;

RaisedButton(
            color: isButtonPressed ? Colors.green : Colors.red,
            onPressed: () {
              setState(() {
                isButtonPressed =!isButtonPressed;
              });
            },
          ),
Posted by: Guest on February-04-2021
0

how to change background color in ElevateButton flutter

how to change background color in ElevateButton flutter
style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Colors.red)),
Posted by: Guest on November-01-2021

Code answers related to "button background color flutter"

Browse Popular Code Answers by Language