Try this
class MyExpansionTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ExpansionTile(
title: Text(
'Example',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w500),
),
collapsedTextColor: Colors.green,
textColor: Colors.blue
);
}
}
for more details Collapsed Text Color
create ThemeData and define expansionTileTheme in it. You can also create different themes for dark and light modes
final appTheme = ThemeData(
colorScheme:ColorScheme(
//....
),
expansionTileTheme:ExpansionTileThemeData(
textColor: Colors.grey,
iconColor: Colors.grey
),// This Part
cardColor: Colors.grey[900],
appBarTheme: AppBarTheme(
color: Colors.lightBlueAccent[500],
foregroundColor: Colors.white70
),
scaffoldBackgroundColor: Colors.black,
fontFamily: 'Montserrat',
);
add it to materialApp
MaterialApp(
navigatorKey: navigatorKey,
scaffoldMessengerKey: scaffoldMessengerKey,
theme: appTheme,
darkTheme: darkTheme,
themeMode: brightness == null
? ThemeMode.system
: brightness == Brightness.dark
? ThemeMode.dark
: ThemeMode.light,
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.