Hello guys how are you all? Hope you all are fine. As we know RaisedButton is deprecated and the Elevated button is replacing Raised Button widget with its new features. Here in this tutorial, we are going to learn How to Change Background color of Elevated Button in Flutter.
How to Change Background color of Elevated Button in Flutter
Suppose we need to change Elevated Button Background color then? Elevated Button has a style Property And style property need ButtonStyle(). ButtonStyle has backgroundColor property which requires MaterialStateProperty. You can simply assign background color by MaterialStateProperty.all<Color>(Colors.green). Let’s explore examples of Background color of Elevated Button in Flutter.
Example
ElevatedButton(
onPressed: () {
print('Button Pressed');
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.green),
),
child: Text('FlutterCorner.com'),
),
Output

Faq
- How to Change Background color of Elevated Button in Flutter ?
to Change Background color of Elevated Button in Flutter Elevated Button has a style Property And style property need ButtonStyle(). ButtonStyle has backgroundColor property which requires MaterialStateProperty. You can simply assign background color by MaterialStateProperty.all<Color>(Colors.green).
- Change Background color of Elevated Button in Flutter ?
Change Background color of Elevated Button in Flutter Elevated Button has a style Property And style property need ButtonStyle(). ButtonStyle has backgroundColor property which requires MaterialStateProperty. You can simply assign background color by MaterialStateProperty.all<Color>(Colors.green).
Summery
So it’s all About this tutorial. Hope this above-all solution helped you a lot. Comment below Your thoughts and your queries. Comment Below on your suggestion.
Check Out Below Article
- Waiting for another flutter command to release the startup lock
- Scaffold.of() called with a context that does not contain a Scaffold
- Flutter Error: RangeError (index): Invalid value: Not in range 0..2, inclusive: 3
- How to solve SocketException: Failed host lookup: ‘flutter-project-xxxxx.firebaseio.com’ (OS Error: No address associated with hostname, errno = 7)
- Flutter BottomNavigationBar not working with more than three items
Leave a Reply