flutter_fortune_wheel 0.1.3
flutter_fortune_wheel: ^0.1.3 copied to clipboard

Visualize (random) selection processes with widgets like a spinning wheel of fortune or a fortune bar.

Coverage Status

Flutter Fortune Wheel #

Wheel of fortune widgets for Flutter, which allow you to visualize random selection processes. They are highly customizable and work across mobile, desktop and the web.

Quick Start #

First install the package via pub.dev. Then import and use the FortuneWidget:

import 'package:flutter/material.dart';
import 'package:flutter_fortune_wheel/flutter_fortune_wheel.dart';

FortuneWidget(
  selected: 0,
  items: [
    FortuneItem(child: Text('Han Solo')),
    FortuneItem(child: Text('Yoda')),
    FortuneItem(child: Text('Obi-Wan Kenobi')),
  ],
)

Examples #

The wheel of fortune is the most iconic visualization.

Unfortunately, its alternating slice colors are only suitable, when there is an even number of items to be displayed. Furthermore, it is not the best solution when vertical screen space is scarse. Therefore the FortuneWidget example above automatically switches between the fortune wheel and fortune bar depending on the number of items and available space.

You can still use a fortune wheel under those conditions by instantiating it directly:

import 'package:flutter/material.dart';
import 'package:flutter_fortune_wheel/flutter_fortune_wheel.dart';

FortuneWidget.wheel(
  selected: 0,
  items: [
    FortuneItem(child: Text('Han Solo')),
    FortuneItem(child: Text('Yoda')),
    FortuneItem(child: Text('Obi-Wan Kenobi')),
  ],
)

The fortune bar is an alternative visualization, which is smaller in the vertical direction, but is supposed to take the full screen width. See below for an example:

import 'package:flutter/material.dart';
import 'package:flutter_fortune_wheel/flutter_fortune_wheel.dart';

FortuneWidget.bar(
  selected: 0,
  items: [
    FortuneItem(child: Text('Han Solo')),
    FortuneItem(child: Text('Yoda')),
    FortuneItem(child: Text('Obi-Wan Kenobi')),
  ],
)

Contributions #

Contributions are much appreciated.

If you have any ideas for alternative visualizations, feel free to open a pull request or raise an issue. The same holds for any requests regarding existing widgets.

39
likes
100
pub points
84%
popularity

Publisher

kevlatus.de

Visualize (random) selection processes with widgets like a spinning wheel of fortune or a fortune bar.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_hooks, quiver

More

Packages that depend on flutter_fortune_wheel