Article

Your brand, your widgets: the modern Flutter stack for custom design libraries

Flutter Create session thumbnail: Craig Labenz, Lucas Josefiak and Leo Farias

Material and Cupertino get a Flutter app off the ground fast. But they are Google’s and Apple’s design languages, not your brand’s. With the Flutter team moving both libraries out of the core framework and into their own packages, building a custom design system has become easier and more important than ever.

At Flutter Create, Craig Labenz from the Flutter team, Leo Farias (creator of Mix) and our Co-Founder and CEO Lucas Josefiak walked through the modern stack for creating, styling and testing your own design library in Flutter. Here is what they covered, and how Widgetbook fits into each step.

Watch the full session: “The new way to build custom design libraries with Flutter” on YouTube


The foundation: raw widgets

As part of the decoupling effort, the Flutter team is strengthening the base layer in widgets.dart. New raw widgets such as RawMenuAnchor ship with the behavior and accessibility you need, but no visual opinion. Craig described them as a wall with a coat of primer: not very pretty, but ready for you to paint.

Raw widgets are added as they are needed or requested. If one is missing, you can file an issue or contribute it yourself.

Outside the framework, pub.dev already offers plenty of widget sets: shadcn_ui, fluent_ui for a Windows look, yaru for Ubuntu and many more. But adapting an existing design system to your brand is often harder than starting from a blank canvas.

Craig Labenz surrounded by Flutter design system packages on pub.dev: shadcn_ui, macos_ui, yaru, fluent_ui, cupertino_ui and more


Mix and Remix: the paint

If raw widgets are the primer, Leo put it simply: Mix is the paint. In plain Flutter, styling usually lives in the widget tree next to your content and interactions. Mix moves it into a styling layer you own, with styles you can reuse and combine. Underneath, it is still all Flutter widgets.

The same styling in Flutter and in Mix: a Container next to a BoxStyler

The same padding, color and rounded corners you would write on a Container become a reusable BoxStyler. Change the radius in the shared style, and every box built from it updates. Styles also respond to context: a different fill in dark mode, a shadow on hover, a smooth animated transition and a slight tilt are all defined in the style. Your widget doesn’t need to check brightness or track hover state.

A Mix style with dark mode, hover shadow and an animated transition, all defined in one BoxStyler

Remix brings Mix and the raw widgets together: components with behavior and accessibility built in, and styling you control. Leo built a button that lifts on hover and gives feedback when pressed. He then reused it as a green “Accepted” button that collapses to an icon and expands on hover. Taken further, Remix lets you build an entire design system the way Material and Cupertino are built. The first one is Fortal, named after Leo’s hometown of Fortaleza.

Fortal, a design system built with Remix

Once you have your own design system, you need to verify that it works and that you aren’t shipping regressions. That’s where Widgetbook comes in.


Widgetbook: a catalog for your design library

The framework gives you the primitives, and Mix gives you a way to style them. What you end up with is a custom design library. The next question is how to visualize and test it.

Widgetbook catalog: the component tree on the left, a Bank Card story in the middle and its args on the right

Widgetbook turns your widget catalog into a browsable, interactive app. You set it up as a separate Flutter app in your repo. Declare a Meta for a widget, run build_runner, and Widgetbook generates a type-safe story class from the widget’s constructor:

import 'package:widgetbook/widgetbook.dart';
import 'package:banking_demo/components/payment_request_row.dart';

part 'payment_request_row.stories.g.dart';

const meta = Meta(PaymentRequestRow.new);

final $Default = _Story(name: 'Default');
import 'package:widgetbook/widgetbook.dart';
import 'package:banking_demo/components/payment_request_row.dart';

part 'payment_request_row.stories.g.dart';

const meta = Meta(PaymentRequestRow.new);

final $Default = _Story(name: 'Default');
import 'package:widgetbook/widgetbook.dart';
import 'package:banking_demo/components/payment_request_row.dart';

part 'payment_request_row.stories.g.dart';

const meta = Meta(PaymentRequestRow.new);

final $Default = _Story(name: 'Default');

Each story is one state of your widget that you can preview in Widgetbook. Every constructor parameter becomes a form field, which we call an arg. Change a string, a double or an enum, and the widget rebuilds immediately. There is no app to run, no screen to navigate to and no login to get past first.

Editing the args of PaymentRequestRow in Widgetbook: the widget rebuilds as name, last4, amount and interactive change


Modes: 64 combinations per story

One widget in one state isn’t the interesting part. The full test matrix is. Widgetbook modes let you set the conditions a component has to work under. For example:

Mode

Values

Theme

Light, Dark

Viewport

Small iOS, Large Android, Tablet, Web

Locale

EN, DE, ZH, AR

Text scale

100%, 200%

That is 2 × 4 × 4 × 2 = 64 combinations, and every story runs through all of them. You can spot edge cases while you’re still developing. In the session, the PaymentRequestRow looked fine by default but broke on an iPhone SE at 200% text scale. The name got truncated and the “Pending” badge wrapped letter by letter.

Switching modes in Widgetbook: viewport, locale and text scale until PaymentRequestRow breaks on iPhone SE at 200%


The agentic loop: no human in the loop

Capturing your design system in Widgetbook stories also improves agentic engineering. Stories show coding agents what each component is and how to use it, so they stick to your design system instead of inventing new UI. They also close the loop on testing:

  1. Widgetbook captures the design system.

  2. The agent reads the stories.

  3. The agent writes test scenarios for every permutation.

  4. Tests fail on edge cases.

  5. The agent reads the failures and fixes the code itself.

The agentic loop: seconds, deterministic, no human in the loop

The agent checks the whole test matrix against the original Figma design. The PaymentRequestRow passes in the default configuration (light theme, iPhone SE, English, 100% text scale) but fails at 200% text scale. The same test run catches accessibility violations, such as a reject button with a 32×32 tap target and no semantic label.

The agent reads those failures, applies fixes and runs again until everything is green. That’s deterministic feedback in seconds, with no human in the loop.

flutter test output: two failures, the agent applies fixes, all green


Widgetbook Cloud: review is the new bottleneck

Agents generate code faster than ever, so review becomes the bottleneck. Widgetbook Cloud checks every pull request and catches every visual change automatically. Humans can then quickly judge whether the agent, or we, made only the intended changes.

Reviewers open the build straight from the pull request and step through the changes in their browser. That means designers and other stakeholders can review real components and screens without installing Flutter, cloning the repo or running the app.

Widgetbook Cloud review of a pull request: baseline next to the new snapshot, with the visual diff toggled on

Next to the visual diff, Widgetbook Cloud also shows accessibility regressions. In the demo, the semantic label “Accept” had been dropped from a button. A visual diff would never show that. Approve the review, the Widgetbook check in your CI turns green, and you can merge with confidence.



The modern Flutter UI stack

Put together, the stack looks like this:

  • Flutter framework: the primitives, with raw widgets that handle behavior and accessibility.

  • Mix: a styling layer of your own.

  • Widgetbook: a catalog of your custom design library.

  • Widgetbook Cloud: a UI testing and review platform, so you ship the best version of your app.

The full stack: framework widgets, Mix styling, your design library in Widgetbook, and Widgetbook Cloud around it

Material and Cupertino will keep getting apps off the ground. But if your product has its own design language, you now have a complete toolchain to build, style, test and review it.

Get Started

Start with the open-source package

Widgetbook is open source and free. Get started on pub.dev.

Get Started

Start with the open-source package

Widgetbook is open source and free. Get started on pub.dev.

Get Started

Start with the open-source package

Widgetbook is open source and free. Get started on pub.dev.