Answers for "how to give color to an elevatedbutton in flutter"

3

ElevatedButton flutter style

ElevatedButton(
  style: ElevatedButton.styleFrom(
  onPrimary: Colors.black87,
  primary: Colors.grey[300],
  minimumSize: Size(88, 36),
  padding: EdgeInsets.symmetric(horizontal: 16),
  shape: ElevatedButton.styleFrom(
    primary: ThemeColors.darkBg,
    shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0), side: BorderSide(color: Colors.black)),
    ),
  onPressed: () { },
  child: Text('Looks like a RaisedButton'),
)
Posted by: Guest on June-08-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

Code answers related to "how to give color to an elevatedbutton in flutter"

Browse Popular Code Answers by Language