Skip to content

Latest commit

 

History

History
102 lines (85 loc) · 2.94 KB

README.md

File metadata and controls

102 lines (85 loc) · 2.94 KB

async_overlay

AsyncOverlay is a simple package, inspired by the future_progress_dialog package for displaying custom overlay UIs during asynchronous Future operations. It empowers developers to define their own unique loading overlays, offering a flexible alternative to default UI options.

Supported Dart Version

Dart SDK version >=3.6.0

Installation

Add async_overlay to pubspec:

dependencies:
  async_overlay: # latest version 

Usage

Import the package

import 'package:async_overlay/async_overlay.dart';

Call showDialog method with AsyncOverlay to show overlay loading UI

  • without message
await showDialog(
      context: context,
      builder: (context) => AsyncOverlay(asyncFutureTask()),
    );

  • with message
await showDialog(
      context: context,
      builder: (context) => AsyncOverlay(
        asyncFutureTask(),
        message: Text('Loading'),
      ),
    );

  • with custom loading widget
await showDialog(
      context: context,
      builder: (context) => AsyncOverlay(
        asyncFutureTask(),
        message: Text('Loading'),
        loadingWidget: const CustomLoader(),
      ),
    );

  • with custom overlay UI
await showDialog(
      context: context,
      builder: (context) => AsyncOverlay(
        asyncFutureTask(),
        customOverlayUI: Container(
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.all(Radius.circular(16)),
          ),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Lottie.network(
                'https://lottie.host/add90c20-d592-4c79-90b1-35d4cdff3035/SXrl7L2Y8G.json',
                height: 200,
                width: 230,
                renderCache: RenderCache.raster,
              ),
              Lottie.network(
                'https://lottie.host/a3f86098-dd8c-4f30-9aa4-e4795eda9243/9b4YUI1crz.json',
                height: 112,
                width: 127,
                renderCache: RenderCache.raster,
              ),
            ],
          ),
        ),
      ),
    );

Visitors Count

Loading