flutter-theming-apps
Customizes the visual appearance of a Flutter app using the theming system. Use when defining global styles, colors, or typography for an application.
- License 许可
- MIT
- 最近更新
- 2026-06-13
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- flutter-theming-apps
- description
- Customizes the visual appearance of a Flutter app using the theming system. Use when defining global styles, colors, or typography for an application.
03 SKILL.md 正文
Implementing Flutter Theming and Adaptive Design
Contents
- Core Theming Concepts
- Material 3 Guidelines
- Component Theme Normalization
- Button Styling
- Workflows
- Examples
Core Theming Concepts
Flutter applies styling in a strict hierarchy: styles applied to the specific widget -> themes that override the immediate parent theme -> the main app theme.
- Define app-wide themes using the
themeproperty ofMaterialAppwith aThemeDatainstance. - Override themes for specific widget subtrees by wrapping them in a
Themewidget and usingTheme.of(context).copyWith(...). - Do not use deprecated
ThemeDataproperties:- Replace
accentColorwithcolorScheme.secondary. - Replace
accentTextThemewithtextTheme(usingcolorScheme.onSecondaryfor contrast). - Replace
AppBarTheme.colorwithAppBarTheme.backgroundColor.
- Replace
Material 3 Guidelines
Material 3 is the default theme as of Flutter 3.16.
- Colors: Generate color schemes using
ColorScheme.fromSeed(seedColor: Colors.blue). This ensures accessible contrast ratios. - Elevation: Material 3 uses
ColorScheme.surfaceTintto indicate elevation instead of just drop shadows. To revert to M2 shadow behavior, setsurfaceTint: Colors.transparentand define ashadowColor. - Typography: Material 3 updates font sizes, weights, and line heights. If text wrapping breaks legacy layouts, adjust
letterSpacingon the specificTextStyle. - Modern Components:
- Replace
BottomNavigationBarwithNavigationBar. - Replace
DrawerwithNavigationDrawer. - Replace
ToggleButtonswithSegmentedButton. - Use
FilledButtonfor a high-emphasis button without the elevation ofElevatedButton.
- Replace
Component Theme Normalization
When defining ThemeData, use the *ThemeData suffix:
cardTheme: UseCardThemeData(NotCardTheme)dialogTheme: UseDialogThemeData(NotDialogTheme)tabBarTheme: UseTabBarThemeData(NotTabBarTheme)appBarTheme: UseAppBarThemeData(NotAppBarTheme)bottomAppBarTheme: UseBottomAppBarThemeData(NotBottomAppBarTheme)inputDecorationTheme: UseInputDecorationThemeData(NotInputDecorationTheme)
Button Styling
Legacy button classes (FlatButton, RaisedButton, OutlineButton) are obsolete.
- Use
TextButton,ElevatedButton, andOutlinedButton. - Configure button appearance using a
ButtonStyleobject. - For simple overrides:
TextButton.styleFrom(foregroundColor: Colors.blue). - For state-dependent styling: use
WidgetStateProperty.resolveWith.
Workflows
Workflow: Material 3 ThemeData Setup
- [ ] Use
ColorScheme.fromSeed()for color generation. - [ ] Use
*ThemeDataclasses for component properties. - [ ] Replace legacy buttons with modern equivalents.
- [ ] Replace
BottomNavigationBarwithNavigationBar. - [ ] Replace
DrawerwithNavigationDrawer.
Examples
Example: Modern Material 3 ThemeData Setup
MaterialApp(
title: 'My App',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.deepPurple,
brightness: Brightness.light,
),
appBarTheme: const AppBarThemeData(
backgroundColor: Colors.deepPurple,
elevation: 0,
),
cardTheme: const CardThemeData(
elevation: 2,
),
textTheme: const TextTheme(
bodyMedium: TextStyle(letterSpacing: 0.2),
),
),
home: const MyHomePage(),
);
Example: State-Dependent ButtonStyle
TextButton(
style: ButtonStyle(
foregroundColor: WidgetStateProperty.all<Color>(Colors.blue),
overlayColor: WidgetStateProperty.resolveWith<Color?>(
(Set<WidgetState> states) {
if (states.contains(WidgetState.hovered)) {
return Colors.blue.withOpacity(0.04);
}
if (states.contains(WidgetState.focused) ||
states.contains(WidgetState.pressed)) {
return Colors.blue.withOpacity(0.12);
}
return null;
},
),
),
onPressed: () {},
child: const Text('Button'),
)
04 同仓库更多 Skills
hello-checker
Use this skill when asked to "verify", "check", or "validate" a file's existence and content. It provides a reliable workflow for confirming files meet their spec.
ask-skill
暂无简介
html-review-artifact
Framework-wide guidance for crafting polished human-review artifacts as markdown or HTML
converge-planning
Design a Converge playbook end-to-end. Use when the user says "plan a project", "design a playbook", "decompose into tasks", "scaffold a Converge workflow", "onboard to Converge", or asks how to write TASK.md / playbook.yml. Two entry points: plan a new playbook or update an existing one. Hand off to `/converge-control` after producing the playbook structure.
converge-control
Operate a Converge playbook end-to-end — start runs, monitor progress, narrow failures with `--select`, inspect runtime state, validate definitions, surgically reset subtrees, and stop stuck or orphaned runs. Use this skill whenever the user says "run my playbook", "execute this", "monitor the run", "converge failed", "the run is stuck", "retry failures", "babysit this playbook", "what's the status?", "show me the gantt", or asks how to use `converge run` / `--select` / `inspect` / `doctor` / `clean` / `stop`. Also use it for `HTTP 401` / `Invalid API key` failures on the first task — those are environment-not-playbook problems — and for any post-run cleanup work. Hand off to `converge-planning` if the user wants to design or restructure the playbook itself.
repair-taskts
Fix task.ts definition issues — Seed syntax, missing .build(), empty checks, import errors, TypeScript errors