overlay_support 1.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 97

overlay_support #

Pub CI 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
dependencies:
  overlay_support: latest_version
  1. wrap your AppWidget with OverlaySupport
  return OverlaySupport(child: MaterialApp());
  1. show toast or simple notifications
//popup a toast
toast('Hello world!');

//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.4] - 2020/5/26 #

[1.0.3] - 2020/3/13 #

  • expose toastTheme. by juvs

[1.0.2] - 2019/10/23 #

  • fix Toast hidden behind ime #20

[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

example/lib/main.dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:overlay_support/overlay_support.dart';
import 'package:overlay_support_example/pages/page_main.dart';
import 'package:overlay_support_example/pages/page_with_ime.dart';

void main() {
  debugDefaultTargetPlatformOverride = TargetPlatform.android;

  kNotificationSlideDuration = const Duration(milliseconds: 500);
  kNotificationDuration = const Duration(milliseconds: 1500);
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return OverlaySupport(
      child: MaterialApp(
        title: 'Overlay Support Example',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: _ExampleDrawer(),
      ),
    );
  }
}

class _ExampleDrawer extends StatefulWidget {
  @override
  _ExampleDrawerState createState() => _ExampleDrawerState();
}

class _ExampleDrawerState extends State<_ExampleDrawer> {
  final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      key: _scaffoldKey,
      drawer: Drawer(
        child: _NavigationTiles(),
      ),
      appBar: AppBar(
        title: Text("Overlay Support Example"),
        leading: IconButton(
            icon: AnimatedIcon(
                icon: AnimatedIcons.menu_arrow,
                color: Theme.of(context).primaryIconTheme.color,
                progress: ProxyAnimation(kAlwaysDismissedAnimation)),
            onPressed: () {
              _scaffoldKey.currentState.openDrawer();
            }),
      ),
      body: HomePage(),
    );
  }
}

class _NavigationTiles extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ListTileTheme(
      style: ListTileStyle.drawer,
      child: MediaQuery.removePadding(
        removeTop: true,
        context: context,
        child: ListView(
          children: <Widget>[
            DrawerHeader(
              child: Container(color: Theme.of(context).accentColor),
              padding: EdgeInsets.all(0),
            ),
            ListTile(
              title: Text("Main"),
              selected: true,
              onTap: () {
                Navigator.of(context).pop();
              },
            ),
            Divider(height: 0, indent: 16),
            ListTile(
              title: Text("Star On GitHub"),
              onTap: () {
                Navigator.of(context).push(
                    MaterialPageRoute(builder: (context) => PageWithIme()));
              },
            )
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  overlay_support: ^1.0.4

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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
95
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
97
Learn more about scoring.

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

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Health suggestions

Fix lib/src/notification/overlay_notification.dart. (-1 points)

Analysis of lib/src/notification/overlay_notification.dart reported 2 hints:

line 80 col 76: 'title' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline6. This feature was deprecated after v1.13.8..

line 81 col 76: 'title' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline6. This feature was deprecated after v1.13.8..

Fix lib/src/overlay.dart. (-0.50 points)

Analysis of lib/src/overlay.dart reported 1 hint:

line 156 col 19: 'ancestorWidgetOfExactType' is deprecated and shouldn't be used. Use findAncestorWidgetOfExactType instead. This feature was deprecated after v1.12.1..

Fix lib/src/overlay_entry.dart. (-0.50 points)

Analysis of lib/src/overlay_entry.dart reported 1 hint:

line 17 col 37: 'ancestorWidgetOfExactType' is deprecated and shouldn't be used. Use findAncestorWidgetOfExactType instead. This feature was deprecated after v1.12.1..

Fix additional 4 files with analysis or formatting issues. (-0.50 points)

Additional issues in the following files:

  • lib/src/theme.dart (1 hint)
  • lib/src/notification/notification.dart (Run flutter format to format lib/src/notification/notification.dart.)
  • lib/src/overlay_animation.dart (Run flutter format to format lib/src/overlay_animation.dart.)
  • lib/src/toast/toast.dart (Run flutter format to format lib/src/toast/toast.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
async ^2.1.0 2.4.1
flutter 0.0.0
Transitive dependencies
collection 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test