easy_alert 0.0.8

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] ios style alert
  • [x] confirm
  • [x] ios style confirm
  • [x] toast
  • [ ] customize alert dialog
  • [ ] customize toast
  • [ ] support bottom sheet.
  • [x] support input
  • [x] support pick and select

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

pick #

try {
  int index = await Alert.pick(context,
      values: widget.values, index: widget.index);
    ...have selected
} catch (e) {
    ... cancel select
}


try {
    String ret = await Alert.select(context,
        options: [
          Option('A', 'a'),
          Option('B', 'b'),
          Option('C', 'c'),
        ],
        value: 'a');
Alert.toast(context, "You just pick $ret");
} catch (e) {
Alert.toast(context, "Canceled",
    position: ToastPosition.center);
}

[0.0.8]

  • do not change state when show toast.

[0.0.7]

  • adjust layout of toast
  • support input

[0.0.6]

  • add Options.getIndex and Options.getLabel

[0.0.5]

  • add Alert.select

[0.0.4]

  • 修复一个bug

[0.0.3]

  • 使用CupertinoAlertDialog
  • 提供pick方法,选择一系列字符串值
  • 提供EasyPicker组件,点击后选择一系列值

[0.0.1]

* support basic usage: alert ,confirm, toast

example/README.md

example #

A new Flutter project.

Getting Started #

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

Use this package as a library

1. Depend on it

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


dependencies:
  easy_alert: ^0.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:easy_alert/easy_alert.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
86
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]
91
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health suggestions

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

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

line 99 col 9: The class 'Future' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

Maintenance suggestions

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

While nothing is inherently wrong with versions of 0.0.*, it might mean 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 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