ui-and-design
SKILL.md
Performance & Rendering
- Const-First: Every widget that can be
constMUST beconst. - Lazy Rendering: Mandatory use of lazy-loading constructs (
SliverList.builderorSliverGrid.builder) for any list exceeding 10 items. - Repaint Boundaries: Wrap complex animations or heavy UI sections in
RepaintBoundaryto optimize Impeller frame budget. - Isolate Parsing: Mandate
compute()orIsolatefor JSON parsing exceeding 1MB to avoid main-thread jank. - Optimize image handling with
cached_network_image - Handle asynchronous operations cleanly with proper cancellation during widget disposal
- Minimize unnecessary rebuilds using memoization techniques
- Implement pagination for large data sets
- Flatten widget hierarchies where reasonable for better rendering performance
- BuildContext Safety: Check
mountedbefore usingcontextacross async gaps to preventsetStateafter dispose.
Design System
See design-system/SKILL.md for full token definitions (colors, spacing, radius, typography), reusable component rules, theming standards, and accessibility. Always use design tokens — never hardcode values.
Widget Patterns
- Widget Extraction: STRICTLY prohibit private
_build*()methods that return widgets. Extract them into separateStatelessWidgetorStatefulWidgetclasses (can be private with_prefix). This ensures better testability, reusability, and composition. - Sliver Preference: Prefer
CustomScrollViewwithSliversoverSingleChildScrollViewfor any non-trivial scrollable layout to ensure lazy loading and avoid jank. UseSliverList.builderorSliverList.separatedandSliverGrid.builderfor mixed content types. - Prominently use Sliver widgets:
SliverAppBar,SliverList,SliverGrid,SliverToBoxAdapter,SliverPadding,SliverPersistentHeader,SliverFillRemaining,SliverFixedExtentList,SliverAnimatedList,SliverFillViewport,SliverOpacity,SliverIgnorePointer,SliverLayoutBuilder,SliverPrototypeExtentList,SliverVisibility - No Unnecessary Containers: Reduce usage of
Container. Use chained widgets likeDecoratedBox,Padding,SizedBox, etc. PreferSizedBoxoverContainerfor simple spacing. - Use inbuilt animated widgets where applicable (
AnimatedContainer,AnimatedOpacity,AnimatedSwitcher,AnimatedPositioned, etc.) before resorting to explicitAnimationController. - Keep widgets focused and composable with clear responsibilities
- Widget Keys: Assign
Key('feature_action_id')to interactive widgets for test access. UseValueKey(item.id)(notValueKey(index)) for list items.
UI States
- Use a loading indicator while fetching data
- Use an error indicator with appropriate messaging for error displays
- Handle empty states gracefully in UI with clear messaging
Interaction Patterns
- FAB Usage: Use Floating Action Buttons (FAB) for primary positive actions (Add, Create, Generate, Save) on a screen. Avoid inline primary buttons when a FAB is more appropriate for the screen context.
- Scroll Padding: ALWAYS add dynamic bottom padding to
SliverList.builderorSingleChildScrollViewwhen a FAB or Bottom Navigation Bar is present. UseMediaQuery.of(context).padding.bottom + kFloatingActionButtonMargin + 56(orAppSpacing.xxl) to prevent content overlap. - Screen vs Sheet: Prefer full
Scaffoldscreens overModalBottomSheetfor complex forms, especially those with text inputs, to ensure proper keyboard handling and deep linking capability. - Deep Linking: Complex flows should be addressable via deep links (e.g.,
/strategy/:idinstead of just a bottom sheet).
Adaptive & Responsive Design
- Design mobile first
- Use
LayoutBuilderandMediaQueryfor adaptive layouts - Design for different screen sizes and orientations using responsive breakpoints
Adaptive Workflow (Abstract → Measure → Branch)
- Abstract: Identify widgets needing adaptability. Share common data (e.g.,
Destinationfor bothNavigationBarandNavigationRail). - Measure: Use
MediaQuery.sizeOf(context)for app-level layout decisions;LayoutBuilderfor widget-specific constraints. - Branch: Apply breakpoints —
< 600mobile,600–840tablet,>= 840desktop (Material guidelines).
Adaptive Rules
- Never lock orientation; support both portrait and landscape
- Never use
Platform.isIOS/Platform.isAndroidfor layout decisions; use window size - Don't use
OrientationBuilderfor layout changes; useMediaQuery.sizeOforLayoutBuilderwith breakpoints - On large screens, avoid full-width content; constrain content width for readability
- Support keyboard navigation, mouse hover effects, and focus handling for custom widgets
Weekly Installs
4
Repository
dhruvanbhalara/skillsGitHub Stars
14
First Seen
13 days ago
Security Audits
Installed on
opencode4
antigravity4
claude-code4
github-copilot4
codex4
kimi-cli4