Flutter Adaptive Ui
Automate and integrate Flutter Adaptive UI for responsive cross-platform interface development
Flutter Adaptive UI is a community skill for building responsive and adaptive user interfaces in Flutter, covering layout builders, breakpoint management, platform detection, adaptive components, and multi-form-factor design for cross-platform Flutter applications.
What Is This?
Overview
Flutter Adaptive UI provides patterns for creating interfaces that adapt to different screen sizes, platforms, and input modalities. It covers LayoutBuilder and MediaQuery for responsive sizing and breakpoint detection, platform-aware widgets that render Material on Android and Cupertino on iOS, adaptive navigation patterns with bottom bars on mobile and side rails on desktop, flexible grid layouts using SliverGrid and Wrap for variable column counts, and input adaptation for touch, mouse, and keyboard interactions. The skill enables Flutter developers to build applications that feel native across phones, tablets, and desktop screens from a single codebase.
Who Should Use This
This skill serves Flutter developers building applications that run on multiple form factors, teams targeting both mobile and desktop platforms from a single codebase, and engineers implementing responsive layouts that adapt to screen dimensions.
Why Use It?
Problems It Solves
Fixed-width layouts break on different screen sizes and orientations. Using Material widgets on iOS creates an inconsistent platform experience. Navigation patterns that work on mobile are awkward on desktop with larger screens. Touch-optimized tap targets are too large for mouse-driven desktop interfaces.
Core Highlights
Breakpoint system switches layouts at configurable width thresholds. Platform detector renders platform-appropriate widgets automatically. Adaptive navigation switches between bottom bar, rail, and drawer based on width. Grid builder adjusts column counts based on available space.
How to Use It?
Basic Usage
import 'package:flutter/material.dart';
class AdaptiveLayout extends
StatelessWidget {
final Widget mobile;
final Widget? tablet;
final Widget? desktop;
const AdaptiveLayout({
super.key,
required this.mobile,
this.tablet,
this.desktop,
});
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
final width =
constraints.maxWidth;
if (width >= 1200 &&
desktop != null) {
return desktop!;
}
if (width >= 600 &&
tablet != null) {
return tablet!;
}
return mobile;
},
);
}
}
// Usage
AdaptiveLayout(
mobile: const MobileHome(),
tablet: const TabletHome(),
desktop: const DesktopHome(),
)Real-World Examples
import 'package:flutter/material.dart';
class AdaptiveScaffold extends
StatelessWidget {
final int selectedIndex;
final ValueChanged<int> onChanged;
final List<NavigationItem> items;
final Widget body;
const AdaptiveScaffold({
super.key,
required this.selectedIndex,
required this.onChanged,
required this.items,
required this.body,
});
@override
Widget build(BuildContext context) {
final width = MediaQuery.of(
context).size.width;
if (width >= 800) {
return Scaffold(
body: Row(children: [
NavigationRail(
selectedIndex:
selectedIndex,
onDestinationSelected:
onChanged,
destinations: items.map(
(i) =>
NavigationRailDestination(
icon: Icon(i.icon),
label: Text(i.label),
)).toList(),
),
Expanded(child: body),
]),
);
}
return Scaffold(
body: body,
bottomNavigationBar:
NavigationBar(
selectedIndex: selectedIndex,
onDestinationSelected:
onChanged,
destinations: items.map(
(i) => NavigationDestination(
icon: Icon(i.icon),
label: i.label,
)).toList(),
),
);
}
}
class NavigationItem {
final IconData icon;
final String label;
const NavigationItem({
required this.icon,
required this.label,
});
}Advanced Tips
Use VisualDensity to adjust widget sizing between touch and mouse input contexts automatically. Implement custom breakpoint classes that read from MediaQuery once and provide typed access to screen category throughout the widget tree. Test adaptive layouts with Flutter DevTools device preview to verify rendering at different sizes.
When to Use It?
Use Cases
Build a productivity app with list view on mobile and master-detail layout on tablets and desktops. Create an e-commerce app that shows grid columns adapting from two on phones to four on wide screens. Implement an admin panel with collapsible sidebar navigation that switches to bottom bar on smaller devices.
Related Topics
Flutter layout system, responsive design, platform adaptation, Material Design, and cross-platform development.
Important Notes
Requirements
Flutter SDK with support for target platforms. Understanding of LayoutBuilder and MediaQuery for size detection. Material and Cupertino widget libraries.
Usage Recommendations
Do: use LayoutBuilder for widget-level responsive behavior and MediaQuery for screen-level decisions. Test on actual devices or emulators at different screen sizes and orientations. Use const constructors for adaptive layout widgets to optimize rebuild performance.
Don't: hardcode pixel values for breakpoints without testing on real device distributions. Mix Material and Cupertino widgets inconsistently within the same platform context. Assume mouse input is available on all platforms when designing hover states.
Limitations
Adaptive layouts add widget tree complexity that can impact build performance on very deep hierarchies. Some platform-specific behaviors cannot be replicated perfectly with Flutter widgets alone. Desktop window resizing triggers frequent rebuilds that need optimization for complex layouts.
More Skills You Might Like
Explore similar skills to enhance your workflow
Googleslides Automation
Create, edit, and manage Google Slides presentations
Linear Cli
Automate and integrate Linear CLI project management into your development workflows
Eventzilla Automation
Automate Eventzilla operations through Composio's Eventzilla toolkit
Scholar Evaluation
Automate and integrate Scholar Evaluation to streamline academic assessment workflows
Accelo Automation
Automate Accelo operations through Composio's Accelo toolkit via Rube MCP
Fullenrich Automation
Automate Fullenrich operations through Composio's Fullenrich toolkit