Globales Ranking · von 600 Skills
flutter-theming-apps AI Agent Skill
Quellcode ansehen: flutter/skills
SafeInstallation
npx skills add flutter/skills --skill flutter-theming-apps 7.1K
Installationen
Implementing Flutter Theming and Adaptive Design
Contents
- Core Theming Concepts
- Material 3 Guidelines
- Component Theme Normalization
- Button Styling
- Platform Idioms & Adaptive Design
- 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
Component themes in ThemeData have been normalized to use *ThemeData classes rather than *Theme widgets.
When defining ThemeData, strictly use the *ThemeData suffix for the following properties:
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 based on the theme's color scheme, use the static utility method:
TextButton.styleFrom(foregroundColor: Colors.blue). - For state-dependent styling (hovered, focused, pressed, disabled), use
MaterialStateProperty.resolveWith.
Platform Idioms & Adaptive Design
When building adaptive apps, respect platform-specific norms to reduce cognitive load and build user trust.
- Scrollbars: Desktop users expect omnipresent scrollbars; mobile users expect them only during scrolling. Toggle
thumbVisibilityon theScrollbarwidget based on the platform. - Selectable Text: Web and desktop users expect text to be selectable. Wrap text in
SelectableTextorSelectableText.rich. - Horizontal Button Order: Windows places confirmation buttons on the left; macOS/Linux place them on the right. Use a
RowwithTextDirection.rtlfor Windows andTextDirection.ltrfor others. - Context Menus & Tooltips: Desktop users expect hover and right-click interactions. Implement
Tooltipfor hover states and use context menu packages for right-click actions.
Workflows
Workflow: Migrating Legacy Themes to Material 3
Use this workflow when updating an older Flutter codebase.
Task Progress:
-
- Remove
useMaterial3: falsefromThemeData(it is true by default).
- Remove
-
- Replace manual
ColorSchemedefinitions withColorScheme.fromSeed().
- Replace manual
-
- Run validator -> review errors -> fix: Search for and replace deprecated
accentColor,accentColorBrightness,accentIconTheme, andaccentTextTheme.
- Run validator -> review errors -> fix: Search for and replace deprecated
-
- Run validator -> review errors -> fix: Search for
AppBarTheme(color: ...)and replace withbackgroundColor.
- Run validator -> review errors -> fix: Search for
-
- Update
ThemeDatacomponent properties to use*ThemeDataclasses (e.g.,cardTheme: CardThemeData()).
- Update
-
- Replace legacy buttons (
FlatButton->TextButton,RaisedButton->ElevatedButton,OutlineButton->OutlinedButton).
- Replace legacy buttons (
-
- Replace legacy navigation components (
BottomNavigationBar->NavigationBar,Drawer->NavigationDrawer).
- Replace legacy navigation components (
Workflow: Implementing Adaptive UI Components
Use this workflow when building a widget intended for both mobile and desktop/web.
Task Progress:
-
- If displaying a list/grid, wrap it in a
Scrollbarand setthumbVisibility: DeviceType.isDesktop.
- If displaying a list/grid, wrap it in a
-
- If displaying read-only data, use
SelectableTextinstead ofText.
- If displaying read-only data, use
-
- If implementing a dialog with action buttons, check the platform. If Windows, set
TextDirection.rtlon the buttonRow.
- If implementing a dialog with action buttons, check the platform. If Windows, set
-
- If implementing interactive elements, wrap them in
Tooltipwidgets to support mouse hover states.
- If implementing interactive elements, wrap them in
Examples
Example: Modern Material 3 ThemeData Setup
MaterialApp(
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(),
);Example: State-Dependent ButtonStyle
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'),
)Example: Adaptive Dialog Button Order
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'),
),
],
)Installationen
Sicherheitsprüfung
Quellcode ansehen
flutter/skills
Mehr aus dieser Quelle
Power your AI Agents with
the best open-source models.
Drop-in OpenAI-compatible API. No data leaves Europe.
Explore Inference APIGLM
GLM 5
$1.00 / $3.20
per M tokens
Kimi
Kimi K2.5
$0.60 / $2.80
per M tokens
MiniMax
MiniMax M2.5
$0.30 / $1.20
per M tokens
Qwen
Qwen3.5 122B
$0.40 / $3.00
per M tokens
So verwenden Sie diesen Skill
Install flutter-theming-apps by running npx skills add flutter/skills --skill flutter-theming-apps in your project directory. Führen Sie den obigen Installationsbefehl in Ihrem Projektverzeichnis aus. Die Skill-Datei wird von GitHub heruntergeladen und in Ihrem Projekt platziert.
Keine Konfiguration erforderlich. Ihr KI-Agent (Claude Code, Cursor, Windsurf usw.) erkennt installierte Skills automatisch und nutzt sie als Kontext bei der Code-Generierung.
Der Skill verbessert das Verständnis Ihres Agenten für flutter-theming-apps, und hilft ihm, etablierte Muster zu befolgen, häufige Fehler zu vermeiden und produktionsreifen Code zu erzeugen.
Was Sie erhalten
Skills sind Klartext-Anweisungsdateien — kein ausführbarer Code. Sie kodieren Expertenwissen über Frameworks, Sprachen oder Tools, das Ihr KI-Agent liest, um seine Ausgabe zu verbessern. Das bedeutet null Laufzeit-Overhead, keine Abhängigkeitskonflikte und volle Transparenz: Sie können jede Anweisung vor der Installation lesen und prüfen.
Kompatibilität
Dieser Skill funktioniert mit jedem KI-Coding-Agenten, der das skills.sh-Format unterstützt, einschließlich Claude Code (Anthropic), Cursor, Windsurf, Cline, Aider und anderen Tools, die projektbezogene Kontextdateien lesen. Skills sind auf Transportebene framework-agnostisch — der Inhalt bestimmt, für welche Sprache oder welches Framework er gilt.
Chat with 100+ AI Models in one App.
Use Claude, ChatGPT, Gemini alongside with EU-Hosted Models like Deepseek, GLM-5, Kimi K2.5 and many more.