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

Core runtime for Mantle - a Flutter theming architecture where the theme owns design tokens and (eventually) the full build of every widget.

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: ^0.1.0

Quick start #

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

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

void main() {
  runApp(
    MantleProvider(
      theme: myTheme, // a MantleTheme with your tokens
      child: const MaterialApp(home: 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 #

Free for non-commercial use under the PolyForm Noncommercial License 1.0.0.

Commercial use requires a separate agreement with the licensor. Contact: leslmosnk@outlook.com.

1
likes
135
points
143
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Core runtime for Mantle - a Flutter theming architecture where the theme owns design tokens and (eventually) the full build of every widget.

Homepage

Topics

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

License

PolyForm-Noncommercial-1.0.0 (license)

Dependencies

flutter

More

Packages that depend on mantle_core