overlay_support 1.0.0

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

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, then click here https://boyan01.github.io/overlay_support/#/

How To Use #

  1. add dependencies into you project pubspec.yaml file
dependencies:
  overlay_support: latest_version
  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(
    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.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

example/README.md

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);

  @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 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: ^1.0.0

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';
  
Version Uploaded Documentation Archive
1.0.0 Jun 16, 2019 Go to the documentation of overlay_support 1.0.0 Download overlay_support 1.0.0 archive
0.3.0 May 22, 2019 Go to the documentation of overlay_support 0.3.0 Download overlay_support 0.3.0 archive
0.2.0 May 15, 2019 Go to the documentation of overlay_support 0.2.0 Download overlay_support 0.2.0 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]
90
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95
Overall:
Weighted score of the above. [more]
94
Learn more about scoring.

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

  • Dart: 2.3.2
  • pana: 0.12.18
  • Flutter: 1.5.4-hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/overlay_support.dart.

Run flutter format to format lib/overlay_support.dart.

Format lib/src/overlay_animation.dart.

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

Maintenance issues and suggestions

Support latest dependencies. (-5 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
async ^2.1.0 2.2.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