minimal_ui 0.2.1
minimal_ui: ^0.2.1 copied to clipboard
A precise, quiet design system for Flutter: hairlines, dense rows, mono tabular figures and one primary colour, in three presets by day and by night.
minimal_ui #
A precise, quiet design system for Flutter, in the family of Linear and shadcn/ui: hairlines instead of containers, dense 44 px rows, hierarchy from weight rather than size, numbers in mono tabular figures, and one primary colour spent on the action. It ships three presets (standard, graphite, ember), each designed by day and by night, and it reads as well on a 1440 px desktop window as on a phone.
| Desktop, by day | Phone, by night |
|---|---|
| [A habit tracker on Minimal at 1440 px] | [The habit tracker on a phone, by night] |
| [A bakery's back office at 1440 px] | [The bakery's orders on a phone, by night] |
The parts carry the names Material gives them (MinimalButton, MinimalTextField, MinimalAppBar,
MinimalNavigationBar, MinimalListTile, MinimalCheckbox, MinimalSwitch, MinimalSegmentedButton,
MinimalTabBar, ...) and shadcn's names for its colours (primary, foreground, muted, destructive, ring).
Install #
dependencies:
minimal_ui: ^0.2.1
Set up #
MinimalTheme is the whole install. Put it in your app's builder:, under a MaterialApp, a CupertinoApp or a
WidgetsApp, with a MinimalToaster inside it if the app shows snack bars:
import 'package:flutter/material.dart';
import 'package:minimal_ui/minimal_ui.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await minimalLoadFonts(); // the bundled Geist faces, before the first frame
runApp(const App());
}
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) => MaterialApp(
// Minimal's push and pop for the app's own page routes (Page motion, below).
theme: ThemeData(pageTransitionsTheme: const PageTransitionsTheme(builders: minimalPageTransitions)),
builder: (context, child) => MinimalTheme(
data: MinimalThemeData.preset('standard', MediaQuery.platformBrightnessOf(context)),
child: MinimalToaster(child: child!),
),
home: const MinimalScaffold(
topBar: MinimalAppBar(title: 'Requests'),
body: MinimalListTile(title: 'Replace the lobby lights', meta: 'REQ-142'),
),
);
}
A CupertinoApp or a WidgetsApp takes the same builder:; nothing in the package needs Material's app around it.
context.minimalTheme (or MinimalTheme.of(context)) reads the theme, a nested MinimalTheme restyles a subtree,
and AnimatedMinimalTheme eases between two. The package takes no router: its pages are plain widgets for any
navigator.
Page motion. A page pushed in Minimal fades in over 8 px, and a pop reverses it; a tab, rail or side-bar switch
changes in place, and MinimalFadeRoute replaces a page with no travel. minimalPageTransitions maps that push to
every platform. MinimalTheme sets it on the Material the package is built on (material_ui); a MaterialPageRoute
from Flutter's own package:flutter/material.dart reads your app's ThemeData instead, so name the map there, as the
setup above does, or the platform's slide or zoom flies the page in. The map's iOS entry wraps the push in ui_core's
DesignSwipeBackPageTransitionsBuilder, so a swipe from a page's leading edge still takes it back, the page following
the finger as on every iOS screen (for a map you build yourself, designSwipeBack(map) does the same). Android's back
closes what is open over the page (a menu, a combobox's list, a popover, a sheet, a dialog) before it pops the page.
Everyday parts #
// A button: primary by default; secondary, ghost and destructive beside it.
MinimalButton('Create habit', onPressed: create);
MinimalButton('Cancel', variant: MinimalButtonVariant.secondary, onPressed: close);
// A field: the label above, the hint inside, the error below.
MinimalTextField(label: 'Name', hint: 'Stretch before bed', controller: name);
// A select: a field-shaped row whose list opens on the field's edges.
MinimalSelect(
label: 'Repeats',
value: repeat,
options: const [
MinimalSelectOption('daily', 'Every day'),
MinimalSelectOption('weekdays', 'Weekdays'),
],
onChanged: (value) => setState(() => repeat = value),
);
// A list: hairline rows with a mono meta at the end.
MinimalListSection(
children: [
for (final habit in habits)
MinimalListTile(title: habit.name, meta: '${habit.streak}d', onTap: () => open(habit)),
],
);
// A dialog that asks before something destructive.
final sure = await showMinimalDialog<bool>(
context,
builder: (context) => const MinimalDialog(
title: 'Delete habit?',
message: 'Its history goes too.',
confirmLabel: 'Delete',
cancelLabel: 'Keep',
destructive: true,
),
) ?? false;
// Navigation: a tab bar on a phone, a rail (MinimalNavigationRail) on a wide window.
MinimalNavigationBar(
items: const [
MinimalNavItem(LucideIcons.calendarCheck, 'Today'),
MinimalNavItem(LucideIcons.listChecks, 'Habits'),
],
selectedIndex: tab,
onDestinationSelected: (index) => setState(() => tab = index),
);
The example app (example/) shows every part on its own page and three whole apps built on them: a habit tracker, an
issue tracker and a bakery's back office.
How Minimal is built #
Minimal is type, ink and space. A part the style never had is built from these rules rather than borrowed from another system, and a part you add should follow them too.
- Material. Everything stands on one flat ground, in type and ink. A hairline divides only where space can't; a card is a hairline round a group, not a raised slab.
- Choice. A choice is said in ink and weight. The current page, a chosen row, chip or card, a toggled glyph turn to the full ink (the words at medium weight, or a hairline turning to ink); the rest stay muted. No tinted pill, no glow.
- Colour. The accent goes on the act to take and on a control's own value (a checked box, a switch that is on, a picked day). The status tones go on what has that status. The one wash is the selection's, behind the rows picked in a table or a list and the command palette's row the keyboard is on. In an open list, the row under the pointer or the keyboard takes the neutral muted fill, so a place never reads as a choice. Nothing else is coloured.
- Depth. Two layers: the page, and what floats over it while it is needed (a menu, a dialog, a sheet, a toast, a row held in a drag). Only a floating thing has a shadow, one soft one; nothing on the page casts any.
- Light. None falls on it: no gradient, bevel, inner shadow or glow. A key cap is flat; a colour picker's gradients are its content, not light.
- Stacking. Parts stand side by side or one above another, divided by space. Where faces must stack (an avatar group), a ring of the ground cuts them apart.
- Motion. Short and plain: a fade or a few-pixel slide in 90 to 160 ms, easing out. Nothing springs, bounces or overshoots, and reduced motion shows the end state.
So a swipe reveals its acts as words on the muted ground, not blocks of colour; a pull to refresh shows a bare spinner in the space the pull opens, not a floating disc; an action sheet is one card with Cancel as its quiet last row; the current step of a run is an ink rim, not the accent.
Make it yours #
MinimalThemeData is shaped like Material's ThemeData: copyWith, lerp (a.lerp(b, t)), value equality. Start
from a preset (MinimalThemeData.standard(), .graphite(), .ember()) or from your own colours, then turn the knobs:
final theme = MinimalThemeData.from(
primary: const Color(0xFF7A1F5C), // the one colour spent on the action
neutral: const Color(0xFF8B7355), // tints the greys warm or cool
).copyWith(
shapes: const MinimalShapes(radius: 12), // one radius, as shadcn's --radius
density: MinimalDensity.compact, // unset, the platform's own
);
MinimalThemeData.fromadjusts rather than asserts: the label on the primary colour, the primary colour as text, the inks and every mark keep their contrast whatever colours you give it.shapesis one radius and the corner scale derived from it (mark, small, medium, large), and every part reads its role's step: a tag the mark, a button or a field the small step, a card the medium, a dialog the large. Capsules by role (chips, a switch's track, progress and slider tracks, count badges, page dots) takeshapes.pill, so they square up atMinimalShapes(radius: 0). A part inside another is its frame's outline moved in (MinimalShapes.inset). What is round by meaning stays round: a radio, a slider's thumb, an avatar, a step's marker.typefacesets the sans and mono faces (MinimalTypeface.app(sans:, mono:)for your own),shadowSm,shadowMdandshadowLgthe three shadows of what floats, andiconStrokethe icons' stroke, between 1.5 and 2 (a debug build asserts it: past 2 the icons stop reading thin).componentsholds a style for 23 kinds of part (MinimalStyle, withButtonStyle's slots asWidgetStatePropertys): the four button variants, the icon button, the text field, the chip, the checks, the slider, the segmented button, cards, list sections, dialogs, sheets, menus, toasts, the command palette, avatars, badges, tooltips and banners. The same style also goes on one widget through itsstyle:(a text field's box throughfieldStyle:). A widget's style beats its component theme, which beats the knobs, which beat the look; each part's doc lists the slots it reads. The app bar, tabs, navigation, list rows and select take no style yet.- Two settings can draw what Minimal never does, so they are yours to keep in its terms: a
fillfor a selected chip or segment is the tinted pill (Minimal says a choice in ink and weight), and a coloured or spread shadow is a glow. - A hovering pointer changes nothing by default. An app that wants a hover wash sets
overlayforWidgetState.hovered.
MinimalButton(
'Save',
onPressed: save,
style: MinimalStyle(
shape: const WidgetStatePropertyAll(StadiumBorder()),
fill: WidgetStateProperty.resolveWith(
(states) => states.contains(WidgetState.pressed) ? pressedInk : null,
),
),
);
The host library #
package:minimal_ui/minimal_host.dart holds the layer an app builder's host draws pages under: MinimalHost (the
theme, page transitions, ground and toasts in one mount), MinimalPreview, the route pages and the chrome metrics. An
ordinary app does not need it.
Accessibility and languages #
-
Right to left. Every part lays out from its start edge: insets and alignments are directional, back and next chevrons and arrows flip, sliders and progress fill from the start side, tabs, carousels and swipe-to-dismiss follow the reading direction. Code stays left to right. Public parameters take
EdgeInsetsGeometryand say start and end, never left and right. The example gallery's Customize panel has a Direction control (?dir=rtlin its address). -
Large text. Parts follow the platform's text scale up to 200%:
MinimalHostclamps larger settings atMinimalChromeMetrics.maxTextScale(2.0). Up to it, rows and controls grow taller rather than cut words, and long labels wrap or end in an ellipsis. The gallery's Customize panel shows every page at 130%, 160% and 200% (?text=2). -
Other scripts. Geist covers Latin. Arabic, Hebrew, Chinese, Japanese, Hindi, Thai and the rest are drawn by the platform's fallback fonts (on the web, Flutter fetches Noto). Line heights are set for Latin; tall scripts are not yet checked in every part.
-
Built-in words. English is the default, with nothing to set up. The words a part says on its own that every look shares (Back, Close, Cancel, OK, Search, Clear, Today, Next month, Loading, "Slide 2 of 5", a screen reader's names for a carousel, a menu bar or a split view's handle) come from
DesignLocalizations, exported with the package, in 30 languages (DesignLocalizations.supportedLocales). Opt in with its delegate beside Flutter's, fromflutter_localizations(addflutter_localizations: sdk: flutterto your pubspec):import 'package:flutter_localizations/flutter_localizations.dart'; MaterialApp( localizationsDelegates: const [ DesignLocalizations.delegate, ...GlobalMaterialLocalizations.delegates, ], supportedLocales: DesignLocalizations.supportedLocales, // ... )A text field's menu (Copy, Paste) speaks Material's and Cupertino's own translations, which Minimal loads itself; a language they don't speak gets English. Words only Minimal says (the composer's buttons, "Step 2 of 4", task statuses and priorities) are English until you give your own: extend
MinimalLocalizationsEn, override the words you translate, and addMinimalLocalizations.delegateOf(yourWords)tolocalizationsDelegates. For a language of your own for the shared words, extendDefaultDesignLocalizationsthe same way. -
Dates and numbers. The month and year over a calendar, a day's full name and the first day of the week come from
DesignLocalizations, and the time pickers takeuse24HourFormat. Numbers and money print as you pass them; the parts do no locale formatting of their own. -
Screen readers and keyboard. Every control announces its role, label, value and state (checked, selected, expanded, disabled); decorative paint is excluded. Everything works by keyboard, with a visible ring (in an open list, the muted fill on the row the keyboard is on), and focus follows reading order in both directions. A menu takes a menu button's keys: Enter, Space or Down opens it on the chosen item, the arrows, Home, End and a letter move through it, and Enter or Escape hands the keys back to the control. Interactive parts take an optional
focusNodeandautofocus. Every control's tap target is at least 44 × 44 under a finger and 24 × 24 under a pointer (ui_core'sDesignTapTarget;MinimalThemedeclares the floors withDesignTapTargetScope): the compact faces keep their size and the target grows round them, whatever the density. Text meets 4.5:1 contrast, and with reduced motion (Android's Remove animations, iOS's Reduce Motion or the web's prefers-reduced-motion, read through ui_core'sdesignReduceMotionOf) every change switches at once. -
Labels as strings. Some parts take a
Stringlabel or anIconDatawhere Flutter would take a widget (MinimalButton's label,MinimalListTile's title,MinimalChip's label). A widget slot beside each, when one comes, will be optional, so nothing that compiles today breaks.
Fonts and icons #
Geist and Geist Mono are bundled (SIL OFL 1.1). Icons come from Lucide (ISC) through lucide_icons_flutter.