fabrik_theme
fabrik_theme provides a consistent design system — typography, color tokens, spacing, border radii, and MaterialApp theming — so you maintain visual consistency across your entire Flutter app without reinventing the wheel.
Installation
Section titled “Installation”Add the package to your pubspec.yaml:
dependencies: fabrik_theme: ^1.0.2Then run:
flutter pub getImport it in your Dart files:
import 'package:fabrik_theme/fabrik_theme.dart';Getting Started
Section titled “Getting Started”Apply the Fabrik theme in MaterialApp:
MaterialApp( themeMode: ThemeMode.system, theme: FabrikThemeBuilder.light(), darkTheme: FabrikThemeBuilder.dark(), home: const HomePage(),);Both light() and dark() accept optional fontFamily and colors parameters:
final colors = FabrikColors.custom( lightPrimary: Colors.indigo, darkPrimary: Colors.indigoAccent,);
MaterialApp( themeMode: ThemeMode.system, theme: FabrikThemeBuilder.light(fontFamily: 'Inter', colors: colors), darkTheme: FabrikThemeBuilder.dark(fontFamily: 'Inter', colors: colors), home: const HomePage(),);Accessing the Theme
Section titled “Accessing the Theme”Use FabrikTheme.of(context) anywhere in the widget tree:
final theme = FabrikTheme.of(context);
Text( 'Hello, Fabrik', style: theme.typography.bodyLarge.copyWith( color: theme.colors.primary, ),),Typography
Section titled “Typography”FabrikTheme.of(context).typography exposes the full type scale:
| Token | Usage |
|---|---|
displayLarge | Hero headlines |
displayMedium | Section headings |
displaySmall | Sub-headings |
headlineLarge | Page titles |
headlineMedium | Card titles |
headlineSmall | Minor headings |
titleLarge | App bar titles |
titleMedium | List item titles |
titleSmall | Supporting labels |
bodyLarge | Primary body copy |
bodyMedium | Default body text |
bodySmall | Captions, helper text |
labelLarge | Button labels |
labelMedium | Tab labels |
labelSmall | Overlines, tags |
Colors
Section titled “Colors”FabrikTheme.of(context).colors gives you access to the semantic color tokens:
theme.colors.primary // brand primarytheme.colors.secondary // brand secondarytheme.colors.background // page backgroundtheme.colors.surface // card / sheet surfacetheme.colors.error // error statetheme.colors.onPrimary // text/icons on primary colorUse FabrikColors.custom(...) to override defaults for both light and dark modes.
Spacing Tokens
Section titled “Spacing Tokens”Static design tokens for consistent padding and gaps:
FabrikSpacing.x1 // 4pxFabrikSpacing.x2 // 8pxFabrikSpacing.x3 // 12pxFabrikSpacing.x4 // 16pxFabrikSpacing.x5 // 20pxFabrikSpacing.x6 // 24pxFabrikSpacing.x8 // 32pxFabrikSpacing.x10 // 40pxFabrikSpacing.x12 // 48pxRadius Tokens
Section titled “Radius Tokens”FabrikRadius.r1 // 4pxFabrikRadius.r2 // 8pxFabrikRadius.r3 // 12pxFabrikRadius.r4 // 16pxFabrikRadius.r5 // 20pxFabrikRadius.r6 // 24pxFabrikRadius.full // circular / pill