material_design 0.18.0 copy "material_design: ^0.18.0" to clipboard
material_design: ^0.18.0 copied to clipboard

The fastest path to consistent Material Design UIs in Flutter. Build beautiful apps aligned with official metrics and guidelines using a powerful set of ready-to-use design tokens and helper widgets.

Material Design 3 for Flutter #

pub version license Tests Deploy Demo codecov

🎨 The most complete Material Design 3 implementation for Flutter

A comprehensive, type-safe toolkit that brings the full power of Material Design 3 to Flutter apps. Build pixel-perfect UIs with enhanced developer experience through enum-based design tokens, comprehensive documentation, and zero learning curve.

Transform your Flutter development with production-ready design tokens that eliminate guesswork and ensure consistency across your entire application.

πŸš€ Live Demo & Resources #

🌟 View Interactive Demo - Explore all design tokens with live examples

πŸ“š Material Design 3 Guidelines - Official documentation

✨ Features #

  • πŸ” Type-Safe: Enum-based tokens prevent errors at compile time
  • πŸš€ Simple: Intuitive .value pattern for all tokens
  • πŸ“± Responsive: Built-in breakpoints and adaptive layouts
  • πŸŒ™ Dark Mode: Full theme support out of the box
  • πŸ“– Well Documented: Every token has inline documentation

🚧 In Development #

  • 🎨 Complete Token Coverage: Implementing remaining Material Design 3 tokens
  • πŸ› οΈ Widget Helpers: Pre-built components following M3 specifications
  • πŸ“ Design System Framework: Tools to build complete design systems using official M3 tokens

Installation #

dependencies:
  material_design: ^last-version

Quick Start #

import 'package:material_design/material_design.dart';

// Use any token with .value
Container(
  padding: EdgeInsets.all(M3SpacingToken.space16.value),
  decoration: BoxDecoration(
    color: Theme.of(context).colorScheme.primary,
    borderRadius: M3BorderRadiusToken.medium.value,
  ),
  child: Text(
    'Hello Material 3',
    style: Theme.of(context).textTheme.headlineMedium,
  ),
)

πŸ”² Shape System #

Three levels of shape tokens for maximum flexibility:

// High-level: Ready-to-use shapes
Card(
  shape: M3ShapeToken.medium.value, // RoundedRectangleBorder
)

// Mid-level: Border radius for decorations
Container(
  decoration: BoxDecoration(
    borderRadius: M3BorderRadiusToken.large.value, // BorderRadius
  ),
)

// Low-level: Individual radius values
Container(
  decoration: BoxDecoration(
    borderRadius: BorderRadius.only(
      topLeft: M3RadiusToken.extraLarge.value, // Radius
    ),
  ),
)

πŸ“ Spacing & Layout #

Consistent spacing based on 4dp grid:

// Spacing for padding/margins
Padding(
  padding: EdgeInsets.all(M3SpacingToken.space24.value), // 24dp
)

// Responsive margins
Container(
  margin: EdgeInsets.symmetric(
    horizontal: M3MarginToken.compactScreen.value, // 16dp on phones
  ),
)

// Layout gaps
Row(
  children: [
    Widget1(),
    const M3Gap(M3SpacerToken.pane), // 24dp gap
    Widget2(),
  ],
)

🎬 Motion #

Standardized animations:

AnimatedContainer(
  duration: M3MotionDurationToken.medium2.value, // 300ms
  curve: M3MotionCurveToken.emphasized.value,    // Material easing
)

πŸ“ Other Tokens #

// Elevation with surface tint
Container(
  decoration: BoxDecoration(
    color: M3ElevationToken.level3.surfaceColor(context),
    boxShadow: M3ElevationToken.level3.shadows,
  ),
)

// Responsive breakpoints
if (M3BreakpointToken.isMedium(context)) {
  // Tablet layout
}

// Icon sizes
Icon(Icons.star, size: M3IconSizeToken.medium.value) // 32dp

// Border widths
Container(
  decoration: BoxDecoration(
    border: Border.all(width: M3BorderWidthToken.thin.value), // 1dp
  ),
)

// State layer opacities
final Color hoverOverlayColor = Theme.of(context).colorScheme.onSurface.withValues(alpha: M3StateLayerOpacityToken.hover.value);
return AnimatedContainer(
  duration: const Duration(milliseconds: 200),
  color: _onHover ? Color.alphaBlend(hoverOverlayColor, colorScheme.surface) : colorScheme.surface,
  child: // Seu conteΓΊdo aqui,
);

Core Tokens #

🎨 Color System #

Generate complete Material 3 color schemes from a single seed color:

MaterialApp(
  theme: ThemeData(
    useMaterial3: true,
    colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
  ),
)

πŸ“ Typography #

Access all 15 Material 3 text styles:

MaterialApp(
  theme: ThemeData(
    useMaterial3: true,
    textTheme: TextTheme(
      displayLarge: M3TextStyleToken.displayLarge.value,
      ...
      labelSmall: M3TextStyleToken.labelSmall.value,
    ),
  ),
)

Example App #

Run the example to see all tokens in action:

cd example
flutter run

🀝 Contributing #

We welcome contributions! Please see our Contributing Guide for details.

πŸ“„ License #

BSD License - see the LICENSE file for details.

23
likes
0
points
787
downloads

Publisher

unverified uploader

Weekly Downloads

The fastest path to consistent Material Design UIs in Flutter. Build beautiful apps aligned with official metrics and guidelines using a powerful set of ready-to-use design tokens and helper widgets.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, meta, vector_math

More

Packages that depend on material_design