Skip to content

Introduction

Every Flutter app needs some version of the same things: a theming system, responsive layout, form validation, a snackbar, a way to return errors, and a handful of string and date helpers.

Most teams rebuild these each time, slightly differently. Fabrik is that layer, written once and tested properly — focused packages you can adopt one at a time.

There is no meta-package and no required setup. Add the package that solves your problem:

dependencies:
fabrik_theme: ^1.1.0
fabrik_layout: ^1.2.0

Nothing here depends on anything else, so adopting one package does not commit you to the rest. Choosing a package maps problems to packages.

Theme your app once:

MaterialApp(
theme: FabrikTheme.create(
brightness: Brightness.light,
colors: AppColors.defaults(),
),
darkTheme: FabrikTheme.create(
brightness: Brightness.dark,
colors: AppColors.darkDefaults(),
),
);

Then read semantic values anywhere:

Text('Payment failed', style: TextStyle(color: context.colors.error))
final columns = context.layout.value<int>(mobile: 1, tablet: 2, desktop: 3);

Semantic over literal. context.colors.error says why a color was chosen; Colors.red only says what it is. Names that carry meaning survive redesigns.

Independent packages. Splitting the toolkit means you never ship code you do not use. A package that only needs Either should not pull in a theming system.

Fail loudly, with a fix. Where a mistake cannot be caught by the type system, it becomes an error that names the solution — an unknown form field lists the valid keys, a missing theme extension names the factory to call.

Testable without widgets. Form state, validation and results are plain Dart objects. You should be able to test business rules without a WidgetTester.

Defaults that work, everything replaceable. Get something on screen first, learn the full API when you need it.

Core concepts covers the patterns that recur across packages.

  • Not a state management solution. fabrik_forms handles form state only.
  • Not a widget library. No buttons, cards, or dialogs — Fabrik gives you the tokens, the widgets stay yours.
  • Not a functional programming framework. fabrik_result ships the parts people use and stops short of typeclasses.

fabrik_theme, fabrik_layout and fabrik_result are at 1.x and follow semantic versioning. fabrik_forms, fabrik_utils and fabrik_snackbar are pre-1.0 and may still change; each change ships with a migration note in the package changelog.

Fabrik is developed in the open at github.com/abhakhand/fabrik. Issues and pull requests are welcome.