RaisedButton(
onPressed: null,
child: Text('Get in'), // change it to sign-in
color: Colors.blue,
)
I am creating this widget under children, but the color is not getting changed from its default grey color. I tried with hex code value but still no help.
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.
Go to your main. Inside the MaterialApp, find the ThemeData widget. Add the elevatedButtonTheme property inside and assign the ElevatedButtonThemeData(). Add the style property and change the color as you would change it for normal ElevatedButton. Place the ElevatedButton widget anywhere in your Flutter app and see.
Elevated Buttons cannot be styled i.e. you cannot modify the color of the button, font size, text style, etc explicitly like raised buttons. This class was launched in version 1.22 of flutter. You can pass text or icons as a child to them.
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.
From RaisedButton documentation:
If the [onPressed] callback is null, then the button will be disabled and by default will resemble a flat button in the [disabledColor]. If you are trying to change the button's [color] and it is not having any effect, check that you are passing a non-null [onPressed] handler.
RaisedButton color depends on is it onPress able or not like this one. You should add onPressed into the attribute
RaisedButton(
onPressed: () => {},
color: Colors.green,
child: Text(
'Login',
style: TextStyle(color: Colors.white),
),
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With