Getting Started
Get started with Mihr UI in your Flutter project. This guide walks you through installation, basic setup, and customization.
Installation
From your Flutter project directory, run the following command to add Mihr UI:
$flutter pub add mihr_ui
Mihr UI requires Flutter 3.x and Dart 3.x or later. Run
flutter --version to check.Usage
Wrap your MaterialApp with Mihr UI themes. That's it — all tokens and components are instantly available.
main.dart
import 'package:flutter/material.dart';
import 'package:mihr_ui/mihr_ui.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: MihrTheme.light(),
darkTheme: MihrTheme.dark(),
themeMode: ThemeMode.system,
home: const HomeScreen(),
);
}
}Customize the seed
Set a brand seed on MihrThemeConfig and every component re-skins from it. Pass one of the 17 built-in accent palettes — or generate a scale from any hex with ColorScaleGenerator.fromHex().
Dart
MihrTheme.light(
config: MihrThemeConfig(brand: AccentColors.violet),
)
// or from any hex
MihrTheme.light(
config: MihrThemeConfig(
brand: ColorScaleGenerator.fromHex('#E63946'),
),
)The 17 built-in accents — pass any as your seed:
AccentColors.moss
AccentColors.greenLight
AccentColors.green
AccentColors.teal
AccentColors.cyan
AccentColors.blueLight
AccentColors.blue
AccentColors.blueDark
AccentColors.indigo
AccentColors.violet
AccentColors.purple
AccentColors.fuchsia
AccentColors.pink
AccentColors.rose
AccentColors.orangeDark
AccentColors.orange
AccentColors.yellow