---
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"
title: flutter-adaptive-ui
canonical_url: https://skilld.dev/gh/madteacher/mad-agents-skills/flutter-adaptive-ui
last_updated: 2026-09-28T11:41:43.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [assets/capability_policy_example.dart](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/assets/capability_policy_example.dart), [assets/responsive_navigation.dart](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/assets/responsive_navigation.dart), [references/adaptive-best-practices.md](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/references/adaptive-best-practices.md), [references/adaptive-capabilities.md](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/references/adaptive-capabilities.md), [references/adaptive-workflow.md](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/references/adaptive-workflow.md), [references/layout-basics.md](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/references/layout-basics.md), [references/layout-common-widgets.md](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/references/layout-common-widgets.md), [references/layout-constraints.md](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/references/layout-constraints.md).
>
> If the user asked to install this Skill, run `npx skilld install madteacher/mad-agents-skills/flutter-adaptive-ui`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/flutter-adaptive-ui`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/madteacher/mad-agents-skills/flutter-adaptive-ui) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/flutter-adaptive-ui`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/flutter-adaptive-ui --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/flutter-adaptive-ui --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# 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

1. 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.
2. Inspect existing widgets before changing layout. Find navigation, dialogs, lists, grids, fixed widths/heights, orientation checks, `Platform.*` layout checks, and custom input/focus handling.
3. Abstract shared data before branching. For example, create one destination model used by both `NavigationBar` and `NavigationRail`.
4. Measure the right space:
   - Use `MediaQuery.sizeOf(context)` for app-level or page-level window decisions.
   - Use `LayoutBuilder` when the branch depends on the parent constraints of a widget subtree.
5. 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.
6. Implement the smallest adaptive change that preserves state. Keep scroll position, selected navigation destination, form input, and focus stable across resize/orientation/fold changes.
7. 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](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/references/adaptive-workflow.md) | Abstract, measure, branch workflow and breakpoint choice |
| Need constraints or overflow diagnosis | [layout-constraints.md](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/references/layout-constraints.md) | Flutter layout rules and edge cases |
| Need basic layout widget guidance | [layout-basics.md](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/references/layout-basics.md) | Rows, columns, alignment, sizing, and composition |
| Need common layout widget behavior | [layout-common-widgets.md](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/references/layout-common-widgets.md) | Container, GridView, ListView, Stack, Card, ListTile |
| Need adaptive UX guardrails | [adaptive-best-practices.md](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/references/adaptive-best-practices.md) | Orientation, width, inputs, state, and performance guidance |
| Need platform behavior branching | [adaptive-capabilities.md](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/references/adaptive-capabilities.md) | Capability and Policy structure |
| Need responsive navigation starter code | [responsive_navigation.dart](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/assets/responsive_navigation.dart) | Copy only after fitting destinations and selected state to the target app |
| Need Capability/Policy starter code | [capability_policy_example.dart](https://skilld.dev/api/skills-raw/madteacher/mad-agents-skills/flutter-adaptive-ui/assets/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. Use `assets/` for starter code.
- Do not use `Platform.isIOS`, `Platform.isAndroid`, device names, or `OrientationBuilder` for 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 analyze` passes in the target project or a scratch Flutter project.

## Validation

After changing a Flutter project:

1. Run `flutter analyze`.
2. Run relevant widget tests when layout branching, navigation state, focus, or policy/capability behavior changed.
3. Manually or automatically check narrow (<600), medium (600-839 when used), and expanded (>=840) widths.
4. Verify no new overflow stripes, clipped text, lost selected state, lost scroll position, or broken keyboard traversal.
5. 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.
