SuperAPI AI 工具集

flutter-theming

通用与其它

查看项目

更新于 10-16 08:47

技能介绍

用途:按 Flutter 官方 theming 体系定制应用样式,重点是把遗留的 Material 2 实现迁移到 Material 3,并统一组件主题与跨平台 UI 惯例。

主要能力:分析现有主题状态,识别 Material 2 组件、废弃按钮(FlatButton、RaisedButton、OutlineButton)及过期属性(如 accentColor、AppBarTheme 的 color);用 ColorScheme.fromSeed 建立全局 ThemeData(含亮暗主题),并移除 accentColor、accentColorBrightness、accentTextTheme、accentIconTheme 等;把组件主题改用 *ThemeData 等价类(cardTheme→CardThemeData、dialogTheme→DialogThemeData、tabBarTheme→TabBarThemeData、appBarTheme→AppBarThemeData、bottomAppBarTheme→BottomAppBarThemeData、inputDecorationTheme→InputDecorationThemeData);迁移按钮并支持 styleFrom() 或 ButtonStyle + MaterialStateProperty 状态样式。

组件迁移决策:BottomNavigationBar→NavigationBar;Drawer→NavigationDrawer;ToggleButtons→SegmentedButton;FlatButton→TextButton;RaisedButton→ElevatedButton(无阴影可用 FilledButton);OutlineButton→OutlinedButton。

平台惯例:桌面端滚动条设 thumbVisibility: true,移动端用默认自动隐藏;非交互文本用 SelectableText 以支持 Web/桌面鼠标选择;Windows 确认按钮在左,macOS/Linux/Android/iOS 在右。

约束与校验:颜色统一取自 ColorScheme,不硬编码色值;不输出旧按钮类;组件主题配置必须加 Data 后缀;AppBarTheme/AppBarThemeData 使用 backgroundColor 而非 color;生成后扫描修正残留。执行前会先询问主种子色与优先目标平台。

限制:需 Flutter/Dart 环境;资料未提供安装命令、收费或价格信息。