flutter-platform-patterns
Flutter Platform Patterns
Overview
Guide Flutter development for platform-adaptive UI, responsive layouts, and native platform integration. Covers Material vs. Cupertino patterns, adaptive widgets, responsive layout strategies, and platform channels. Stack-specific Tier 3 reference skill.
Workflow
-
Read project setup — Check
.chalk/docs/engineering/for architecture docs. Determine the target platforms (iOS, Android, web, desktop), minimum SDK versions, and any platform-specific requirements or design guidelines. -
Identify the scope — Parse
$ARGUMENTSfor the specific platform pattern or concern. Categories include: adaptive UI, responsive layout, platform channels, or platform-specific behavior. -
Audit platform-adaptive UI — Check for:
- Hardcoded Material widgets where Cupertino equivalents are expected on iOS (e.g.,
Switchvs.CupertinoSwitch) - Missing platform checks (
Platform.isIOS,Theme.of(context).platform) for platform-specific behavior - Navigation patterns that feel wrong on the target platform (e.g., bottom tabs on Android vs. iOS conventions)
- Adaptive widget usage: prefer
Switch.adaptive,Slider.adaptive, and similar when available
- Hardcoded Material widgets where Cupertino equivalents are expected on iOS (e.g.,
-
Audit responsive layouts — Check for:
- Hardcoded widths/heights that break on different screen sizes
- Missing
LayoutBuilderorMediaQueryusage for responsive breakpoints - Single-column layouts that waste space on tablets and desktop
ListViewwithoutshrinkWrap: trueconsideration insideColumn(common layout bug)- Missing
SafeAreawrapping for notches and system UI
-
Audit platform channels — If native integration is needed, check for:
- Method channel naming conventions (reverse domain:
com.example.app/channel) - Missing error handling on both Dart and native sides
- Missing null safety in channel communication
- Heavy computation on the platform channel that should use an
Isolateor background thread instead - Pigeon or
flutter_rust_bridgeusage where manual channels add unnecessary boilerplate
- Method channel naming conventions (reverse domain:
-
Audit platform-specific concerns — Check for:
- iOS: proper
Info.plistpermissions, App Transport Security, keyboard handling - Android: proper
AndroidManifest.xmlpermissions, back button handling, deep linking - Web: missing
kIsWebchecks, unsupported plugins, SEO considerations - Desktop: window management, menu bar integration, keyboard shortcuts
- iOS: proper
-
Report findings — Present findings with specific file references, the current approach, the recommended pattern, and platform-specific rationale.
Output
- Format: Audit report delivered in the conversation
- Key sections: Platform-Adaptive UI Findings, Responsive Layout Assessment, Platform Channel Review (if applicable), Platform-Specific Concerns, Recommended Patterns with Code Examples
Anti-patterns
- Platform-agnostic everything — Not all UI should look the same on every platform. Users expect iOS apps to feel like iOS and Android apps to feel like Android. Use adaptive widgets and platform checks where conventions differ.
- Overusing platform checks — Conversely, wrapping every widget in
Platform.isIOS ? CupertinoX : MaterialXis unmaintainable. Use adaptive variants where available and only add explicit checks for behaviors that genuinely differ. - Ignoring responsive design until tablet — Phones come in many sizes. A layout that works on a Pixel 7 may break on an iPhone SE. Test with
LayoutBuilderfrom the start. - Synchronous platform channels — Platform channel calls are async. Blocking the UI thread while waiting for a native response causes jank. Always handle loading and error states.
- Skipping error handling on channels — Native code can throw exceptions that crash the app if not caught on the Dart side. Always wrap channel calls in try/catch and handle
MissingPluginExceptionfor platforms that do not implement the channel.
More from generaljerel/chalk-skills
python-clean-architecture
Clean architecture patterns for Python services — service layer, repository pattern, domain models, dependency injection, error hierarchy, and testing strategy
22create-handoff
Generate a handoff document after implementation work is complete — summarizes changes, risks, and review focus areas for the review pipeline. Use when done coding and ready to hand off for review.
16create-review
Bootstrap a local AI review pipeline and generate a paste-ready review prompt for any reviewer agent. Use after creating a handoff or when ready to get an AI code review.
15fix-findings
Fix findings from the active review session — reads reviewer findings files, applies fixes by priority, and updates the resolution log. Use after pasting reviewer output into findings files.
15fix-review
When the user asks to fix, address, or work on PR review comments — fetch review comments from a GitHub pull request and apply fixes to the local codebase. Requires gh CLI.
15review-changes
End-to-end review pipeline — creates a handoff, generates a review (self-review or paste-ready for another provider), then offers to fix findings. Use when you want to review your changes before pushing.
13