Loading...
Loading...
Customizes the visual appearance of a Flutter app using the theming system. Use when defining global styles, colors, or typography for an application.
npx skill4agent add flutter/skills flutter-theming-appsthemeMaterialAppThemeDataThemeTheme.of(context).copyWith(...)ThemeDataaccentColorcolorScheme.secondaryaccentTextThemetextThemecolorScheme.onSecondaryAppBarTheme.colorAppBarTheme.backgroundColorColorScheme.fromSeed(seedColor: Colors.blue)ColorScheme.surfaceTintsurfaceTint: Colors.transparentshadowColorletterSpacingTextStyleBottomNavigationBarNavigationBarDrawerNavigationDrawerToggleButtonsSegmentedButtonFilledButtonElevatedButtonThemeData*ThemeData*ThemeThemeData*ThemeDatacardThemeCardThemeDataCardThemedialogThemeDialogThemeDataDialogThemetabBarThemeTabBarThemeDataTabBarThemeappBarThemeAppBarThemeDataAppBarThemebottomAppBarThemeBottomAppBarThemeDataBottomAppBarThemeinputDecorationThemeInputDecorationThemeDataInputDecorationThemeFlatButtonRaisedButtonOutlineButtonTextButtonElevatedButtonOutlinedButtonButtonStyleTextButton.styleFrom(foregroundColor: Colors.blue)MaterialStateProperty.resolveWiththumbVisibilityScrollbarSelectableTextSelectableText.richRowTextDirection.rtlTextDirection.ltrTooltipuseMaterial3: falseThemeDataColorSchemeColorScheme.fromSeed()accentColoraccentColorBrightnessaccentIconThemeaccentTextThemeAppBarTheme(color: ...)backgroundColorThemeData*ThemeDatacardTheme: CardThemeData()FlatButtonTextButtonRaisedButtonElevatedButtonOutlineButtonOutlinedButtonBottomNavigationBarNavigationBarDrawerNavigationDrawerScrollbarthumbVisibility: DeviceType.isDesktopSelectableTextTextTextDirection.rtlRowTooltipMaterialApp(
title: 'Adaptive App',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.deepPurple,
brightness: Brightness.light,
),
// Use *ThemeData classes for component normalization
appBarTheme: const AppBarThemeData(
backgroundColor: Colors.deepPurple, // Do not use 'color'
elevation: 0,
),
cardTheme: const CardThemeData(
elevation: 2,
),
textTheme: const TextTheme(
bodyMedium: TextStyle(letterSpacing: 0.2),
),
),
home: const MyHomePage(),
);TextButton(
style: ButtonStyle(
// Default color
foregroundColor: MaterialStateProperty.all<Color>(Colors.blue),
// State-dependent overlay color
overlayColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.hovered)) {
return Colors.blue.withOpacity(0.04);
}
if (states.contains(MaterialState.focused) || states.contains(MaterialState.pressed)) {
return Colors.blue.withOpacity(0.12);
}
return null; // Defer to the widget's default.
},
),
),
onPressed: () {},
child: const Text('Adaptive Button'),
)Row(
// Windows expects confirmation on the left (RTL reverses the standard LTR Row)
textDirection: Platform.isWindows ? TextDirection.rtl : TextDirection.ltr,
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () => Navigator.pop(context, false),
child: const Text('Cancel'),
),
FilledButton(
onPressed: () => Navigator.pop(context, true),
child: const Text('Confirm'),
),
],
)