xiaohongshu
xiaohongshu
flutter-adaptive-ui
Build adaptive and responsive Flutter UIs that work beautifully across all platforms and screen sizes. Use when creating Flutter apps that need to adapt layouts based on screen size, support multiple platforms including mobile tablet desktop and web, handle different input devices like touch mous...
Full skill instructions
Create Flutter applications that adapt gracefully to any screen size, platform, or input device. This skill provides comprehensive guidance for building responsive layouts that scale from mobile phones to large desktop displays while maintaining excellent user experience across touch, mouse, and keyboard interactions.
Core Layout Rule: Constraints go down. Sizes go up. Parent sets position.
3-Step Adaptive Approach:
Key Breakpoints:
Follow the 3-step approach to make your app adaptive.
Identify widgets that need adaptability and extract common data. Common patterns:
For navigation, create a shared Destination class with icon and label used by both NavigationBar and NavigationRail.
Choose the right measurement tool:
MediaQuery.sizeOf(context) - Use when you need app window size for top-level layout decisions
MediaQuery.of() for size queriesLayoutBuilder - Use when you need constraints for specific widget subtree
BoxConstraintsExample:
// For app-level decisions
final width = MediaQuery.sizeOf(context).width;
// For widget-specific constraints
LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth < 600) {
return MobileLayout();
}
return DesktopLayout();
},
)
Apply breakpoints to select appropriate UI. Don't base decisions on device type - use window size instead.
Example breakpoints (from Material guidelines):
class AdaptiveLayout extends StatelessWidget {
@override
Widget build(BuildContext context) {
final width = MediaQuery.sizeOf(context).width;
if (width >= 840) {
return DesktopLayout();
} else if (width >= 600) {
return TabletLayout();
}
return MobileLayout();
}
}
Flutter layout follows one rule: Constraints go down. Sizes go up. Parent sets position.
Widgets receive constraints from parents, determine their size, then report size up to parent. Parents then position children.
Key limitation: Widgets can only decide size within parent constraints. They cannot know or control their own position.
For detailed examples and edge cases, see layout-constraints.md.
Row/Column
Row arranges children horizontallyColumn arranges children verticallymainAxisAlignment and crossAxisAlignmentExpanded to make children fill available space proportionallyContainer
Expanded/Flexible
Expanded forces child to use available spaceFlexible allows child to use available space but can be smallerflex parameter to control proportionsFor complete widget documentation, see layout-basics.md and layout-common-widgets.md.
Break down widgets
const widgetsDesign to platform strengths
Solve touch first
Never lock orientation
Avoid device type checks
Platform.isIOS, Platform.isAndroid for layout decisionsUse breakpoints, not orientation
OrientationBuilder for layout changesMediaQuery.sizeOf or LayoutBuilder with breakpointsDon't fill entire width
GridView or flex patternsSupport multiple inputs
For complete best practices, see adaptive-best-practices.md.
Separate what your code can do from what it should do.
Capabilities (what code can do)
Policies (what code should do)
// Capability class
class Capability {
bool hasCamera() {
// Check if camera API is available
return Platform.isAndroid || Platform.isIOS;
}
}
// Policy class
class Policy {
bool shouldShowCameraFeature() {
// Business logic - maybe disabled by store policy
return hasCamera() && !Platform.isIOS;
}
}
Benefits:
For detailed examples, see adaptive-capabilities.md and capability_policy_example.dart.
Switch between bottom navigation (small screens) and navigation rail (large screens):
Widget build(BuildContext context) {
final width = MediaQuery.sizeOf(context).width;
return width >= 600
? _buildNavigationRailLayout()
: _buildBottomNavLayout();
}
Complete example: responsive_navigation.dart
Use GridView.extent with responsive maximum width:
LayoutBuilder(
builder: (context, constraints) {
return GridView.extent(
maxCrossAxisExtent: constraints.maxWidth < 600 ? 150 : 200,
// ...
);
},
)
This skill currently has no executable scripts. All guidance is in reference documentation.
This skill includes complete Dart example files demonstrating:
These assets can be copied directly into your Flutter project or adapted to your needs.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience