overlay_support 0.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 87

overlay_support #

Pub Build Status codecov

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

A picture is worth a thousand words #

simple notification

simple toast

How To Use #

  1. add dependencies into you project pubspec.yaml file
dependencies:
  overlay_support: ^0.1.0
  1. import package into your dart file
import 'package:overlay_support/overlay_support.dart';
  1. use showSimpleNotification method to show a notification at top of screen
showSimpleNotification(context,
    Text("this is a message from simple notification"),
    background: Colors.green);

License #

see License File

[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

example/README.md

overlay_support_example #

exmaple for overlay_support

Simple Usage #

popup a notification or toast:

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

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

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

 NotificationEntry entry;
 entry = showOverlayNotification(context, (_) {
   return MessageNotification(
     onReplay: () {
       entry.dismiss();
       showDialog(
           context: context,
           builder: (context) {
             return SimpleDialog(
               title: Text('message'),
             );
           });
     },
   );
 }, duration: Duration(milliseconds: 4000));
class MessageNotification extends StatelessWidget {
  final VoidCallback onReplay;

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

  @override
  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 Theme(
      data: Theme.of(context),
      child: Opacity(
        opacity: t,
        child: IosStyleToast(),
      ),
    );
  });
class IosStyleToast extends StatelessWidget {
  @override
  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>[
                    Icon(
                      Icons.check,
                      color: Colors.white,
                    ),
                    Text('Succeed')
                  ],
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

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:


dependencies:
  overlay_support: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages 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';
  
Version Uploaded Documentation Archive
0.1.0 Mar 5, 2019 Go to the documentation of overlay_support 0.1.0 Download overlay_support 0.1.0 archive
0.0.4 Mar 2, 2019 Go to the documentation of overlay_support 0.0.4 Download overlay_support 0.0.4 archive
0.0.3 Feb 18, 2019 Go to the documentation of overlay_support 0.0.3 Download overlay_support 0.0.3 archive
0.0.2 Feb 16, 2019 Go to the documentation of overlay_support 0.0.2 Download overlay_support 0.0.2 archive
0.0.1 Feb 16, 2019 Go to the documentation of overlay_support 0.0.1 Download overlay_support 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
75
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
87
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.3.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

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