[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75Q4MFC2B1AF4Y7EN1GHPCM":3,"skill-same:01M75Q4MFC2B1AF4Y7EN1GHPCM":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":14,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":32,"ownerDescription":6,"updatedAt":33,"install":34,"resources":47},"01M75Q4MFC2B1AF4Y7EN1GHPCM","flutter-build-responsive-layout",null,"Use `LayoutBuilder`, `MediaQuery`, or `Expanded\u002FFlexible` to create a layout that adapts to different screen sizes. Use when you need the UI to look good on both mobile and tablet\u002Fdesktop form factors.","mictlanix\u002Fmbe-ui","mictlanix","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F703184?v=4","01M75Q1XD9477GXRKPM6JVVC11","Mictlanix","01M75Q1XDXKYX3VS9T3CS2XEFR",0,"MIT","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fflutter-build-responsive-layout\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: flutter-build-responsive-layout\ndescription: Use `LayoutBuilder`, `MediaQuery`, or `Expanded\u002FFlexible` to create a layout that adapts to different screen sizes. Use when you need the UI to look good on both mobile and tablet\u002Fdesktop form factors.\nmetadata:\n  model: models\u002Fgemini-3.1-pro-preview\n  last_modified: Tue, 21 Apr 2026 20:17:40 GMT\n---\n# Implementing Adaptive Layouts\n\n## Contents\n- [Space Measurement Guidelines](#space-measurement-guidelines)\n- [Widget Sizing and Constraints](#widget-sizing-and-constraints)\n- [Device and Orientation Behaviors](#device-and-orientation-behaviors)\n- [Workflow: Constructing an Adaptive Layout](#workflow-constructing-an-adaptive-layout)\n- [Workflow: Optimizing for Large Screens](#workflow-optimizing-for-large-screens)\n- [Examples](#examples)\n\n## Space Measurement Guidelines\nDetermine the available space accurately to ensure layouts adapt to the app window, not just the physical device.\n\n*   **Use `MediaQuery.sizeOf(context)`** to get the size of the entire app window.\n*   **Use `LayoutBuilder`** to make layout decisions based on the parent widget's allocated space. Evaluate `constraints.maxWidth` to determine the appropriate widget tree to return.\n*   **Do not use `MediaQuery.orientationOf` or `OrientationBuilder`** near the top of the widget tree to switch layouts. Device orientation does not accurately reflect the available app window space.\n*   **Do not check for hardware types** (e.g., \"phone\" vs. \"tablet\"). Flutter apps run in resizable windows, multi-window modes, and picture-in-picture. Base all layout decisions strictly on available window space.\n\n## Widget Sizing and Constraints\nUnderstand and apply Flutter's core layout rule: **Constraints go down. Sizes go up. Parent sets position.**\n\n*   **Distribute Space:** Use `Expanded` and `Flexible` within `Row`, `Column`, or `Flex` widgets.\n    *   Use `Expanded` to force a child to fill all remaining available space (equivalent to `Flexible` with `fit: FlexFit.tight` and a `flex` factor of 1.0).\n    *   Use `Flexible` to allow a child to size itself up to a specific limit while still expanding\u002Fcontracting. Use the `flex` factor to define the ratio of space consumption among siblings.\n*   **Constrain Width:** Prevent widgets from consuming all horizontal space on large screens. Wrap widgets like `GridView` or `ListView` in a `ConstrainedBox` or `Container` and define a `maxWidth` in the `BoxConstraints`.\n*   **Lazy Rendering:** Always use `ListView.builder` or `GridView.builder` when rendering lists with an unknown or large number of items.\n\n## Device and Orientation Behaviors\nEnsure the app behaves correctly across all device form factors and input methods.\n\n*   **Do not lock screen orientation.** Locking orientation causes severe layout issues on foldable devices, often resulting in letterboxing (the app centered with black borders). Android large format tiers require both portrait and landscape support.\n*   **Fallback for Locked Orientation:** If business requirements strictly mandate a locked orientation, use the `Display API` to retrieve physical screen dimensions instead of `MediaQuery`. `MediaQuery` fails to receive the larger window size in compatibility modes.\n*   **Support Multiple Inputs:** Implement support for basic mice, trackpads, and keyboard shortcuts. Ensure touch targets are appropriately sized and keyboard navigation is accessible.\n\n## Workflow: Constructing an Adaptive Layout\n\nFollow this workflow to implement a layout that adapts to the available `BoxConstraints`.\n\n**Task Progress:**\n- [ ] Identify the target widget that requires adaptive behavior.\n- [ ] Wrap the widget tree in a `LayoutBuilder`.\n- [ ] Extract the `constraints.maxWidth` from the builder callback.\n- [ ] Define an adaptive breakpoint (e.g., `largeScreenMinWidth = 600`).\n- [ ] **If `maxWidth > largeScreenMinWidth`:** Return a large-screen layout (e.g., a `Row` placing a navigation sidebar and content area side-by-side).\n- [ ] **If `maxWidth \u003C= largeScreenMinWidth`:** Return a small-screen layout (e.g., a `Column` or standard navigation-style approach).\n- [ ] Run validator -> resize the application window -> review layout transitions -> fix overflow errors.\n\n## Workflow: Optimizing for Large Screens\n\nFollow this workflow to prevent UI elements from stretching unnaturally on large displays.\n\n**Task Progress:**\n- [ ] Identify full-width components (e.g., `ListView`, text blocks, forms).\n- [ ] **If optimizing a list:** Convert `ListView.builder` to `GridView.builder` using `SliverGridDelegateWithMaxCrossAxisExtent` to automatically adjust column counts based on window size.\n- [ ] **If optimizing a form or text block:** Wrap the component in a `ConstrainedBox`.\n- [ ] Apply `BoxConstraints(maxWidth: [optimal_width])` to the `ConstrainedBox`.\n- [ ] Wrap the `ConstrainedBox` in a `Center` widget to keep the constrained content centered on large screens.\n- [ ] Run validator -> test on desktop\u002Ftablet target -> review horizontal stretching -> adjust `maxWidth` or grid extents.\n\n## Examples\n\n### Adaptive Layout using LayoutBuilder\nDemonstrates switching between a mobile and desktop layout based on available width.\n\n```dart\nimport 'package:flutter\u002Fmaterial.dart';\n\nconst double largeScreenMinWidth = 600.0;\n\nclass AdaptiveLayout extends StatelessWidget {\n  const AdaptiveLayout({super.key});\n\n  @override\n  Widget build(BuildContext context) {\n    return LayoutBuilder(\n      builder: (context, constraints) {\n        if (constraints.maxWidth > largeScreenMinWidth) {\n          return _buildLargeScreenLayout();\n        } else {\n          return _buildSmallScreenLayout();\n        }\n      },\n    );\n  }\n\n  Widget _buildLargeScreenLayout() {\n    return Row(\n      children: [\n        const SizedBox(width: 250, child: Placeholder(color: Colors.blue)),\n        const VerticalDivider(width: 1),\n        Expanded(child: const Placeholder(color: Colors.green)),\n      ],\n    );\n  }\n\n  Widget _buildSmallScreenLayout() {\n    return const Placeholder(color: Colors.green);\n  }\n}\n```\n\n### Constraining Width on Large Screens\nDemonstrates preventing a widget from consuming all horizontal space.\n\n```dart\nimport 'package:flutter\u002Fmaterial.dart';\n\nclass ConstrainedContent extends StatelessWidget {\n  const ConstrainedContent({super.key});\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      body: Center(\n        child: ConstrainedBox(\n          constraints: const BoxConstraints(\n            maxWidth: 800.0, \u002F\u002F Maximum width for readability\n          ),\n          child: ListView.builder(\n            itemCount: 50,\n            itemBuilder: (context, index) {\n              return ListTile(\n                title: Text('Item $index'),\n              );\n            },\n          ),\n        ),\n      ),\n    );\n  }\n}\n```\n","# Implementing Adaptive Layouts\n\n## Contents\n- [Space Measurement Guidelines](#space-measurement-guidelines)\n- [Widget Sizing and Constraints](#widget-sizing-and-constraints)\n- [Device and Orientation Behaviors](#device-and-orientation-behaviors)\n- [Workflow: Constructing an Adaptive Layout](#workflow-constructing-an-adaptive-layout)\n- [Workflow: Optimizing for Large Screens](#workflow-optimizing-for-large-screens)\n- [Examples](#examples)\n\n## Space Measurement Guidelines\nDetermine the available space accurately to ensure layouts adapt to the app window, not just the physical device.\n\n*   **Use `MediaQuery.sizeOf(context)`** to get the size of the entire app window.\n*   **Use `LayoutBuilder`** to make layout decisions based on the parent widget's allocated space. Evaluate `constraints.maxWidth` to determine the appropriate widget tree to return.\n*   **Do not use `MediaQuery.orientationOf` or `OrientationBuilder`** near the top of the widget tree to switch layouts. Device orientation does not accurately reflect the available app window space.\n*   **Do not check for hardware types** (e.g., \"phone\" vs. \"tablet\"). Flutter apps run in resizable windows, multi-window modes, and picture-in-picture. Base all layout decisions strictly on available window space.\n\n## Widget Sizing and Constraints\nUnderstand and apply Flutter's core layout rule: **Constraints go down. Sizes go up. Parent sets position.**\n\n*   **Distribute Space:** Use `Expanded` and `Flexible` within `Row`, `Column`, or `Flex` widgets.\n    *   Use `Expanded` to force a child to fill all remaining available space (equivalent to `Flexible` with `fit: FlexFit.tight` and a `flex` factor of 1.0).\n    *   Use `Flexible` to allow a child to size itself up to a specific limit while still expanding\u002Fcontracting. Use the `flex` factor to define the ratio of space consumption among siblings.\n*   **Constrain Width:** Prevent widgets from consuming all horizontal space on large screens. Wrap widgets like `GridView` or `ListView` in a `ConstrainedBox` or `Container` and define a `maxWidth` in the `BoxConstraints`.\n*   **Lazy Rendering:** Always use `ListView.builder` or `GridView.builder` when rendering lists with an unknown or large number of items.\n\n## Device and Orientation Behaviors\nEnsure the app behaves correctly across all device form factors and input methods.\n\n*   **Do not lock screen orientation.** Locking orientation causes severe layout issues on foldable devices, often resulting in letterboxing (the app centered with black borders). Android large format tiers require both portrait and landscape support.\n*   **Fallback for Locked Orientation:** If business requirements strictly mandate a locked orientation, use the `Display API` to retrieve physical screen dimensions instead of `MediaQuery`. `MediaQuery` fails to receive the larger window size in compatibility modes.\n*   **Support Multiple Inputs:** Implement support for basic mice, trackpads, and keyboard shortcuts. Ensure touch targets are appropriately sized and keyboard navigation is accessible.\n\n## Workflow: Constructing an Adaptive Layout\n\nFollow this workflow to implement a layout that adapts to the available `BoxConstraints`.\n\n**Task Progress:**\n- [ ] Identify the target widget that requires adaptive behavior.\n- [ ] Wrap the widget tree in a `LayoutBuilder`.\n- [ ] Extract the `constraints.maxWidth` from the builder callback.\n- [ ] Define an adaptive breakpoint (e.g., `largeScreenMinWidth = 600`).\n- [ ] **If `maxWidth > largeScreenMinWidth`:** Return a large-screen layout (e.g., a `Row` placing a navigation sidebar and content area side-by-side).\n- [ ] **If `maxWidth \u003C= largeScreenMinWidth`:** Return a small-screen layout (e.g., a `Column` or standard navigation-style approach).\n- [ ] Run validator -> resize the application window -> review layout transitions -> fix overflow errors.\n\n## Workflow: Optimizing for Large Screens\n\nFollow this workflow to prevent UI elements from stretching unnaturally on large displays.\n\n**Task Progress:**\n- [ ] Identify full-width components (e.g., `ListView`, text blocks, forms).\n- [ ] **If optimizing a list:** Convert `ListView.builder` to `GridView.builder` using `SliverGridDelegateWithMaxCrossAxisExtent` to automatically adjust column counts based on window size.\n- [ ] **If optimizing a form or text block:** Wrap the component in a `ConstrainedBox`.\n- [ ] Apply `BoxConstraints(maxWidth: [optimal_width])` to the `ConstrainedBox`.\n- [ ] Wrap the `ConstrainedBox` in a `Center` widget to keep the constrained content centered on large screens.\n- [ ] Run validator -> test on desktop\u002Ftablet target -> review horizontal stretching -> adjust `maxWidth` or grid extents.\n\n## Examples\n\n### Adaptive Layout using LayoutBuilder\nDemonstrates switching between a mobile and desktop layout based on available width.\n\n```dart\nimport 'package:flutter\u002Fmaterial.dart';\n\nconst double largeScreenMinWidth = 600.0;\n\nclass AdaptiveLayout extends StatelessWidget {\n  const AdaptiveLayout({super.key});\n\n  @override\n  Widget build(BuildContext context) {\n    return LayoutBuilder(\n      builder: (context, constraints) {\n        if (constraints.maxWidth > largeScreenMinWidth) {\n          return _buildLargeScreenLayout();\n        } else {\n          return _buildSmallScreenLayout();\n        }\n      },\n    );\n  }\n\n  Widget _buildLargeScreenLayout() {\n    return Row(\n      children: [\n        const SizedBox(width: 250, child: Placeholder(color: Colors.blue)),\n        const VerticalDivider(width: 1),\n        Expanded(child: const Placeholder(color: Colors.green)),\n      ],\n    );\n  }\n\n  Widget _buildSmallScreenLayout() {\n    return const Placeholder(color: Colors.green);\n  }\n}\n```\n\n### Constraining Width on Large Screens\nDemonstrates preventing a widget from consuming all horizontal space.\n\n```dart\nimport 'package:flutter\u002Fmaterial.dart';\n\nclass ConstrainedContent extends StatelessWidget {\n  const ConstrainedContent({super.key});\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      body: Center(\n        child: ConstrainedBox(\n          constraints: const BoxConstraints(\n            maxWidth: 800.0, \u002F\u002F Maximum width for readability\n          ),\n          child: ListView.builder(\n            itemCount: 50,\n            itemBuilder: (context, index) {\n              return ListTile(\n                title: Text('Item $index'),\n              );\n            },\n          ),\n        ),\n      ),\n    );\n  }\n}\n```\n",{"name":5,"metadata":24,"description":7},{"model":25,"last_modified":26},"models\u002Fgemini-3.1-pro-preview","Tue, 21 Apr 2026 20:17:40 GMT","main","228e23386ed058f8a2456399cd68f63999d63adf",".claude\u002Fskills\u002Fflutter-build-responsive-layout","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui","https:\u002F\u002Fgithub.com\u002Fmictlanix","https:\u002F\u002Fmictlanix.com","2026-11-15 04:02:27",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add mictlanix\u002Fmbe-ui --skill flutter-build-responsive-layout",{"tool":40,"command":41},"bunx","bunx skills add mictlanix\u002Fmbe-ui --skill flutter-build-responsive-layout",{"tool":43,"command":44},"pnpm","pnpm dlx skills add mictlanix\u002Fmbe-ui --skill flutter-build-responsive-layout","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fflutter-build-responsive-layout\u002FSKILL.md",true,[],[49,56,61,68,75,82],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M75QCZHHB42Q7KJTZHQZXZ77","speckit-wireframes-draft","Draw low-fi wireframes for every screen and state the spec describes","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.specify\u002Fextensions\u002Fwireframes\u002F.specify-dev\u002Fagent-commands\u002Fclaude\u002Fspeckit-wireframes-draft\u002FSKILL.md",[],[],{"skillNo":57,"name":51,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M75QCXRSD7HM7AFZH4HA9E6S","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fspeckit-wireframes-draft\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M75QCVS17DXXBTQ8DE2SSXVR","speckit-taskstoissues","Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts.","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fspeckit-taskstoissues\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M75QCS3M02XD4PW58EXS6458","speckit-tasks","Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fspeckit-tasks\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M75QCP9NASXGDNYZF6XYJZBD","speckit-specify","Create or update the feature specification from a natural language feature description.","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fspeckit-specify\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M75QCKBPS4K60R4YPRQ8HBJ9","speckit-plan","Execute the implementation planning workflow using the plan template to generate design artifacts.","https:\u002F\u002Fgithub.com\u002Fmictlanix\u002Fmbe-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fspeckit-plan\u002FSKILL.md",[],[]]