Flutter Build Responsive Layout Skill Security Audit
What the author says it does (original text)
Use `LayoutBuilder`, `MediaQuery`, or `Expanded/Flexible` to create a layout that adapts to different screen sizes. Use when you need the UI to look good on both mobile and tablet/desktop form factors.
No obvious risks found in this check
- Files checked
- 1
- Risks found
- 0
Inside this skill
The Skill’s stated purpose is to guide Flutter interfaces that adapt to available window space across mobile and larger screens; its main decision input is the parent width supplied by LayoutBuilder, rather than hardware type or device orientation.
View source
name: flutter-build-responsive-layoutdescription: Use `LayoutBuilder`, `MediaQuery`, or `Expanded/Flexible` to create a layout that adapts to different screen sizes. Use when you need the UI to look good on both mobile and tablet/desktop form factors.metadata:* **Use `MediaQuery.sizeOf(context)`** to get the size of the entire app window.* **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.* **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.* **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.Its workflow directs the agent to identify the target component, add a LayoutBuilder, define a breakpoint, and construct separate large- and small-screen layouts; the example breakpoint is 600.
View source
**Task Progress:**- [ ] Identify the target widget that requires adaptive behavior.- [ ] Wrap the widget tree in a `LayoutBuilder`.- [ ] Extract the `constraints.maxWidth` from the builder callback.- [ ] Define an adaptive breakpoint (e.g., `largeScreenMinWidth = 600`).- [ ] **If `maxWidth > largeScreenMinWidth`:** Return a large-screen layout (e.g., a `Row` placing a navigation sidebar and content area side-by-side).- [ ] **If `maxWidth <= largeScreenMinWidth`:** Return a small-screen layout (e.g., a `Column` or standard navigation-style approach).- [ ] Run validator -> resize the application window -> review layout transitions -> fix overflow errors.const double largeScreenMinWidth = 600.0;class AdaptiveLayout extends StatelessWidget { const AdaptiveLayout({super.key}); @override Widget build(BuildContext context) { return LayoutBuilder( builder: (context, constraints) { if (constraints.maxWidth > largeScreenMinWidth) { return _buildLargeScreenLayout(); } else { return _buildSmallScreenLayout(); }Large-screen optimization includes converting lists to adaptive grids or limiting form and text width with ConstrainedBox, then centering the constrained content.
View source
**Task Progress:**- [ ] Identify full-width components (e.g., `ListView`, text blocks, forms).- [ ] **If optimizing a list:** Convert `ListView.builder` to `GridView.builder` using `SliverGridDelegateWithMaxCrossAxisExtent` to automatically adjust column counts based on window size.- [ ] **If optimizing a form or text block:** Wrap the component in a `ConstrainedBox`.- [ ] Apply `BoxConstraints(maxWidth: [optimal_width])` to the `ConstrainedBox`.- [ ] Wrap the `ConstrainedBox` in a `Center` widget to keep the constrained content centered on large screens.- [ ] Run validator -> test on desktop/tablet target -> review horizontal stretching -> adjust `maxWidth` or grid extents.The visible content consists only of guidance and Flutter/Dart examples; it contains no installation steps, external links, network requests, credential access, privilege escalation, or file-deletion instructions. The workflow mentions running a “validator” but supplies no command or implementation.
View source
- [ ] **If `maxWidth <= largeScreenMinWidth`:** Return a small-screen layout (e.g., a `Column` or standard navigation-style approach).- [ ] Run validator -> resize the application window -> review layout transitions -> fix overflow errors.```dartimport 'package:flutter/material.dart';const double largeScreenMinWidth = 600.0;Files and check records1 files
Coverage and gaps
Content covered in each file
These are the source ranges included in this check, not a guarantee that every issue has been resolved.
SKILL.mdFull text included
This report is for the version above. We read the available code and instructions without running the skill or checking extra packages it installs. This is not a promise of safety: a different version or setup may behave differently.
SKILL.mdInstructions
- Lines read
- 140
- File checksum (to compare versions)
- c89a933ba17b5a05aaeedc684d85e5af10c197282674eafed12016da4d3c4f19