dart_toast 0.3.0

  • Readme
  • Changelog
  • Installing
  • 60

dart_toast #

Support for simple toast messages in Dart web apps.

Usage #

First, be sure to include the CSS in your index.html file:

<link rel="stylesheet" href="packages/dart_toast/dart_toast.css">

A simple usage example:

import 'dart:html';

import 'package:dart_toast/dart_toast.dart';

void main() {
  document.getElementById('toast-btn').onClick.listen((_) {
    new Toast("Toast!", "A toasty toast.");
  });

  document.getElementById('success-btn').onClick.listen((_) {
    new Toast.success(title: "Success!", message: "Misson accomplished.");
  });

  document.getElementById('error-btn').onClick.listen((_) {
    new Toast.error(title: "Error!", message: "Misson failed.");
  });

  document.getElementById('warning-btn').onClick.listen((_) {
    new Toast.warning(title: "Warning!", message: "Misson in jeopardy.");
  });

  document.getElementById('info-btn').onClick.listen((_) {
    new Toast.info(title: "Info!", message: "Misson briefing complete.");
  });

  document.getElementById('top-left-btn').onClick.listen((_) {
    new Toast("Top Left",  "Look at me!", position: ToastPos.topLeft);
  });

  document.getElementById('top-right-btn').onClick.listen((_) {
    new Toast("Top Right",  "Look at me!", position: ToastPos.topRight);
  });

  document.getElementById('bottom-left-btn').onClick.listen((_) {
    new Toast("Bottom Left",  "Look at me!", position: ToastPos.bottomLeft);
  });

  document.getElementById('bottom-right-btn').onClick.listen((_) {
    new Toast("Bottom Right",  "Look at me!", position: ToastPos.bottomRight);
  });

  document.getElementById('top-center-btn').onClick.listen((_) {
    new Toast("Top Center",  "Look at me!", position: ToastPos.topCenter);
  });

  document.getElementById('bottom-center-btn').onClick.listen((_) {
    new Toast("Bottom Center",  "Look at me!", position: ToastPos.bottomCenter);
  });
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Changelog #

0.3.0 #

  • Breaking: Renamed ToastType to MessageType.

0.2.1 #

  • Updating for Dart 2 release.

0.2.0 #

  • Updating for Dart 2.0.0-dev.65.

0.1.1 #

  • Toasts will no longer be removed while mouse cursor hovers over them.

0.1.0 #

  • Initial release.

Use this package as a library

1. Depend on it

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


dependencies:
  dart_toast: ^0.3.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dart_toast/dart_toast.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
64
Health:
Code health derived from static analysis. [more]
94
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

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

  • Dart: 2.6.1
  • pana: 0.12.21

Platforms

Detected platforms: web

Primary library: package:dart_toast/dart_toast.dart with components: html.

Health suggestions

Fix lib/src/dart_toast_base.dart. (-6.31 points)

Analysis of lib/src/dart_toast_base.dart reported 13 hints, including:

line 14 col 33: Unnecessary new keyword.

line 23 col 31: Unnecessary new keyword.

line 31 col 21: Unnecessary new keyword.

line 35 col 28: Unnecessary new keyword.

line 44 col 30: Unnecessary new keyword.

Maintenance issues and suggestions

Prefer published dependencies. (-100 points)

The source code in a git repository is mutable and could disappear.

Use constrained dependencies. (-20 points)

The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: css_animation.

Package is getting outdated. (-26.85 points)

The package was last published 66 weeks ago.

The package description is too short. (-9 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.

Homepage URL is insecure. (-5 points)

Update the homepage field and use a secure (https) URL.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and dart_toast.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.69.0 <3.0.0
css_animation 0.2.1
Dev dependencies
build_runner ^0.9.2
build_web_compilers ^0.4.1