mantle_core 1.1.0 copy "mantle_core: ^1.1.0" to clipboard
mantle_core: ^1.1.0 copied to clipboard

Core runtime for Mantle: design tokens, MantleTheme, MantleProvider, and the theme-owned widget architecture.

mantle_core #

Weave your own widgets. Mantle is a Flutter theming architecture where the theme owns more than colors — it owns the design tokens (and, across the Mantle packages, the structure of every widget).

mantle_core is the runtime foundation: token primitives, MantleTheme, MantleProvider, and root-theme access via the Mantle facade.

Inspired by Mantine. Sister packages (mantle_widgets, mantle_basic, codegen, …) build on this core.

Install #

dependencies:
  mantle_core: ^1.1.0

A runnable sample lives in example/.

Quick start #

Provide a theme at the root of your app (above WidgetsApp so overlays still find it):

import 'package:flutter/widgets.dart';
import 'package:mantle_core/mantle_core.dart';

void main() {
  runApp(
    MantleProvider(
      theme: myTheme, // a MantleTheme with your tokens
      child: WidgetsApp(
        color: const Color(0xFF228BE6),
        builder: (context, child) => const HomePage(),
      ),
    ),
  );
}

Read tokens from context (rebuilds when that aspect of the theme changes):

@override
Widget build(BuildContext context) {
  final mantle = MantleTheme.of(context);
  return ColoredBox(
    color: mantle.colors['gray'][0],
    child: Padding(
      padding: mantle.spacing.all('md'),
      child: Text('Hello', style: mantle.typography.body),
    ),
  );
}

Or via the root-theme facade (no BuildContext, no rebuild subscription — fine outside build, or when the root theme is stable):

final color = Mantle.theme.colors['red'][6];

What's included #

Area Highlights
Tokens MantleColor (10-shade scales), MantleColors, icons, typography, spacing, radius, shadows, breakpoints, size scales
Theme MantleTheme bundling token groups with mergeWith / lerpWith
Provider MantleProvider with aspect-scoped InheritedModel lookup and optional theme animation
Facade Mantle.theme / Mantle.attach for root-theme static access
Widgets MantleIcon, BreakpointBuilder

License #

MIT. See LICENSE.

1
likes
160
points
104
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Core runtime for Mantle: design tokens, MantleTheme, MantleProvider, and the theme-owned widget architecture.

Homepage
Repository (GitHub)
View/report issues

Topics

#flutter #theme #design-system #tokens #ui

License

MIT (license)

Dependencies

flutter, flutter_test, meta

More

Packages that depend on mantle_core