This package will help you to manage the overlays in your projects. Show a dialog, notification, window, or a panel easily

Overview

Overlayment

Logo

likes popularity pub points Online Example

This package will help you to manage the overlays in your projects. Show a dialog, notification, window, or a panel easily. or use one of the helping widgets like AutoComplete, Expander(Dropdown).

To start working with overlayment you need to give to it the NavigationKey at the application start or you need to give it the context every time you want to create a new overlayment.

 @override
  Widget build(BuildContext context) {
    final key = GlobalKey<NavigatorState>();
    Overlayment.navigationKey = key;
    return MaterialApp(
      navigatorKey: key,
      ...
    );
  }

Note: if you are using qlevar_router you can use the key property of the router to set the NavigationKey.

final router = QRouterDelegate(routes);
Overlayment.navigationKey = router.key;

return MaterialApp.router(
  routeInformationParser: const QRouteInformationParser(),
  routerDelegate: router,
);

To show an overlay you can use Overlayment.show(OverlayType()) or OverlayType().show() . To dismiss an overlay you can use:

  • Overlayment.dismiss(OverlayType): Give the overlay object to dismiss,
  • Overlayment.dismissName(name): give the overlay name to dismiss.
  • Overlayment.dismissLast(). dismiss the last open overlay.
  • Overlayment.dismissAll(): dismiss all open overlay, if you set atSameTime to true all overlays will dismissed together, otherwise they will be dismissed in the same order they open.

All these methods can take a result parameter if you want the overlay to return some value.

Overlay Example Properties
OverDialog example properties
OverPanel example properties
OverNotification example properties
OverWindow example properties
OverAutoComplete example properties
OverExpander example properties

and there is Common properties between all overlays.

OverDialog

example

Overlayment.show(
    OverDialog(
        child: Text('Hello world'),
        decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(8),
        color: Colors.white,
        ),
    ),
);

Properties

  • backgroundSettings
  • height: The dialog height, if null, the dialog will be fit to the content.
  • offset: The offset from the dialog position With this offset, you can move the dialog position for example for up or down left or right.
  • width:The dialog width, if null, the dialog will be fit to the content.

OverPanel

example

Overlayment.show(
  OverPanel(
    child: Text('This is a panel'),
    alignment: Alignment.bottomCenter,
  )
)

Properties

  • alignment: The Position where the panel should displayed in the screen.
  • height: The panel height.
  • width: The panel width.
  • offset: The panel offset.
  • backgroundSettings

OverNotification

example

Overlayment.show(OverNotification(
   child: Text('This is a notification'),
   alignment: Alignment.topCenter,
   color: Colors.blue.shade200,
));

OverNotification.simple(
   title: 'User logged in',
).show();

OverNotification.simple(
   title: 'Simple notification',
   message: 'This is a simple notification',
   icon: const Icon(Icons.info, color: Colors.green)
).show();

Properties

  • alignment: The Position where the notification should displayed in the screen.
  • height: The notification height.
  • width: The notification width.
  • offset: The notification offset.

OverWindow

Example

Overlayment.show(OverWindow(
   position: Offset(50, 50),
   canMove: true,
   child: Text('This is a window'),
));

final result = await OverWindow.simple(message: 'Are you sure?').show<bool?>()

Properties

  • alignment: The Position where the window should displayed. If the [position] is provided, the [alignment] is ignored.
  • backgroundSettings
  • canMove: Can user drag the window to move it.
  • position: The position of the window

OverWindow.simple:

  • message: the message to show
  • messageStyle: the message text style.
  • canCancel: add third button that cancel the window (returns null)
  • yesMessage: the text of the first button, default yes
  • noMessage: the text of the second button, default no
  • cancelMessage: the text of the third button, default Cancel
  • body: extra widgets to show between the message and the buttons canMove: can the user drag the window to move it. default false
  • alignment: the window location on the screen, default Alignment.center

OverAutoComplete

The widget is used to suggest options to the user based on the input.

Example

print(value), inputDecoration: const InputDecoration(labelText: 'Enter a number up to 100'), ),">
OverAutoComplete<String>(
   loadSuggestions: (q) async => store.where((element) => element.contains(q)).take(5).toList(),
   suggestionsBuilder: (value) => Padding(
       padding: const EdgeInsets.all(8.0),
       child: Text(value),
   ),
   initialValue: "5",
   onSelect: (value) => print(value),
   inputDecoration: const InputDecoration(labelText: 'Enter a number up to 100'),
),

Properties

  • validator: Validate if the user can select the given value.
  • initialValue: The initial value of the text field.
  • inputDecoration: The TextField input decoration.
  • loadSuggestions: Load the suggestions for the given query.
  • loadingWidget: The widget to display when the suggestions are loading.
  • onSelect: A callback called when the user selects a suggestion.
  • querySelector: A callback to get the value to display in the text field.
  • suggestionsBuilder: A callback to build the suggestion widget.

