overlay_support 1.0.1

overlay_support #

Pub Build Status codecov

provider support for overlay, easy to build toast and internal notification.

this library support platform Android、iOS 、Linux、macOS、Windows and Web

Interation #

If you want to see the ui effect of this library, just click here https://boyan01.github.io/overlay_support/#/

How To Use #

  1. add dependencies into you project pubspec.yaml file
  overlay_support: latest_version
  1. wrap your AppWidget with OverlaySupport
  return OverlaySupport(child: MaterialApp());
  1. show toast or simple notifications
//popup a tost
toast('Hello world!');

//show a notification at top of screen
    Text("this is a message from simple notification"),
    background: Colors.green);

more instructions check here : example/readme.md

License #

see License File

End #

if you have some suggestion or advice, please open an issue to let me known. This will greatly help the improvement of the usability of this project. Thanks.

[1.0.1] - 2019/7/26

  • swipe to dismiss #16
  • adjust default toast background #18

[1.0.0] - 2019/6/16

  • do not need pass context parameter to popup overlay

[0.3.0] - 2019/5/22

  • add key parameter for showOverlay

[0.2.0] - 2019/5/15

  • fix: call NotificationEntry#dismiss immediately when we showNotification cause an exception

[0.1.0] - 2019/3/5

  • expose showOverlay method to help build custom overlay
  • mark autoDismiss param as Deprecate, replace by duration param

[0.0.4] - 2019/3/2

  • bug fix

[0.0.3] - 2019/2/18

  • bug fix

[0.0.2] - 2019/2/17

  • remove line limit of toast

[0.0.1] - 2019/2/16

  • support notification
  • support toast


overlay_support_example #

example for overlay_support

Simple Usage #

popup a notification or toast:

showSimpleNotification(Text("this is a message from simple notification"),
                      background: Colors.green);

toast('this is a message from toast');

you can custom your notification widget to popup, for example:

showOverlayNotification((context) {
  return MessageNotification(
    message: 'i love you',
    onReplay: () {
      OverlaySupportEntry.of(context).dismiss(); //use OverlaySupportEntry to dismiss overlay
      toast(context, 'you checked this message');
class MessageNotification extends StatelessWidget {
  final VoidCallback onReplay;

  const MessageNotification({Key key, this.onReplay}) : super(key: key);

  Widget build(BuildContext context) {
    return Card(
      margin: const EdgeInsets.symmetric(horizontal: 4),
      child: SafeArea(
        child: ListTile(
          leading: SizedBox.fromSize(
              size: const Size(40, 40),
              child: ClipOval(child: Image.asset('assets/avatar.png'))),
          title: Text('Lily MacDonald'),
          subtitle: Text('Do you want to see a movie?'),
          trailing: IconButton(
              icon: Icon(Icons.reply),
              onPressed: () {
                ///TODO i'm not sure it should be use this widget' BuildContext to create a Dialog
                ///maybe i will give the answer in the future
                if (onReplay != null) onReplay();

for example, we need create a iOS Style Toast.

  showOverlay((context, t) {
    return Opacity(
      opacity: t,
      child: IosStyleToast(),
class IosStyleToast extends StatelessWidget {
  Widget build(BuildContext context) {
    return SafeArea(
      child: DefaultTextStyle(
        style: Theme.of(context).textTheme.body1.copyWith(color: Colors.white),
        child: Padding(
          padding: const EdgeInsets.all(16),
          child: Center(
            child: ClipRRect(
              borderRadius: BorderRadius.circular(10),
              child: Container(
                color: Colors.black87,
                padding: const EdgeInsets.symmetric(
                  vertical: 8,
                  horizontal: 16,
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                      color: Colors.white,

End #

if you have some suggestion or advice, please open an issue to let me known. This will greatly help the improvement of the usability of this project. Thanks.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  overlay_support: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:overlay_support/overlay_support.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Aug 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/src/notification/notification.dart.

Run flutter format to format lib/src/notification/notification.dart.

Format lib/src/notification/overlay_notification.dart.

Run flutter format to format lib/src/notification/overlay_notification.dart.

Format lib/src/overlay.dart.

Run flutter format to format lib/src/overlay.dart.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/overlay_animation.dart (Run flutter format to format lib/src/overlay_animation.dart.)
  • lib/src/overlay_entry.dart (Run flutter format to format lib/src/overlay_entry.dart.)
  • lib/src/theme.dart (Run flutter format to format lib/src/theme.dart.)
  • lib/src/toast/toast.dart (Run flutter format to format lib/src/toast/toast.dart.)


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
async ^2.1.0 2.3.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies