Set Change Raised Button Background Color in Flutter iOS Android

The Raised Button in flutter by default comes with a Argument or Prop named as color. The color argument is used to Set Change Raised Button Background Color in Flutter iOS Android mobile app. Color can support all the useful formats like Hex color code, ARGB, RGBA and also color constants. We can pass here any color and our Raised button will generated that particular background color.

Contents in this project Set Change Raised Button Background Color in Flutter iOS Android App Example :

1. Import material.dart package in your app’s main.dart file.

2. Call our main MyApp class using void main runApp().

3. Create our main MyApp class extends with State Less Widget.

4. Create a function named as tmpFunction() in our MyApp class. In this function we would simply print a message using dart print() function on Command Prompt or Terminal screen. We would call this function on button OnPress event.

5. Create Widget build area then create Scaffold widget -> Center widget -> Column widget. We would put all our 3 buttons in Column widget.

5. Create 3 Raised Button Widgets in Column widget.

  • Color : Used to define Background color of Raised button widget. We are using Hex color code here.

Color code = 0xff + HEX Color code

6. Complete source code for main.dart file:

Screenshots:

Set Change Raised Button Background Color in Flutter iOS Android

Leave a Reply

Your email address will not be published. Required fields are marked *