OverExpander

Create a widget that can be expanded and collapsed as an overlay. This widget can be used for example to create a dropdown list.

Example

OverExpander<int>(
    child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Text(
            'Selected Index: $_index',
            style: const TextStyle(fontSize: 18, decoration: TextDecoration.underline),
            ),
        ),
    onSelect: (i) {
        if (i != null) {
            setState(() {
                _index = i;
            });
        }
    },
    expandChild: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Column(
            children: List.generate(
                10,
                (index) => Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: ElevatedButton(
                        onPressed: () {
                            Overlayment.dismissName<int>(_name, result: index);
                        },
                        child: Text(index.toString()),
                    ),
                ),
            ),
        ),
    ),
)

Properties

  • onSelect: an event handler that is called when the user selects an item.
  • alignment: The alignment of the overlay relative to the parent. default is the center.
  • globalAlignment:The overlay position relative to the screen. if this property is set the alignment property will be ignored.
  • child: The widget, which the overlay will be expanded from.
  • expandChild: The content of the overlay.
  • expand: set if the overlay should be displayed or not.
  • fitParentWidth:set this to true if you want the overlay to take the same width as the parent, otherwise it will take the width of the content.
  • isClickable: can user click on the child to show the overlay. if false then the expander should be expanded with expand set to true.
  • offset: The overlay offset relative to the child.

Common Properties.

Name

A unique name for the overlay. If you don't set a name, the overlay will be named with the class name. You can use this name to close the overlay later

OverlayActions

set custom actions to the overlay events.

  • onOpen: run an action right before an overlay is about to open-
  • onReady: run an action after the overlay is opened.
  • canClose:run an action when the overlay is about to close. return [False] to cancel the close action
  • onClose: run an action when the overlay is closed.you can here change the overlay result and return a new one.

Animation

The animation that will be used to show the overlay. You can use TODO

  • OverFadeAnimation
  • OverSlideAnimation
  • OverScaleAnimation and you can mix them

Decoration

The overlay container decoration

Color

The overlay background color. If the [decoration] is set, this property will be ignored.

Margin

the overlay margin

Duration

the time to keep the overlay open. When the time is over, the overlay will be closed automatically.If the value is null, the overlay will not be closed automatically.

Background Settings

You can use this class to set the background color and the background blur of the layer behind the overlay. if you set the dismissOnClick to true, the overlay will be dismissed when you on the background layer.

You might also like...

A most easily usable RESAS API wrapper in Dart. With this library, you can easily integrate your application with the RESAS API.

A most easily usable RESAS API wrapper library in Dart! 1. About 1.1. What Is RESAS? 1.2. Introduction 1.2.1. Install Library 1.2.2. Import It 1.2.3.

Apr 7, 2022

My collection of bricks created by me to help you build Flutter projects faster I think.

My collection of bricks created by me to help you build Flutter projects faster I think.

My collection of bricks created by me to help you build Flutter projects faster I think. 🧱 Bricks Brick Description Version presentation_layer A bric

Nov 15, 2022

My collection of bricks to help you build projects faster or nothing else will πŸ˜†

My collection of bricks to help you build projects faster or nothing else will πŸ˜†

My collection of bricks to help you build projects faster or nothing else will πŸ˜† Bricks 🧱 Brick Description Version annoying_analysis_options A bric

Aug 20, 2022

DigHub is a GitHub client to help you finding intresting projects

DigHub is a GitHub client to help you finding intresting projects

dighub DigHub is a GitHub client to help you finding intresting projects. It's based on the GitHub API's events interface, which gives you real-time a

Dec 30, 2022

Flutter Dropdown Alert help to notify to user when success, warning or error like push notification

Flutter Dropdown Alert help to notify to user when success, warning or error like push notification

flutter_dropdown_alert A dropdown alert package for flutter Dropdown alert will help to notify to user when you call api success, error or something l

Dec 17, 2022

A Flutter application which keeps track your water intake and remind you to drink water by sending notification

A Flutter application which keeps track your water intake and remind you to drink water by sending notification

Drinkable 🌊 Drinkable 🌊 Built with ❀︎ by Akash Debnath Drinkable is a Flutter App powered by Firebase to keep track your daily water intake and remi

Nov 29, 2022

Choose color theme template - A template will help you choose a color scheme for the application, show how widgets interact with it

Choose color theme template - A template will help you choose a color scheme for the application, show how widgets interact with it

choose_color_theme_template This template will help you choose a color scheme fo

Oct 24, 2022

Today we will show you how you can create your developer portfolio website and app using flutter.

