slot_machine 5.0.1

  • README.md
  • Example
  • Installing
  • Versions
  • 69

Slot machine

Build Status

A simple, self-contained class that allows user to put a simple slot machine to the DOM.

See the demo.

example/example.dart

import 'dart:html';

import 'package:slot_machine/slot_machine.dart';

void main() {
  final container = querySelector("#slot_container");
  final rerollContainer = querySelector("#reroll_container");
  final resultEl = querySelector("#slot_result");
  final RangeInputElement probabilityEl = querySelector("#probability");
  final probabilitySpan = querySelector("#probability_span");
  final randomButton = querySelector("#random_button");

  // Allow setting up probability.
  num probability = 0.75;
  probabilityEl.onChange.listen((_) {
    probability = probabilityEl.valueAsNumber / 100;
    probabilitySpan.text = "${probabilityEl.value}%";
  });

  // Handle click of buttons.
  void handle(_) {
    container.children.clear();
    rerollContainer.children.clear();
    resultEl.children.clear();

    final slotMachine = new SlotMachine(probability,
        rerollable: true, rerollEffectDescription: "use coin");
    container.append(slotMachine.canvasEl);
    rerollContainer.append(slotMachine.rerollEl);
    resultEl.append(slotMachine.resultEl);
    slotMachine.play().then(print);
  }

  randomButton.onClick.listen(handle);
}

Use this package as a library

1. Depend on it

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


dependencies:
  slot_machine: ^5.0.1

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:slot_machine/slot_machine.dart';
  
Version Uploaded Documentation Archive
5.0.1 Jul 23, 2018 Go to the documentation of slot_machine 5.0.1 Download slot_machine 5.0.1 archive
5.0.0 Sep 24, 2017 Go to the documentation of slot_machine 5.0.0 Download slot_machine 5.0.0 archive
3.1.0 Jan 16, 2017 Go to the documentation of slot_machine 3.1.0 Download slot_machine 3.1.0 archive
3.0.1 Jan 10, 2017 Go to the documentation of slot_machine 3.0.1 Download slot_machine 3.0.1 archive
2.1.2 Jan 8, 2017 Go to the documentation of slot_machine 2.1.2 Download slot_machine 2.1.2 archive
2.1.1 Jan 8, 2017 Go to the documentation of slot_machine 2.1.1 Download slot_machine 2.1.1 archive
2.1.0 Jan 6, 2017 Go to the documentation of slot_machine 2.1.0 Download slot_machine 2.1.0 archive
2.0.1 Jan 5, 2017 Go to the documentation of slot_machine 2.0.1 Download slot_machine 2.0.1 archive
2.0.0 Jan 4, 2017 Go to the documentation of slot_machine 2.0.0 Download slot_machine 2.0.0 archive
1.0.1 Oct 1, 2014 Go to the documentation of slot_machine 1.0.1 Download slot_machine 1.0.1 archive

All 11 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
46
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
69
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: web

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

Health suggestions

Format lib/slot_machine.dart.

Run dartfmt to format lib/slot_machine.dart.

Maintenance issues and suggestions

Maintain CHANGELOG.md. (-20 points)

Changelog entries help clients to follow the progress in your code.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.24.0 <3.0.0
Dev dependencies
build_runner >=0.8.10 <0.10.0
build_web_compilers >=0.3.6 <0.5.0
test >=0.12.19 <2.0.0