
Flutter Adaptive Ui
Implement Flutter adaptive UI with Capability and Policy patterns so purchases and platform behavior differ correctly on iOS, Android, and web.
Overview
Flutter Adaptive UI is an agent skill for the Build phase that guides adaptive Flutter interfaces using Capability and Policy patterns for platform-specific behavior.
Install
npx skills add https://github.com/madteacher/mad-agents-skills --skill flutter-adaptive-uiWhat is this skill?
- Demonstrates Capability vs Policy split for what the app can do vs what you choose to show
- Platform-gated external purchase flows (e.g. Buy in Browser vs not available)
- Material scaffold pattern ready to extend for tablet, desktop, and foldable breakpoints
- Keeps platform-specific behavior out of scattered if-platform clutter
Adoption & trust: 1.7k installs on skills.sh; 101 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your Flutter app sprinkles Platform checks through widgets and you cannot safely adapt purchases, layout, or features per platform.
Who is it for?
Solo developers shipping Flutter apps that must differ behavior or commerce flows by platform policy.
Skip if: Teams only targeting a single platform with no adaptive requirements, or native Swift/Kotlin-only projects.
When should I use this skill?
User is building or refactoring Flutter UI that must adapt by platform, screen size, or external purchase rules.
What do I get? / Deliverables
You refactor toward testable Capability/Policy types so adaptive UI and gated flows stay consistent as you add more form factors.
- Capability/Policy class structure for adaptive features
- Example scaffold wiring platform-gated purchase UI
Recommended Skills
Journey fit
How it compares
Pattern-oriented Flutter skill—not a full design system generator or backend payment integration.
Common Questions / FAQ
Who is flutter-adaptive-ui for?
Indie and small-team Flutter developers who need maintainable adaptive UI and platform-aware feature gating.
When should I use flutter-adaptive-ui?
During Build when you are implementing responsive layouts, store-compliant purchase paths, or separating can-do vs should-show logic in Flutter.
Is flutter-adaptive-ui safe to install?
Check the Security Audits panel on this Prism page; the skill is example code and patterns—review any purchase or URL-launcher code before shipping to production.
SKILL.md
READMESKILL.md - Flutter Adaptive Ui
import 'package:flutter/material.dart'; /// Example of Capability and Policy classes /// for handling platform-specific behavior. class CapabilityPolicyExample extends StatelessWidget { const CapabilityPolicyExample({ super.key, this.capability = const Capability(), this.policy = const Policy(), }); final Capability capability; final Policy policy; @override Widget build(BuildContext context) { final canOpenExternalPurchase = capability.canOpenExternalPurchase(); final shouldShowExternalPurchase = policy.shouldShowExternalPurchase(); return Scaffold( appBar: AppBar(title: const Text('Capability & Policy Example')), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ if (canOpenExternalPurchase && shouldShowExternalPurchase) ElevatedButton( onPressed: capability.openExternalPurchase, child: const Text('Buy in Browser'), ) else const Text('Purchase not available on this platform'), ], ), ), ); } } /// Capability class - defines what the code CAN do class Capability { const Capability(); /// Check whether the app has an implementation for opening purchases. bool canOpenExternalPurchase() { return true; } /// Open purchase flow using the target app's URL launcher or service. void openExternalPurchase() { debugPrint('Opening purchase flow'); } } /// Policy class - defines what the code SHOULD do class Policy { const Policy({this.externalPurchaseAllowed = true}); final bool externalPurchaseAllowed; /// Policy: decide whether the external purchase entry point is allowed. bool shouldShowExternalPurchase() { return externalPurchaseAllowed; } } import 'package:flutter/material.dart'; /// Example of responsive navigation that switches between /// NavigationBar (bottom) and NavigationRail (side) /// based on window width. class ResponsiveNavigationExample extends StatefulWidget { const ResponsiveNavigationExample({super.key}); @override State<ResponsiveNavigationExample> createState() => _ResponsiveNavigationExampleState(); } class _ResponsiveNavigationExampleState extends State<ResponsiveNavigationExample> { static const _destinations = [ _AdaptiveDestination(Icons.home, 'Home'), _AdaptiveDestination(Icons.search, 'Search'), _AdaptiveDestination(Icons.person, 'Profile'), ]; int _selectedIndex = 0; void _selectDestination(int index) { setState(() { _selectedIndex = index; }); } @override Widget build(BuildContext context) { final width = MediaQuery.sizeOf(context).width; return width >= 600 ? _buildLargeLayout() : _buildSmallLayout(); } /// Layout for small screens - bottom navigation Widget _buildSmallLayout() { return Scaffold( appBar: AppBar(title: Text(_destinations[_selectedIndex].label)), body: _DestinationBody(label: _destinations[_selectedIndex].label), bottomNavigationBar: NavigationBar( selectedIndex: _selectedIndex, onDestinationSelected: _selectDestination, destinations: [ for (final destination in _destinations) NavigationDestination( icon: Icon(destination.icon), label: destination.label, ), ], ), ); } /// Layout for large screens - side navigation rail Widget _buildLargeLayout() { return Scaffold( body: Row( children: [ NavigationRail( selectedIndex: _selectedIndex, onDestinationSelected: _selectDestination, labelType: NavigationRailLabelType.all, destinations: [ for (final destination in _destinations) NavigationRailDestination( icon: Icon(destination.icon), label: Text(destination.label),