slot_machine 1.0.1

  • README.md
  • Example
  • Installing
  • Versions
  • 4

Slot machine

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

example/example.dart

import 'dart:html';

import 'package:slot_machine/slot_machine.dart';

void main() {
  var container = querySelector("#slot_container");
  var resultEl = querySelector("#slot_result");
  RangeInputElement probabilityEl = querySelector("#probability");
  var probabilitySpan = querySelector("#probability_span");
  var startButton = querySelector("#start_button");
  
  num probability = 0.75;
  probabilityEl.onChange.listen((_) {
    probability = probabilityEl.valueAsNumber / 100;
    probabilitySpan.text = "${probabilityEl.value}%";
  });
  
  startButton.onClick.listen((_) {
    container.children.clear();
    resultEl.children.clear();

    var slotMachine = new SlotMachineAnimation.fromProbability(probability);
    // slotMachine.allowCriticalSuccess = false;
    // slotMachine.allowCriticalFailure = false;
    container.append(slotMachine.canvasEl);
    resultEl.append(slotMachine.resultEl);
    slotMachine.roll()
    .then(print);
  });
}

Use this package as a library

1. Depend on it

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


dependencies:
  slot_machine: ^1.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]
8
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
4
Learn more about scoring.

This package version is not analyzed, because it is more than two years old. Check the latest stable version for its analysis.

Maintenance issues and suggestions

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.