show_overlay 1.0.8

  • Readme
  • Changelog
  • Example
  • Installing
  • new68

flutter_show_overlay #

show_overlay plugin for Flutter. Supports iOS, Web, Android and MacOS.

image

Getting Started #

In your flutter project add the dependency:

dependencies:
  ...
 show_overlay: ^1.0.8

For help getting started with Flutter, view the online documentation.

Document #

See document in pub.dev

Usage #

import 'package:show_overlay/show_overlay.dart';
    showOverlay(
      context: context,
      builder: (_, __, ___) {
        return // some Widget;
      },
    );
  }

Example #

Example source code in the folder example

1.0.8 #

  • Remove settings for overflow
  • Optimized implementation

1.0.7 #

  • Supported settings for overflow
  • Optimized implementation

1.0.5 #

  • Fixed some bugs

1.0.3 #

  • Fixed the issue of rootOverlay

1.0.1 #

  • Fixed the issue of BackdropFilter effect overflow

1.0.0 #

  • I think it is stable

0.0.7 #

  • Add example snapshot.gif

0.0.6 #

  • Optimized implementation

0.0.5 #

  • Add some basic LICENSE, README... files.

0.0.4 - #

  • Unstable phase.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:show_overlay/show_overlay.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'showOverlay example',
      showPerformanceOverlay: true,
      home: Scaffold(body: Body()),
    );
  }
}

class OverlayBox extends StatelessWidget {
  final Widget child;
  OverlayBox({this.child});

  @override
  Widget build(Object context) {
    return Container(
      color: Colors.grey[200],
      child: Overlay(
        initialEntries: [
          OverlayEntry(
            builder: (_) => child,
          ),
        ],
      ),
    );
  }
}

class Body extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          Expanded(
            child: Test(
              title: "Global",
            ),
          ),
          Expanded(
            child: OverlayBox(
              child: Test(
                title: "Local",
              ),
            ),
          ),
        ],
      ),
    );
  }
}

class Test extends StatelessWidget {
  final String title;
  Test({this.title});

  showOverlayDefault(BuildContext context) {
    showOverlay(
      context: context,
      barrierDismissible: false,
      builder: (_, __, close) {
        return Center(
          child: RaisedButton(
            onPressed: close,
            child: Text('close'),
          ),
        );
      },
    );
  }

  showOverlayWithBarrier(BuildContext context) {
    showOverlay(
      barrierBlur: 6,
      context: context,
      barrierDismissible: true,
      barrierColor: Colors.black.withOpacity(0.2),
      builder: (_, __, close) {
        return Center(
          child: RaisedButton(
            onPressed: close,
            child: Text('close'),
          ),
        );
      },
    );
  }

  showOverlayWithAnimation(BuildContext context) {
    showOverlay(
      barrierBlur: 2,
      context: context,
      barrierDismissible: false,
      animationDuration: Duration(milliseconds: 200),
      builder: (_, animation, close) {
        return Center(
          child: ScaleTransition(
            scale: animation,
            child: RaisedButton(
              onPressed: close,
              child: Text('close'),
            ),
          ),
        );
      },
    );
  }

  showOverlayNotWithBarrier(BuildContext context) {
    showOverlay(
      barrier: false,
      context: context,
      builder: (_, __, close) {
        return Center(
          child: RaisedButton(
            onPressed: close,
            child: Text('close'),
          ),
        );
      },
    );
  }

  showOverlayWithUseRootOverlay(BuildContext context) {
    showOverlay(
      context: context,
      useRootOverlay: true,
      builder: (_, __, close) {
        return Center(
          child: RaisedButton(
            onPressed: close,
            child: Text('close'),
          ),
        );
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Text(title),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              RaisedButton(
                onPressed: () => showOverlayDefault(context),
                child: Text('Default'),
              ),
              RaisedButton(
                onPressed: () => showOverlayWithAnimation(context),
                child: Text('With Animation'),
              ),
            ],
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              RaisedButton(
                onPressed: () => showOverlayNotWithBarrier(context),
                child: Text('Not Barrier'),
              ),
              RaisedButton(
                onPressed: () => showOverlayWithBarrier(context),
                child: Text('With Barrier'),
              ),
            ],
          ),
          RaisedButton(
            onPressed: () => showOverlayWithUseRootOverlay(context),
            child: Text('With useRootOverlay'),
          )
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  show_overlay: ^1.0.8

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

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

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • show_overlay that is a package requiring null.

Maintenance suggestions

The package description is too short. (-14 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test