easy_alert 0.0.2

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

pub package

easy_alert

A package for flutter to use alert and toast within one line code.

Getting Started

Add

    easy_alert:

to your pubspec.yaml, and run flutter packages get in your project root directory.

Showcases

ROADMAP

  • [x] alert
  • [x] confirm
  • [x] toast
  • [ ] customize alert dialog
  • [ ] customize toast
  • [ ] support bottom sheet.
  • [ ] support input

Integrate with your flutter app

void main() => runApp(new AlertProvider(
      child: new YourApp(),
      config: new AlertConfig(
        ok: "OK text for `ok` button in AlertDialog", 
        cancel: "CANCEL text for `cancel` button in AlertDialog"),
    ));

alert

  Alert.alert(context, title: "Hello", content: "this is a alert")
      .then((_) => Alert.toast(context, "You just click ok"));

confirm

 Alert.confirm(context, title: "Hello", content: "this is a alert")
          .then((int ret) =>
              Alert.toast(context, ret == Alert.OK ? "ok" : "cancel"));

toast

Alert.toast(context,"Very long toast",position: ToastPosition.bottom, duration: ToastDuration.long);

[0.0.1]

* support basic usage: alert ,confirm, toast

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:easy_alert/easy_alert.dart';

void main() => runApp(new AlertProvider(
      child: new MyApp(),
      config: new AlertConfig(ok: "OK", cancel: "CANCEL"),
    ));

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Easy alert example',
      home: new MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("Easy alert example"),
      ),
      body: new Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          new RaisedButton(
            onPressed: () {
              Alert.alert(context, title: "Hello")
                  .then((_) => Alert.toast(context, "You just click ok"));
            },
            child: new Text("alert"),
          ),
          new RaisedButton(
            onPressed: () {
              Alert.alert(context, title: "Hello", content: "this is a alert")
                  .then((_) => Alert.toast(context, "You just click ok"));
            },
            child: new Text("alert with content"),
          ),
          new RaisedButton(
            onPressed: () {
              Alert.confirm(context, title: "Hello", content: "this is a alert")
                  .then((int ret) =>
                      Alert.toast(context, ret == Alert.OK ? "ok" : "cancel"));
            },
            child: new Text("confirm"),
          ),
          new RaisedButton(
            onPressed: () {
              Alert.toast(context, "center toast",
                  position: ToastPosition.center);
            },
            child: new Text("show center toast"),
          ),
          new RaisedButton(
            onPressed: () {
              Alert.toast(context, "top toast", position: ToastPosition.top);
            },
            child: new Text("show top toast"),
          ),
          new RaisedButton(
            onPressed: () {
              Alert.toast(context,
                  "bottom long toast bottom long toastbottom long toastbottom long toastbottom long toastbottom long toastbottom long toast",
                  position: ToastPosition.bottom, duration: ToastDuration.long);
            },
            child: new Text("show bottom long toast"),
          ),
        ],
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  easy_alert: ^0.0.2

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:easy_alert/easy_alert.dart';
  
Version Uploaded Documentation Archive
0.0.2 Sep 9, 2018 Go to the documentation of easy_alert 0.0.2 Download easy_alert 0.0.2 archive
0.0.1 Sep 9, 2018 Go to the documentation of easy_alert 0.0.1 Download easy_alert 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
79
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
87
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

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

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

line 148 col 8: The method '_next' isn't used.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Dependencies

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