Skip to content

fabrik_theme

pub.dev

The Fabrik Theme package provides a consistent design system with typography, spacing, colors, and theming configuration to help you maintain visual consistency across your Flutter apps.

Add the package to your pubspec.yaml:

dependencies:
fabrik_theme: ^0.0.1

Then run:

Terminal window
flutter pub get

Import fabrik_theme in your Dart files:

import 'package:fabrik_theme/fabrik_theme.dart';

Apply the theme in MaterialApp:

MaterialApp(
themeMode: ThemeMode.system,
theme: FabrikThemeBuilder.light(),
darkTheme: FabrikThemeBuilder.dark(),
home: HomePage(),
);

Customize the FabrikTheme:

final colors = FabrikColors.custom(
lightPrimary: Colors.green,
darkPrimary: Colors.greenAccent,
);
return MaterialApp(
themeMode: ThemeMode.system,
theme: FabrikThemeBuilder.light(fontFamily: 'Roboto', colors: colors),
darkTheme: FabrikThemeBuilder.dark(fontFamily: 'Roboto', colors: colors),
home: const HomePage(),
);

You can access the theme anywhere in the widget tree:

final theme = FabrikTheme.of(context);
Text(
'Fabrik Typography.',
theme.typography.bodyLarge.copyWith(
color: theme.colors.primary,
),
),

Access token values anywhere in your app:

FabrikSpacing.x4
FabrikRadius.r4