Answers for "background color button 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
7

elevated button flutter color

ElevatedButton(
  style: ButtonStyle(
    backgroundColor: MaterialStateProperty.resolveWith<Color>(
      (Set<MaterialState> states) {
        if (states.contains(MaterialState.pressed))
          return Colors.green;
        return null; // Use the component's default.
      },
    ),
  ),
)
Posted by: Guest on March-05-2021
0

elevated Button Theme background color in flutter

style: ElevatedButton.styleFrom(
              primary: Colors.purple,
            ),
Posted by: Guest on April-06-2021

Code answers related to "background color button flutter"

Browse Popular Code Answers by Language