elegant_loading_overlay 0.0.2 copy "elegant_loading_overlay: ^0.0.2" to clipboard
elegant_loading_overlay: ^0.0.2 copied to clipboard

Beautiful, customizable loading overlay for Flutter with one-line API.

elegant_loading_overlay #

pub package License: MIT Flutter Dart

Beautiful, customizable loading overlay for Flutter with a one-line API. Features 11 built-in loaders, smooth animations, progress indicators, blur backgrounds, theme support, and full platform compatibility.

✨ Features #

  • πŸš€ One-line API β€” LoadingOverlay.show() / LoadingOverlay.hide()
  • 🎨 11 Built-in Loaders β€” Circular, Dots, Pulse, Ripple, Bars, Cube, Ring, Gradient Spinner, Minimal Spinner, Material Spinner, Cupertino Spinner
  • 🎬 Smooth Animations β€” Fade, Scale, Slide, Zoom, Rotation
  • 🌫️ Blur Background β€” Configurable blur sigma
  • πŸ“Š Progress Indicators β€” Determinate and indeterminate
  • πŸ’¬ Messages & Subtitles β€” Customizable text content
  • 🎯 Custom Builder β€” Full control with custom widgets
  • 🎭 Theme Support β€” LoadingOverlayTheme for consistent styling
  • πŸ”’ Stacking Protection β€” Only one overlay at a time
  • β™Ώ Accessibility β€” Full semantics support
  • 🌍 Cross-Platform β€” Android, iOS, Web, macOS, Windows, Linux
  • πŸŒ™ Dark Mode β€” Fully supported
  • πŸ“± Responsive β€” Mobile, Tablet, Desktop
  • ⚑ Performant β€” RepaintBoundary, ValueNotifier, const widgets
  • πŸ§ͺ Well Tested β€” Comprehensive widget and unit tests
  • πŸ“¦ Zero Dependencies β€” Flutter SDK only

πŸ“¦ Installation #

Add to your pubspec.yaml:

dependencies:
  elegant_loading_overlay: ^0.0.1

Then run:

flutter pub get

πŸš€ Quick Start #

import 'package:elegant_loading_overlay/elegant_loading_overlay.dart';

// Show
LoadingOverlay.show(context: context);

// Hide
await LoadingOverlay.hide();

πŸ“– Usage #

Basic Loading #

LoadingOverlay.show(context: context);

await doSomeWork();

await LoadingOverlay.hide();

With Message #

LoadingOverlay.show(
  context: context,
  message: 'Loading...',
);

With Message & Subtitle #

LoadingOverlay.show(
  context: context,
  message: 'Uploading file',
  subtitle: 'This may take a moment',
);

With Progress #

LoadingOverlay.show(
  context: context,
  message: 'Downloading...',
  progress: 0.45,
);

Dismissible #

LoadingOverlay.show(
  context: context,
  dismissible: true,
  onDismiss: () => print('Dismissed!'),
);

Check Status & Toggle #

if (LoadingOverlay.isShowing) {
  await LoadingOverlay.hide();
}

// Or toggle
await LoadingOverlay.toggle(context: context);

Custom Animation #

LoadingOverlay.show(
  context: context,
  animation: LoadingAnimationType.scale,
  animationDuration: const Duration(milliseconds: 400),
  animationCurve: Curves.easeOutBack,
);

Different Loaders #

// Dots loader
LoadingOverlay.show(
  context: context,
  loaderType: LoaderType.dots,
);

// Pulse loader
LoadingOverlay.show(
  context: context,
  loaderType: LoaderType.pulse,
);

// Ripple loader
LoadingOverlay.show(
  context: context,
  loaderType: LoaderType.ripple,
);

// ... and 8 more!

Custom Loader (Builder) #

LoadingOverlay.show(
  context: context,
  builder: (_) => const Column(
    mainAxisSize: MainAxisSize.min,
    children: [
      Icon(Icons.cloud_upload, size: 48, color: Colors.blue),
      SizedBox(height: 16),
      Text('Uploading...'),
    ],
  ),
);

Blur & Styling #

LoadingOverlay.show(
  context: context,
  enableBlur: true,
  blurSigma: 5.0,
  barrierColor: Colors.black54,
  backgroundColor: Colors.white,
  loaderColor: Colors.teal,
  borderRadius: BorderRadius.circular(20),
  elevation: 12,
);

Context Extensions #

// Show
context.showLoadingOverlay(message: 'Loading...');

// Hide
context.hideLoadingOverlay();

🎨 Theming #

Wrap your app with LoadingOverlayTheme for consistent styling:

LoadingOverlayTheme(
  data: LoadingOverlayThemeData(
    loaderColor: Colors.tealAccent,
    backgroundColor: Colors.grey.shade900,
    messageTextStyle: const TextStyle(
      color: Colors.white,
      fontSize: 16,
    ),
    blurSigma: 5.0,
    animationDuration: const Duration(milliseconds: 400),
    animationType: LoadingAnimationType.scale,
    loaderType: LoaderType.gradientSpinner,
  ),
  child: MaterialApp(
    home: MyHomePage(),
  ),
)

πŸ”§ Scoped Overlays #

Use LoadingOverlayScope for independent overlay control in different parts of your app:

LoadingOverlayScope(
  theme: const LoadingOverlayThemeData(
    loaderColor: Colors.purple,
  ),
  child: MyPage(),
)

// In MyPage:
final scope = LoadingOverlayScope.of(context);
scope.show();
await scope.hide();

🎬 Available Animations #

Animation Description
fade Smooth fade-in/fade-out (default)
scale Grows from center with bounce
slide Slides up from bottom
zoom Scale + fade combination
rotation Spins into view
none Instant, no animation

🎑 Built-in Loaders #

Loader Description
circular Rotating arc spinner (default)
dots Bouncing wave dots
pulse Pulsing circle
ripple Expanding ripple rings
bars Equalizer-style bars
cube Rotating 3D cube
ring Spinning ring with gap
gradientSpinner Gradient arc spinner
minimalSpinner Thin line spinner
materialSpinner Material CircularProgressIndicator
cupertinoSpinner iOS CupertinoActivityIndicator

πŸ“ API Reference #

LoadingOverlay (Static API) #

Method Description
show({required context, ...}) Show the overlay
hide() Hide the overlay
toggle({context, ...}) Toggle visibility
isShowing Check if overlay is visible
of(context) Get theme data from context
controller Access global controller

LoadingOverlayConfig #

All configuration options for show():

Parameter Type Default
message String? null
subtitle String? null
progress double? null
dismissible bool false
animationType LoadingAnimationType fade
animationDuration Duration 300ms
animationCurve Curve easeInOut
barrierColor Color Colors.black54
backgroundColor Color Colors.white
loaderColor Color Colors.blue
blurSigma double 3.0
enableBlur bool true
borderRadius BorderRadius 16.0
padding EdgeInsets 32.0
spacing double 16.0
loaderSize double 48.0
elevation double 8.0
loaderType LoaderType circular
builder WidgetBuilder? null
onDismiss VoidCallback? null

🌍 Platform Support #

Platform Supported
Android βœ…
iOS βœ…
Web βœ…
macOS βœ…
Windows βœ…
Linux βœ…

⚑ Performance Notes #

  • Uses RepaintBoundary to isolate overlay repaints
  • ValueNotifier-based controller avoids stream overhead
  • const constructors used throughout
  • CustomPainter-based loaders for efficient rendering
  • Stacking protection prevents duplicate overlay creation

❓ FAQ #

Q: Can I show multiple overlays at once? A: The global LoadingOverlay API enforces single-overlay mode. Use LoadingOverlayScope for independent overlays in different subtrees.

Q: What happens if I call hide() without calling show()? A: Nothing. The method safely returns without error.

Q: What happens if I call show() twice? A: The existing overlay is updated with the new configuration β€” no duplicate overlay is created.

Q: Does it work with Navigator.push? A: Yes. The overlay is inserted into the root Overlay and appears above all routes.

Q: Does it support keyboard avoidance? A: Yes. The overlay content is properly positioned to avoid keyboard overlap.

πŸ—ΊοΈ Roadmap #

  • ❌ Shimmer effect loader
  • ❌ Lottie animation support
  • ❌ Progress stream support
  • ❌ Global configuration
  • ❌ Timeout with auto-dismiss
  • ❌ Success/Error state transitions
  • ❌ Haptic feedback option
  • ❌ Sound effect option

🀝 Contributing #

Contributions are welcome! Please read our Contributing Guide and Code of Conduct first.

πŸ“„ License #

This project is licensed under the MIT License β€” see the LICENSE file for details.

0
likes
160
points
39
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Beautiful, customizable loading overlay for Flutter with one-line API.

Repository (GitHub)
View/report issues
Contributing

Topics

#loading #overlay #spinner #progress #ui

License

MIT (license)

Dependencies

flutter

More

Packages that depend on elegant_loading_overlay