A Flutter package providing Material 3 Expressive loading indicators with smooth morphing shape animations.
- π¨ Material 3 Expressive Design - Follows Google's latest design system
- β‘ Smooth Animations - Spring-based morphing between 7 different shapes
- π Flexible Sizing - Predefined constants or custom dimensions via double values
- π¨ Background Support - Optional circular background color
- π― Themeable - Respects
ProgressIndicatorThemeor accepts custom colors - βΏ Accessible - Semantic labels and respects
disableAnimations - π Zero Config - Works out of the box with Material theme
Add to your pubspec.yaml:
dependencies:
m3e_loading:
git:
url: https://github.com/dthuy62/m3e_loading.git
ref: mainOr run:
flutter pub add m3e_loading --git-url=https://github.com/dthuy62/m3e_loading.gitimport 'package:m3e_loading/m3e_loading.dart';
// Default size (40px)
M3ELoadingIndicator()
// With predefined size constant
M3ELoadingIndicator(size: M3ELoadingIndicator.sizeMD)Choose from predefined sizes or specify custom dimensions:
// Default size (40px)
M3ELoadingIndicator()
// Predefined constants (recommended for consistency)
M3ELoadingIndicator(size: M3ELoadingIndicator.sizeXS) // 28px
M3ELoadingIndicator(size: M3ELoadingIndicator.sizeSM) // 32px
M3ELoadingIndicator(size: M3ELoadingIndicator.sizeMD) // 40px
M3ELoadingIndicator(size: M3ELoadingIndicator.sizeLG) // 48px
M3ELoadingIndicator(size: M3ELoadingIndicator.sizeXL) // 56px
// Custom size for special cases
M3ELoadingIndicator(size: 35.0)
M3ELoadingIndicator(size: 100.0)M3ELoadingIndicator(
size: M3ELoadingIndicator.sizeMD,
color: Colors.blue,
)Add a circular background behind the indicator:
// Solid background
M3ELoadingIndicator(
backgroundColor: Colors.grey.shade200,
)
// Semi-transparent background (useful for overlays)
M3ELoadingIndicator(
backgroundColor: Colors.black.withOpacity(0.1),
)
// Combined with custom size
M3ELoadingIndicator(
size: M3ELoadingIndicator.sizeLG,
backgroundColor: Theme.of(context).colorScheme.surfaceContainerHighest,
)ProgressIndicatorTheme(
data: ProgressIndicatorThemeData(
color: Theme.of(context).colorScheme.secondary,
),
child: M3ELoadingIndicator(),
)Center(
child: M3ELoadingIndicator(),
)The indicator morphs through 7 Material shapes in sequence:
- Soft Burst
- Cookie (9-sided)
- Pentagon
- Pill
- Sunny
- Cookie (4-sided)
- Oval
Then loops back to Soft Burst.
Main widget displaying the animated loading indicator.
Properties:
size(double?) - Size of the indicator in logical pixels. Default:40.0(sizeMD constant)color(Color?) - Optional color override. If null, usesProgressIndicatorTheme.colororColorScheme.primarybackgroundColor(Color?) - Optional circular background color. Default: null (transparent)
Size Constants:
M3ELoadingIndicator.sizeXS- 28.0 pixelsM3ELoadingIndicator.sizeSM- 32.0 pixelsM3ELoadingIndicator.sizeMD- 40.0 pixels (default)M3ELoadingIndicator.sizeLG- 48.0 pixelsM3ELoadingIndicator.sizeXL- 56.0 pixels
The M3ELoadingSize enum has been replaced with static const double values for better flexibility while maintaining named size convenience. This follows Flutter SDK conventions (Icon, CircularProgressIndicator patterns).
Before (v1.x):
M3ELoadingIndicator(size: M3ELoadingSize.xs)
M3ELoadingIndicator(size: M3ELoadingSize.md)
M3ELoadingIndicator(size: M3ELoadingSize.xl)After (v2.0+):
M3ELoadingIndicator(size: M3ELoadingIndicator.sizeXS)
M3ELoadingIndicator(size: M3ELoadingIndicator.sizeMD)
M3ELoadingIndicator(size: M3ELoadingIndicator.sizeXL)
// Or use direct values for even more flexibility
M3ELoadingIndicator(size: 28.0)
M3ELoadingIndicator(size: 40.0)
M3ELoadingIndicator(size: 56.0)Migration Steps:
- Find and replace:
M3ELoadingSize.βM3ELoadingIndicator.size - Uppercase the size suffix (e.g.,
mdβMD,xsβXS) - Or replace with direct double values
- Uses
RepaintBoundaryfor optimized repaints - Respects
MediaQuery.disableAnimationsOf()for accessibility - Efficient
shouldRepaintlogic in custom painter - Smooth 60fps animations with spring physics
| Platform | Supported |
|---|---|
| Android | β |
| iOS | β |
| Web | β |
| macOS | β |
| Linux | β |
| Windows | β |
See the example directory for a complete demo app.
To run the example:
cd example
flutter runandroidx_graphics_shapes^1.5.0 - Material shape morphing library
Inspired by Android's Material 3 Expressive loading indicators.
MIT License - see LICENSE file for details.
Contributions welcome! Please open an issue or PR on GitHub.