Today we will show you how you can create your developer portfolio website and app using flutter.

Responsive and Animated Portfolio Website & App - Flutter UI Live Preview Watch it on YouTube Packages we are using: flutter_svg: link goole_fonts: li

Dec 30, 2022

An app made in Flutter to help people choose the colors they will use in their projects!

An app made in Flutter to help people choose the colors they will use in their projects!

Color Picker An app made in Flutter to help people choose the colors they will use in their projects! Features Pick a color from a picker wheel, palet

Nov 27, 2022
Comments
  • [Feature Request] Instead of overlapping the notifications, show the notifications like a list

    [Feature Request] Instead of overlapping the notifications, show the notifications like a list

    Hi @SchabanBo, can you tell me whether the package supports the feature where if we trigger two notifications at one single time can the notifications will appear in the list view fashion instead of overlapping the notifications on top of each other. Because with this what is happening 1st notification is not being visible as 2nd notifications is showing on top of the first one in a stack manner, so it would be great if the notifications shows in a listview manner like the below package. I was trying the Simple notification that is present in your online demo

    https://www.npmjs.com/package/react-toastify

    enhancement 
    opened by tejHackerDEV 2
  • How to handle OverlayActions?

    How to handle OverlayActions?

    Hi~ @SchabanBo

    I tried to set onClose's callback but got type trouble.

    actions: OverlayActions( onClose: () { // do some thing }, ),

    show below error: The argument type 'Future Function()' can't be assigned to the parameter type 'Future Function(dynamic)?'

    May you provide overlayActions use case sample ?

    opened by yingming25 1
  • How to set navigator key with qlevar_router

    How to set navigator key with qlevar_router

    Hi @SchabanBo :) When use qlevar_router need to change MaterialApp to MaterialApp.router() then no navigator propterty to set. How can i no need pass context anytime?

    opened by yingming25 1
Owner
Schaban Bochi
Schaban Bochi
A new flutter package project which contains lots of beautiful alert dialog that will help you lot to create beautiful awesome alert box very quickly and easily.

A new flutter package project which contains lots of beautiful alert dialog that will help you lot to create beautiful awesome alert box very quickly and easily.

Karan Soni 8 Jan 8, 2022
A most easily usable cookie management library in Dart. With SweetCookieJar, you can easily manage cookie on your application.

A most easily usable cookie management library in Dart! 1. About 1.1. Introduction 1.1.1. Install Library 1.1.2. Import It 1.1.3. Use SweetCookieJar 1

Kato Shinya 9 Oct 27, 2022
A most easily usable cache management library in Dart. With CacheStorage, you can easily manage cache on your application.

A most easily usable cache management library in Dart! 1. About 1.1. Introduction 1.1.1. Install Library 1.1.2. Import It 1.1.3. Use CacheStorage 1.2.

Kato Shinya 1 Dec 13, 2021
Show beautiful bottom sheet as confirmation dialog quickly and easily.

sweetsheet Show beautiful bottom sheet as confirmation dialog quickly and easily. nice warning success danger and since version 0.2.0 , it is fully cu

Ayao Corneille ALLOGBALO 80 Sep 27, 2022
A dialog queue for you to manage your dialogs to display on flutter platform

A dialog queue for you to manage your dialogs to display on flutter platform δΈ­ζ–‡ Features Support pop dialog orderly Support pop dialog by priority Sup

Raymond 4 Nov 1, 2022
This is a flutter app which uses the Bitrise Api(https://api-docs.bitrise.io/) to show the bitrise projects and builds and lets you download your artifacts.

Bitrise Artifact Downloader Introduction ??‍♂️ This is a flutter app which uses the Bitrise Api(https://api-docs.bitrise.io/) to show the bitrise proj

Jens Klingenberg 9 Apr 30, 2021
Raden Saleh 53 Jul 27, 2023
A flutter plugin to show Truecaller like overlay window, over all other apps along with callback events

A flutter plugin to show Truecaller like overlay window, over all other apps along with callback events. Android Go or Android 11 & above, this plugin shows notification bubble, in other android versions, it shows an overlay window.

Venkata Sai Vamsi Penupothu 85 Dec 29, 2022
AuthorizationHeader is an open-sourced Dart library. With AuthorizationHeader, you can easily manage authorization header on your application.

A most easily usable authorization header management library in Dart! 1. About 1.1. Supported 1.1.1. Authorization Header 1.1.2. Authorization Type 1.

Kato Shinya 3 Dec 24, 2021
Git+ is your ultimate GitLab mobile app that lets you interact with your projects like as if you were using desktop.

Git+ for GitLab Git+ is your ultimate GitLab mobile app that lets you interact with your projects like as if you were using desktop. Git+ lets you see

Marek Gvora 38 Jan 7, 2023