Sub topic 1
Responsive vs adaptive: what you are designing for
Prerequisites
This chapter assumes that you know basic Dart syntax, can build widget trees with StatelessWidget and StatefulWidget, and are familiar with Row, Column, Scaffold, and ListView. You should also be able to run a Flutter app on a device, emulator, desktop target, or the web.
A Flutter app may run in a narrow phone window, a tablet split screen, a resizable desktop window, or a browser. A fixed layout cannot use every available space well. Responsive and adaptive design are two related ways to handle these changes.
Responsive design
Responsive design means that the same interface changes its size and arrangement as space changes. The content and interaction pattern usually stay the same.
For example, a responsive card might:
- Expand to fill a wider window.
- Wrap its text onto more or fewer lines.
- Change from one column to two columns.
- Keep a usable minimum width instead of shrinking indefinitely.
Responsive behavior is often continuous. A grid can gain columns as width becomes available. Padding can increase gradually. Widgets such as Expanded, Flexible, and Wrap help create this behavior without manually checking every screen width.
Adaptive design
Adaptive design means choosing a different interface when the context changes. The change may depend on window size, platform, input method, or device posture.
For example, an email app might use:
- One screen with a back button on a phone.
- A list beside the selected message on a tablet.
- A navigation rail on a desktop window.
- A touch-friendly control on a phone and a keyboard shortcut on desktop.
Adaptive choices are usually discrete. The app selects one layout or interaction pattern from a small set of alternatives. A breakpoint is a rule that marks where the app changes between those alternatives.
Responsive and adaptive design often work together. A two-pane tablet layout can still respond continuously to the width of each pane.
Choosing the right approach
Start with the content and the task, not with a list of device names. Ask whether the current structure still supports the task at the available width.
Use responsive behavior when the structure remains useful and only dimensions need adjustment. Use adaptive behavior when a structure becomes crowded, inefficient, or difficult to operate.
For example, shrinking a bottom navigation bar until its labels collide is a responsive failure. Replacing it with a navigation rail at a wider breakpoint is an adaptive solution.
The following small example expresses two choices explicitly:
enum LayoutMode { phone, wide }
LayoutMode layoutModeFor(double width) {
return width < 600 ? LayoutMode.phone : LayoutMode.wide;
}The value 600 is a policy decision, not a universal device boundary. Test the design around that value and adjust it based on the content, accessibility needs, and supported platforms.
Summary
Responsive design changes dimensions and flow while preserving the basic structure. Adaptive design selects a different structure or interaction pattern. Flutter applications commonly need both. The next step is to understand how Flutter passes layout constraints so these decisions can be implemented reliably.
Exercise
A dashboard keeps the same cards but changes from one column to three columns as the window grows. Is this primarily responsive or adaptive design?
Show answer
It is primarily responsive design because the structure and task remain the same while the arrangement changes with available space.