Answers for "change color in elevated button"

2

elevated button background color

ElevatedButton(
        style: ButtonStyle(
             backgroundColor: MaterialStateProperty.resolveWith<Color>(
                (Set<MaterialState> states) {
            if (states.contains(MaterialState.pressed))
              return Colors.green;
            return Colors.green;
          },
        ),
     ),
 )
Posted by: Guest on April-14-2022
0

ElevatedButton change color

ElevatedButton(
      child: Text('Button'),
      onPressed: () {},
      style: ElevatedButton.styleFrom({
           Color primary, // set the background color 
           Color onPrimary, 
           Color onSurface, 
           Color shadowColor, 
           double elevation, 
           TextStyle textStyle, 
           EdgeInsetsGeometry padding, 
           Size minimumSize, 
           BorderSide side, 
           OutlinedBorder shape, 
           MouseCursor enabledMouseCursor, 
           MouseCursor disabledMouseCursor, 
           VisualDensity visualDensity, 
           MaterialTapTargetSize tapTargetSize, 
           Duration animationDuration, 
           bool enableFeedback
     }),
),
Posted by: Guest on May-12-2021

Code answers related to "change color in elevated button"

Browse Popular Code Answers by Language