flutter-adaptive-ui
madteacher/mad-agents-skills
Build responsive Flutter UIs that adapt to any screen size, input method, and platform without device detection.
What is flutter-adaptive-ui?
A Flutter adaptive UI skill for creating layouts that work across mobile, tablet, desktop, web, and foldable devices using constraint-based design rather than platform detection. Use it when building breakpoint-driven layouts, responsive navigation, adaptive dialogs/lists/grids, or handling mixed input devices and window-size decisions.
- Design layouts using constraints and available space instead of device type or platform labels
- Implement breakpoint-driven layouts (compact <600, medium 600-840, expanded ≥840) with MediaQuery and LayoutBuilder
- Build adaptive navigation, dialogs, lists, and grids that reflow across form factors
- Handle keyboard, mouse, touch, and focus behavior as explicit branches
- Use Capability and Policy patterns for platform-specific behavior without Platform.* checks
- Preserve scroll position, selected state, and form input across resize and orientation changes
How to install flutter-adaptive-ui
npx skills add https://github.com/madteacher/mad-agents-skills --skill flutter-adaptive-ui- Flutter project with basic widget structure
- Understanding of Flutter layout fundamentals (Row, Column, Container, LayoutBuilder)
How to use flutter-adaptive-ui
- 1.Identify the target form factors, supported platforms, and the failure mode (overflow, unreadable content, lost state, or broken keyboard flow)
- 2.Inspect existing widgets to find fixed widths/heights, orientation checks, Platform.* layout checks, and custom input handling
- 3.Abstract shared data before branching (e.g., create one destination model for both NavigationBar and NavigationRail)
- 4.Measure space using MediaQuery.sizeOf(context) for app-level decisions or LayoutBuilder for parent-constraint decisions
- 5.Branch by breakpoints (compact/medium/expanded) or capabilities, not by device type
- 6.Implement the smallest adaptive change that preserves state across resize and orientation changes
- 7.Validate on compact (<600), medium (600-839), and expanded (≥840) widths using flutter analyze and manual testing
Use cases
- Creating a navigation system that switches from BottomNavigationBar on mobile to NavigationRail on tablets and desktop
- Building a responsive list/grid that adapts column count and item sizing based on available width
- Implementing a dialog or modal that constrains width on large screens and uses full width on compact devices
- Adding keyboard shortcuts and mouse hover states to a touch-first mobile interface
- Handling foldable device layouts and mixed input scenarios without hardcoding device checks
- Flutter developers building cross-platform apps targeting mobile, tablet, desktop, and web
- Teams implementing responsive design without duplicating entire screens for each form factor
- Developers working on foldable or large-screen devices who need adaptive behavior
- Engineers reviewing or validating adaptive UI implementations for state preservation and accessibility
flutter-adaptive-ui FAQ
No. Use available width and constraints instead. Branch by breakpoints (compact/medium/expanded) based on MediaQuery.sizeOf(context) or LayoutBuilder, not by platform or orientation labels.
Use a deliberate max width constraint or multi-column layout. GridView.extent and adaptive flex layouts are better than duplicating whole screens.
Preserve state by using the same data model and widget tree structure across all breakpoints. Reflow the layout locally without rebuilding the entire widget hierarchy.
Use Capability methods to describe what is possible (e.g., canShowSidebar), and Policy methods to describe what should be shown or allowed (e.g., shouldShowAdvancedOptions). This separates platform behavior from layout decisions.
Implement the smallest reversible abstraction first: shared data models, local LayoutBuilder branches, and isolated Capability/Policy interfaces. Ask the user only for product decisions that cannot be inferred from the app.
Full instructions (SKILL.md)
Source of truth, from madteacher/mad-agents-skills.
name: flutter-adaptive-ui description: Build, fix, review, and validate adaptive or responsive Flutter UIs for mobile, tablet, desktop, web, large screens, foldables, and mixed input devices. Use when creating breakpoint-driven layouts, responsive navigation, adaptive dialogs/lists/grids, keyboard/mouse/touch behavior, window-size decisions with MediaQuery or LayoutBuilder, or Capability and Policy patterns for platform-specific behavior. metadata: author: Stanislav [MADTeacher] Chernyshev version: "2.0"
Flutter Adaptive UI
You are a Flutter adaptive UI implementation agent. Your job is to make the UI work from narrow mobile windows to expanded desktop/web layouts without guessing from device type.
Principle 0
Adaptive Flutter UI is based on available constraints, not platform labels. Use window or parent constraints for layout decisions, keep touch usable first, and add mouse, keyboard, and platform behavior as explicit branches that can be tested.
Core rule: constraints go down, sizes go up, parent sets position.
Default breakpoints:
- Compact: width < 600
- Medium: 600 <= width < 840
- Expanded: width >= 840
Workflow
- Identify the user flow, target form factors, supported platforms, and the expensive failure mode: overflow, unreadable wide content, lost state, inaccessible keyboard flow, or wrong platform behavior.
- Inspect existing widgets before changing layout. Find navigation, dialogs, lists, grids, fixed widths/heights, orientation checks,
Platform.*layout checks, and custom input/focus handling. - Abstract shared data before branching. For example, create one destination model used by both
NavigationBarandNavigationRail. - Measure the right space:
- Use
MediaQuery.sizeOf(context)for app-level or page-level window decisions. - Use
LayoutBuilderwhen the branch depends on the parent constraints of a widget subtree.
- Use
- Branch by breakpoints or capabilities, not by device type. Use compact/medium/expanded layouts for space changes; use Capability and Policy objects for what the app can do or should do.
- Implement the smallest adaptive change that preserves state. Keep scroll position, selected navigation destination, form input, and focus stable across resize/orientation/fold changes.
- Validate on at least compact and expanded widths. Include medium width when the implementation has a distinct tablet layout.
Resource Routing
| Task | Read/use | Purpose |
|---|---|---|
| Need the full adaptive design process | adaptive-workflow.md | Abstract, measure, branch workflow and breakpoint choice |
| Need constraints or overflow diagnosis | layout-constraints.md | Flutter layout rules and edge cases |
| Need basic layout widget guidance | layout-basics.md | Rows, columns, alignment, sizing, and composition |
| Need common layout widget behavior | layout-common-widgets.md | Container, GridView, ListView, Stack, Card, ListTile |
| Need adaptive UX guardrails | adaptive-best-practices.md | Orientation, width, inputs, state, and performance guidance |
| Need platform behavior branching | adaptive-capabilities.md | Capability and Policy structure |
| Need responsive navigation starter code | responsive_navigation.dart | Copy only after fitting destinations and selected state to the target app |
| Need Capability/Policy starter code | capability_policy_example.dart | Copy only after replacing placeholder behavior with real app services |
Do not read every reference by default. Read only the routed material needed for the current failure mode or implementation path.
Implementation Rules
- Treat Dart snippets in
references/as explanatory fragments unless the reference explicitly says otherwise. Useassets/for starter code. - Do not use
Platform.isIOS,Platform.isAndroid, device names, orOrientationBuilderfor layout decisions. Use available width/constraints instead. - Do not let large screens stretch text fields, cards, lists, or reading content across the full window without a deliberate max width or multi-column layout.
- Start with a solid touch interaction, then add hover, shortcuts, focus traversal, and keyboard activation as accelerators.
- Use
GridView.extent, adaptive flex layouts, or constrained content widths for expanded layouts instead of duplicating whole screens when a local reflow is enough. - Keep Capability methods about what is possible and Policy methods about what should be shown or allowed. Name methods by the decision, not by the platform.
- Treat bundled assets as starter examples. They are copy-ready only after
flutter analyzepasses in the target project or a scratch Flutter project.
Validation
After changing a Flutter project:
- Run
flutter analyze. - Run relevant widget tests when layout branching, navigation state, focus, or policy/capability behavior changed.
- Manually or automatically check narrow (<600), medium (600-839 when used), and expanded (>=840) widths.
- Verify no new overflow stripes, clipped text, lost selected state, lost scroll position, or broken keyboard traversal.
- If validation cannot run, report the blocker and the risk. Do not present an adaptive UI change as verified without a width check or analysis result.
Fallback
If the target project lacks enough context to choose a final layout, implement the smallest reversible abstraction first: shared destination/data models, local LayoutBuilder branches, and isolated Capability/Policy interfaces. Ask the user only for product decisions that cannot be inferred from the app, such as which content should move, hide, or become primary on each form factor.
Related skills
More from madteacher/mad-agents-skills and the wider catalog.

flutter-animations
Add, fix, refactor, debug, test, and explain Flutter animations and motion effects.

flutter-architecture
Design, refactor, and review Flutter app architecture with MVVM, layered boundaries, and scalable project structure.

flutter-networking
>-

flutter-testing
Write, fix, and debug Flutter tests across unit, widget, integration, and plugin layers.

frontend-design
Generate and guide UI development with concept-led design spanning editorial warmth, bright product design, and high-contrast neon systems.

magicpath
Find, preview, inspect, install, export, and edit UI components via MagicPath CLI.