Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问许可证需确认审计通过

flutter-themingFlutter theming 命令行

Agent Skill

flutter-theming 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

25,872

周安装

1,053

GitHub Stars

1,331

下载量

9,064
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:flutter-theming(Flutter theming 命令行)
来源仓库:https://github.com/flutter/skills
仓库路径:skills/flutter-theming
安装命令:
npx skills add https://github.com/flutter/skills --skill flutter-theming
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/flutter/skills --skill flutter-theming

简介

通过自动组件和主题更新,将 Flutter 应用程序从 Material 2 迁移到 Material 3。

  • 使用决策树识别已弃用的 Material 2 组件(FlatButton、RaishedButton、BottomNavigationBar、Drawer)并将其替换为 Material 3 等效组件
  • 将旧主题属性转换为 Material 3 ColorScheme 并删除已弃用的强调色引用(accentColor、accentColorBrightness 等)
  • 标准化所有组件主题以使用 *ThemeData
  • 类并确保 useMaterial3: true
  • 跨越明暗主题
  • 对 iOS、Android、Windows、macOS、Linux 和 Web 上的滚动条、文本选择和按钮排序应用特定于平台的 UI 习惯用法
  • 验证输出以消除旧按钮类并强制从 ColorScheme 进行单一真实颜色派生

SKILL.md

Goal

Updates and manages Flutter application styling by migrating legacy Material 2 implementations to Material 3, normalizing component themes, updating deprecated button classes, and adapting UI idioms for cross-platform consistency. Assumes a Flutter environment using Dart.

Instructions

  1. Analyze Current Theme State Review the existing Flutter codebase to identify legacy Material 2 components, deprecated button classes (FlatButton, RaisedButton, OutlineButton), and outdated theme properties (e.g., accentColor, color in AppBarTheme). STOP AND ASK THE USER: "What is the primary seed color for the new Material 3 ColorScheme, and which target platforms (iOS, Android, Windows, macOS, Linux, Web) should be prioritized for platform idioms?"
  2. Decision Logic: Component Migration When encountering legacy widgets, use the following decision tree to determine the replacement:

- IF BottomNavigationBar -> REPLACE WITH NavigationBar (uses NavigationDestination). - IF Drawer -> REPLACE WITH NavigationDrawer (uses NavigationDrawerDestination). - IF ToggleButtons -> REPLACE WITH SegmentedButton (uses ButtonSegment and Set for selection). - IF FlatButton -> REPLACE WITH TextButton. - IF RaisedButton -> REPLACE WITH ElevatedButton (or FilledButton for no elevation). - IF OutlineButton -> REPLACE WITH OutlinedButton.

  1. Implement App-Wide Material 3 Theme Define the global ThemeData using ColorScheme.fromSeed. Ensure useMaterial3 is implicitly or explicitly true. Remove all references to deprecated accent properties (accentColor, accentColorBrightness, accentTextTheme, accentIconTheme). MaterialApp(title: 'App Name', theme: ThemeData(useMaterial3: true, colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple, brightness: Brightness.light,), // Use colorScheme.secondary instead of accentColor), darkTheme: ThemeData(useMaterial3: true, colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple, brightness: Brightness.dark,),), home: const MyHomePage(),);
  2. Normalize Component Themes Update all component theme definitions in ThemeData to use their *ThemeData equivalents. Do not use the base theme classes for configuration. ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), appBarTheme: const AppBarThemeData(backgroundColor: Colors.blue, // Do not use 'color' elevation: 4.0,), cardTheme: const CardThemeData(elevation: 2.0,),);

- cardTheme -> CardThemeData - dialogTheme -> DialogThemeData - tabBarTheme -> TabBarThemeData - appBarTheme -> AppBarThemeData (Replace color with backgroundColor) - bottomAppBarTheme -> BottomAppBarThemeData - inputDecorationTheme -> InputDecorationThemeData

  1. Migrate Buttons and Button Styles Replace legacy buttons. Use the styleFrom() static method for simple overrides, or ButtonStyle with MaterialStateProperty for state-dependent styling. // Simple override using styleFrom TextButton(style: TextButton.styleFrom(foregroundColor: Colors.blue, disabledForegroundColor: Colors.red,), onPressed: () {}, child: const Text('TextButton'),) // State-dependent override using MaterialStateProperty OutlinedButton(style: ButtonStyle(side: MaterialStateProperty.resolveWith<BorderSide>((Set<MaterialState> states) {if (states.contains(MaterialState.pressed)) {return const BorderSide(color: Colors.blue, width: 2);} return const BorderSide(color: Colors.grey, width: 1);}),), onPressed: () {}, child: const Text('OutlinedButton'),)
  2. Decision Logic: Platform Idioms Apply platform-specific adaptations based on the host OS to reduce cognitive load and build user trust. // Platform-aware button ordering TextDirection btnDirection = Platform.isWindows? TextDirection.rtl: TextDirection.ltr; Row(children: [const Spacer(), Row(textDirection: btnDirection, children: [TextButton(onPressed: () => Navigator.pop(context, false), child: const Text('Cancel'),), ElevatedButton(onPressed: () => Navigator.pop(context, true), child: const Text('OK'),),],),],)

- Scrollbars: IF desktop platform -> Set thumbVisibility: true (or alwaysShown). IF mobile -> Use default auto-hiding behavior. - Text Selection: IF text is informational and non-interactive -> Wrap in SelectableText to allow mouse selection on Web/Desktop. - Button Ordering: IF Windows -> Place confirmation button on the LEFT. IF macOS/Linux/Android/iOS -> Place confirmation button on the RIGHT.

  1. Validate-and-Fix Scan the generated code to verify that no FlatButton, RaisedButton, OutlineButton, or ButtonTheme classes remain. Verify that AppBarTheme does not use the color property. Fix any instances found.

Constraints

  • Single Source of Truth: All colors must be derived from the ColorScheme (e.g., Theme.of(context).colorScheme.primary). Do not hardcode hex colors unless explicitly requested.
  • No Legacy Buttons: Never output FlatButton, RaisedButton, or OutlineButton.
  • No Accent Properties: Never use accentColor, accentColorBrightness, accentTextTheme, or accentIconTheme. Use colorScheme.secondary and colorScheme.onSecondary instead.
  • Component Theme Suffixes: Always append Data to component themes when configuring ThemeData (e.g., CardThemeData, not CardTheme).
  • AppBar Background: Never use the color property in AppBarTheme or AppBarThemeData; strictly use backgroundColor.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.62%
按下载量换算3,319

Claude

33.07%
按下载量换算2,997

Cursor

17.94%
按下载量换算1,626

Gemini CLI

10.01%
按下载量换算907

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills