Simple Mobile Overlay Loader for Flutter

Pub Version License

A lightweight, customizable overlay loader for Flutter. Displays a modal progress indicator with optional message text while preventing user interaction.


Features

  • Simple one-line API: showLoaderOverlay(context, message: '...')
  • Returns the inserted OverlayEntry for manual removal
  • Animated fade + scale entrance
  • Custom message string (defaults to Loading…)
  • Blocks interaction using ModalBarrier
  • No external dependencies
  • Fully documented public API (see source for inline dartdoc)

Installation

Add the package to your pubspec.yaml:

dependencies:
  simple_mobile_overlay_loader: ^0.0.4

Then run:

flutter pub get

Import it where needed:

import 'package:simple_mobile_overlay_loader/simple_mobile_overlay_loader.dart';

Quick Usage

final loader = showLoaderOverlay(
  context,
  message: 'Logging in…', // optional
);

// Do async work
await Future.delayed(const Duration(seconds: 3));

// Safely remove when finished
if (loader.mounted) loader.remove();

Full Example

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

class MyPage extends StatelessWidget {
  const MyPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: ElevatedButton(
        onPressed: () async {
          final loader = showLoaderOverlay(
            context,
            message: 'Logging in…',
          );
          // Simulate work
          await Future.delayed(const Duration(seconds: 3));
          if (loader.mounted) loader.remove();
        },
        child: const Text('Start Loader'),
      ),
    );
  }
}

Example


API

OverlayEntry showLoaderOverlay(BuildContext context, { String message = 'Loading…' })

Inserts an animated loader overlay into the root overlay.

Returns: The created OverlayEntry.

Remove: Call overlayEntry.remove() (check mounted first if asynchronous work may complete after removal elsewhere).


Changelog

See CHANGELOG.md.


License

MIT © 2025. See LICENSE.


Contributing

Pull requests welcome. Open an issue for bugs or feature requests.


You can also buy me a coffee:

Buy Me A Coffee

Libraries

simple_mobile_overlay_loader
A lightweight utility for displaying a modal loader overlay with customizable status text.