Git Product home page Git Product logo

flutter_dialog_queue's Introduction

A dialog queue for you to manage your dialogs to display on flutter platform

中文

Features

  • Support pop dialog orderly
  • Support pop dialog by priority
  • Support deduplicate dialog in the queue
  • Support pause \ resume the pop action

  queue-effect.gif

Getting started

Installation

Add the following lines to pubspec.yaml on your app module. Then run flutter pub get.

dependencies:
  dialog_queue: ">=1.0.1"
  ...

Usage

Step 1 : Add DialogQueueRouteObserver in your MaterialApp

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorObservers: [DialogQueueRouteObserver()],
    );
  }
}

Step 2 : Replace "showDialog" with DialogQueue.instance.addDialog

Old usage

showModalBottomSheet<T>(
    context: context,
    backgroundColor: Colors.white,
    isScrollControlled: true,
    isDismissible: false,
    builder: (BuildContext context) {
      return SafeArea(child: Text('Hello DialogQueue'));
    },
  );

New usage

DialogQueue.instance.addDialog(DialogQueueElement(() {
    return showModalBottomSheet(
        context: context,
        backgroundColor: Colors.white,
        isScrollControlled: true,
        isDismissible: false,
        builder: (BuildContext context) {
            return SafeArea(child: Text('Hello DialogQueue'));
        }
    );
}, tag: tag, priority: priority, uniqueKey: uniqueKey));

Other usage

  1. You can pause \ resume the pop action of queue at any time
DialogQueue.instance.resume();
DialogQueue.instance.pause();
  1. If you want to break off the queue when route to PageB,and resume it after PageA popped, then you can use:
DialogQueue.instance.pushNameThenResume(navigatorState, PageB);

auto-resume-effect.gif

flutter_dialog_queue's People

Contributors

tdforlife avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.