SKILL.md
Idiomatic Flutter (P1)
- Async Gaps: Check
if (context.mounted)before usingBuildContextafterawait. - Composition: Extract complex UI into small widgets. Avoid deep nesting or large helper methods.
- Layout:
- Spacing: Use Gap(n) or SizedBox over Padding for simple gaps. - Empty UI: Use const SizedBox.shrink(). - Intrinsic: Avoid IntrinsicWidth/Height; use Stack + FractionallySizedBox for overlays.
- Optimization: Use
ColoredBox/Padding/DecoratedBoxinstead ofContainerwhen possible. - Themes: Use extensions for
Theme.of(context)access.