首页/ AI 技能 / @skilllib/skill-2014279388638949379
Skill站外收录 @skilllib/skill-2014279388638949379

widgets

构建可复用、高性能的 Flutter UI 组件,强调无状态优先、原子化常量部件、主题驱动样式、弹性布局规范,以及针对列表、交互视图和选择场景的专用控件实践。

0.0 (0) 532 次安装 原作者 编程导航
收录于 2026-01-22
软件开发 AI 技能

Skills.MD

# UI & Widgets ## **Priority: P1 (OPERATIONAL)** Standards for building reusable, performant Flutter widgets and UI components. - **State**: Use `StatelessWidget` by default. `StatefulWidget` only for local state/controllers. - **Composition**: Extract UI into small, atomic `const` widgets. - **Theming**: Use `Theme.of(context)`. No hardcoded colors. - **Layout**: Use `Flex` + `Gap/SizedBox`. - **Specialized**: - `SelectionArea`: For multi-widget text selection. - `InteractiveViewer`: For zoom/pan. - `ListWheelScrollView`: For pickers. - `IntrinsicWidth/Height`: Avoid unless strictly required. - **Large Lists**: Always use `ListView.builder`. ```dart class AppButton extends StatelessWidget { final String label; final VoidCallback onPressed; const AppButton({super.key, required this.label, required this.onPressed}); @override Widget build(BuildContext context) => ElevatedButton(onPressed: onPressed, child: Text(label)); } ``` ## Related Topics performance | testing

评论 0

还没有评论,来抢沙发。