The Stepper widget in Flutter is a built-in way to guide users through a sequence of steps, such as a checkout flow, a sign-up form, or a setup wizard. It handles the visual progression and step state (index, active/completed) so you can focus on the content of each step.
In this guide, we'll walk through a complete implementation, from basic setup to validation and performance considerations, with real-world tips from production apps.
Key points
- Stepper is ideal for linear flows with 3–7 steps; avoid it for complex or non-linear navigation.
- Always persist step data in a model to prevent loss when navigating back.
- Customize buttons and icons to match your app's design, and test on small screens.
- Keep step content lightweight to avoid performance issues, since all steps are built at once.
When to Use Stepper (and When Not To)
Stepper works best for linear, multi-step tasks where users need to see progress and can go back and forth. Typical examples include onboarding flows, multi-page forms, and order confirmations. It's less suitable for non-linear navigation or when steps are independent.
For very long forms, consider breaking them into separate screens with a progress indicator instead. Stepper keeps all steps in one widget tree, which can become heavy if each step has complex UI. As a rule of thumb, use Stepper for 3–7 steps; beyond that, a dedicated navigation pattern may be better.
Also note that Stepper is not a full-fledged form manager. You'll still need to manage controllers, validation, and state yourself. But it provides a consistent visual structure that users recognize.
- Use for linear flows with 3–7 steps
- Avoid for non-linear or independent steps
- Consider separate screens for very complex steps
Building a Basic Stepper
To create a Stepper, you provide a list of Step widgets, each with a title, content, and optionally a subtitle and state. The Stepper manages the current step index via the currentStep property and calls onStepContinue and onStepCancel when the user taps the buttons.
You'll typically wrap the Stepper in a StatefulWidget to update the index. The content of each step can be any widget, such as a Form with TextFormFields. Remember to assign a GlobalKey<FormState> to each form if you need to validate separately.
The default controls include 'Continue' and 'Cancel' buttons. You can customize them with controlsBuilder to change labels or add custom actions like 'Skip'.
- Use Step widgets with title, content, and state
- Manage currentStep in a StatefulWidget
- Customize buttons via controlsBuilder
Managing State and Validation Across Steps
Each step often contains form fields that need validation before proceeding. A common approach is to keep a GlobalKey<FormState> for each step and validate in onStepContinue. If validation fails, show errors and prevent advancing.
State management can be handled with setState for simple cases, but for complex forms consider using a form model or a state management solution. Keep the data in a single object that persists across steps, so users don't lose input when navigating back.
If your stepper is part of a larger flow, you might need to handle configuration changes. See our guide on handling configuration changes in Kotlin for principles that apply to Flutter as well (like saving state in ViewModel or using RestorableProperty).
- Validate each step with a GlobalKey<FormState>
- Store step data in a single model
- Use onStepContinue to control progression
Vertical vs Horizontal Stepper
Stepper supports vertical (default) and horizontal layouts via the type property. Vertical is best for forms with many fields, as it gives more vertical space per step. Horizontal works well for short, visual steps like a progress wizard.
On small screens, horizontal steppers can become cramped. Consider switching to vertical on narrow devices or using a custom progress indicator instead. The Stepper's horizontal layout also shows step titles in a row, which may truncate on long labels.
Test both layouts on different screen sizes. You can use LayoutBuilder to choose the type based on available width.
- Vertical for forms with many fields
- Horizontal for short, visual steps
- Use LayoutBuilder to adapt to screen width
| Approach | Best For | Code Complexity | Performance | Customization |
|---|---|---|---|---|
| Stepper (vertical) | Forms with 3–7 steps | Low | Good for light steps | Medium |
| Stepper (horizontal) | Short visual wizards | Low | Good | Medium |
| Separate screens + Navigator | Complex or many steps | Medium | Excellent | High |
| PageView with indicators | Swipeable onboarding | Medium | Good | High |
| Custom stepper | Unique designs | High | Depends on impl. | Very high |
Customizing the Look and Feel
You can customize colors, icons, and line styles via the Stepper's properties like activeColor, circleColor, and connectorColor. The stepIconBuilder allows you to replace the default numbered circles with custom icons.
For more control, you can build your own stepper from scratch using a Column and custom widgets, but that requires more code. The built-in Stepper is themeable enough for most apps.
Keep accessibility in mind: ensure sufficient contrast and that step states are announced by screen readers. Use Semantics widgets if needed.
- Use activeColor and circleColor for theming
- Replace icons with stepIconBuilder
- Ensure accessibility with Semantics
Performance Considerations
Stepper builds all steps at once, even the ones not currently visible. If your steps contain heavy widgets (like lists or images), this can impact performance. Consider using lazy loading or keeping step content lightweight.
For steps with long lists, ensure you use ListView.builder rather than a Column of items. Also, avoid rebuilding the entire Stepper on every keystroke by isolating form state or using a Form widget with onChanged throttling.
A common mistake is to rebuild the whole Stepper when the step index changes, which is fine, but if each step has complex state, consider extracting each step into its own StatefulWidget to limit rebuild scope.
- Stepper builds all steps at once
- Keep step content lightweight
- Extract steps into separate widgets
Common Pitfalls and How to Avoid Them
One frequent issue is losing form data when navigating between steps. Always store input in a model that persists across steps, not just in the widget state of the step content.
Another pitfall is not handling the back button. Users expect to go to the previous step, but the default Stepper's Cancel button may not map to that. Override onStepCancel to decrement the index, and consider using WillPopScope to intercept system back.
Finally, be careful with validation timing. Validating on every keystroke can be annoying; validate on continue or on field blur instead.
- Persist data across steps in a model
- Handle back button with onStepCancel
- Validate on continue, not on every keystroke
Editor and Flutter contributor. Writes practical Flutter tutorials focused on widgets, layout and animation. Enjoys breaking large UI problems into small, testable pieces and explaining them clearly to beginners.



