What is the theme code for the ElevatedButton? I do not know how to put Icon Button and Elevated Button in MyThemes class so that I can change their colors

Expanded(
child: Padding(
padding: EdgeInsets.only(
top: 20,
bottom: 20,
left: 20,
right: 20
),
child: SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,MaterialPageRoute(
builder: (_) => Biography()));
},
style: ElevatedButton.styleFrom(
// background color
primary: color_white,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
icon: Image.asset('pic/biography.png'),
iconSize: 70,
onPressed: null,
),
AutoSizeText(
"بـیـوگرافی"
,maxLines: 1
,overflow: TextOverflow.ellipsis,
minFontSize: 10,
style:TextStyle(fontSize: 25,color: color_black,fontWeight: FontWeight.w500),
),
],
),
),
),
),
),
And how to give them all a theme for the ElevatedButton and Expanded sections
When defining your application ThemeData you have a named property named elevatedButtonTheme which is an ElevatedButtonThemeData.
Custom Theme code Sample
class MyTheme {
static final ThemeData light = _buildLightTheme();
static final ThemeData dark = _buildDarkTheme();
static ThemeData _buildLightTheme() {
final ThemeData base = ThemeData.light();
return base;
}
static ThemeData _buildDarkTheme() {
final ThemeData base = ThemeData.dark();
return base.copyWith(
elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle(
// Makes all my ElevatedButton green
backgroundColor: MaterialStateProperty.all<Color>(Colors.green),
),
),
);
}
}
Screenshot

Try the full code on DartPad
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