A flutter library provide a simple roulette widget which usually used for lottery

Overview

This is a library provide a simple roulette widget which usually used for lottery.

Features

  • Quickly build roulettes

  • Build roulettes with different parts depends on the weight

  • Easily control the roll animation and settle position

  • There are two types of roulette provided by this package:

    • Uniform roulette without text: Uniform with no text

    • Weight roulette with text: Weight based with text

Getting started

Usage

Build a Roulette widget

First, you need to create a RouletteController instance.

RouletteController(
  group: RouletteGroup([
    RouletteUnit.noText(color: Colors.red),
    RouletteUnit.noText(color: Colors.green),
    // ...other units
  ]),
  vsync: this // provide a TickerProvider here
);

Once you have a controller, you could add a Roulette widget into your widget tree:

@override
Widget build(BuildContext context) {
  return Roulette(
    controller: controller, // provide your controller here
    style: RouletteStyle(
      // config the roulette's appearance here
    ),
  );
}

Run the Roulette

Use roll method to run the roulette where you need to.

ElevatedButton(
  onPressed: () => controller.rollTo(2), // provide the index you want to settle
  child: const Text('Roll!'),
);

You could await the rollTo method's finish and then make some other actions.

The rollTo method provides many options for you to control the rolling behavior. Please check the document for more information.

For detailed usage sample, please check the example.

You might also like...

This project aims to provide a simple and customizable Review Page interaction made with Flutter.

This project aims to provide a simple and customizable Review Page interaction made with Flutter.

Review Page Interaction This project aims to provide a simple and customizable Review Page interaction made with Flutter. Check it out on Béhance (htt

Mar 29, 2022

flutter_thrio makes it easy and fast to add flutter to existing mobile applications, and provide a simple and consistent navigator APIs.

flutter_thrio makes it easy and fast to add flutter to existing mobile applications, and provide a simple and consistent navigator APIs.

中文文档 英文文档 问题集 原仓库不再维护,代码已经很老了 最近版本更新会很快,主要是增加新特性,涉及到混合栈的稳定性的问题应该不多,可放心升级,发现问题加 QQ 群号码:1014085473,我会尽快解决。 不打算好好看看源码的使用者可以放弃这个库了,因为很多设定是比较死的,而我本人不打算花时间写

Dec 29, 2022

flutter_thrio makes it easy and fast to add flutter to existing mobile applications, and provide a simple and consistent navigator APIs.

flutter_thrio makes it easy and fast to add flutter to existing mobile applications, and provide a simple and consistent navigator APIs.

本仓库不再维护,可移步新仓库 https://github.com/flutter-thrio/flutter_thrio 中文文档 问题集 QQ 群号码:1014085473 The Navigator for iOS, Android, Flutter. Version 0.2.2 requir

Dec 5, 2022

This is tool to create 3D Models which can be used in Flutter Applications. Tool is developed completely using Flutter.

three_d_model_tool A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you start

Nov 8, 2022

A new Flutter package customtoggleswitch is used to toggle a setting between on/off which is true/false respectively Created by suryadevsingh.

A new Flutter package customtoggleswitch is used to toggle a setting between on/off which is true/false respectively Created by suryadevsingh.

CustomToggleSwitch A new Flutter package customtoggleswitch is used to toggle a setting between on/off which is true/false respectively Created by sur

Jun 9, 2020

This repo contains a collection of permission related Flutter plugins which can be used to request permissions to access device resources in a cross-platform way.

Flutter Permission Plugins Deprecation Notice This repository has been replaced by the Flutter permission_handler plugin and will not longer be mainta

Dec 13, 2021

Flutter Cupertino text box which can be used to select a date with CupertinoDatePicker

Flutter Cupertino text box which can be used to select a date with CupertinoDatePicker

Flutter Cupertino Date Text Box A text box with an attached CupertinoDatePicker which opens when the text box is tapped. With this library the followi

Feb 13, 2022

Home app - A dynamic flutter app which can be used to generate alerts, set alarms and send sms or call someone

Home app - A dynamic flutter app which can be used to generate alerts, set alarms and send sms or call someone

first_app A dynamic flutter app which can be used to generate alerts, set alarms

Apr 9, 2022
Comments
  • [fix] draw full-width chars problem

    [fix] draw full-width chars problem

    I found the following problem. スクリーンショット 2022-05-30 23 23 52

    Half-width characters (such as "123") are painted correctly, but full-width ones(such as "123", "あいう") are painted incorrectly(not centering).

    I have solved this problem with this diff. Like this: スクリーンショット 2022-05-30 23 23 17

    If you need it, please refer to it.

    opened by SeeLog 4
  • When use method rollTo reset roulette

    When use method rollTo reset roulette

    Hello, I am using this package and I notice that when using the "rollTo" method the spinner resets and spins instead of continuing where it was going.

    Any idea how to make the roulette continue where it was and not see that reset screenshot?

    I think that the problem maybe is in _controller.forward(from: 0) instead of current index. Future<void> rollTo( int targetIndex, { Duration duration = defaultDuration, int minRotateCircles = defaultMinRotateCircles, bool clockwise = true, Curve? curve = Curves.fastOutSlowIn, double offset = 0, }) async { final targetRotate = calculateEndRotate( group, targetIndex, clockwise, minRotateCircles, offset: offset, ); _controller.duration = duration; _animation = makeAnimation(_controller, targetRotate, curve); notifyListeners(); **await _controller.forward(from: 0);**}``

    Thank very much

    opened by Anullos 3
  • Separate tests to multiple files to run on different os

    Separate tests to multiple files to run on different os

    Golden tests must run on the os which generates the golden files. The golden files was generated on windows 11 which is not supported by Github CI. So I re-generated this files on macOS and updated the ci configuration.

    opened by f-qiaolei 0
  • Asking for additional feature development: combine gesturedetector in roulette_paint.dart file

    Asking for additional feature development: combine gesturedetector in roulette_paint.dart file

    Hello developers, thanks for your roulette package.

    Looking for some way to include either text field or gesture detect widget(or showdialog) in each section of the roulette when clicked.

    Since I am very new to flutter and dart, have an idea that some how need to manipulate _drawSections function in roulette_paint.dart file.

    I spent a week of research in create a widget in function, but got no feasible solution.

    Asking for your help sincerely.

    Hope this open project(package) still in progress :)

    opened by hogyun3709 3
Releases(0.1.3)
  • 0.1.3(Oct 21, 2022)

    What's Changed

    • implement continuous rotate for rollTo method. by @do9core in https://github.com/do9core/roulette/pull/15

    Full Changelog: https://github.com/do9core/roulette/compare/0.1.2...0.1.3

    Source code(tar.gz)
    Source code(zip)
  • 0.1.2(Jun 25, 2022)

    What's Changed

    • Flutter SDK version update by @do9core in https://github.com/do9core/roulette/pull/12
    • Fix API document & Update README, Changelog and the example by @do9core in https://github.com/do9core/roulette/pull/13

    Full Changelog: https://github.com/do9core/roulette/compare/0.1.1...0.1.2

    Source code(tar.gz)
    Source code(zip)
  • 0.1.1(May 31, 2022)

    What's Changed

    • Introduce fvm support by @do9core in https://github.com/do9core/roulette/pull/8
    • [fix] draw full-width chars problem by @SeeLog in https://github.com/do9core/roulette/pull/10

    New Contributors

    • @SeeLog made their first contribution in https://github.com/do9core/roulette/pull/10

    Full Changelog: https://github.com/do9core/roulette/compare/0.1.0...0.1.1

    Source code(tar.gz)
    Source code(zip)
  • 0.1.0+1(Jan 15, 2022)

  • 0.1.0(Jan 11, 2022)

    First release on Github 🎉 Please check the change log for more information.

    What's Changed

    • Separate tests to multiple files to run on different os by @f-qiaolei in https://github.com/do9core/roulette/pull/4
    • Add CI check and test action by @do9core in https://github.com/do9core/roulette/pull/2
    • Remove the unused constructor parameter on RouletteController by @do9core in https://github.com/do9core/roulette/pull/1
    • Create publish ci task by @do9core in https://github.com/do9core/roulette/pull/6
    • Update publish.yml by @do9core in https://github.com/do9core/roulette/pull/7

    Full Changelog: https://github.com/do9core/roulette/commits/0.1.0

    Source code(tar.gz)
    Source code(zip)
Owner
Android Developer.
null
Beautiful Lottery App created in Flutter using Simple coding + State_full Widgets.

lottery_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

null 2 Sep 7, 2022
MindInventory 15 Sep 5, 2022
A Flutter sensor plugin which provide easy access to the Pitch and Roll on Android and iOS devices.

Flutter Aeyrium Sensor Plugin Aeyrium Sensor Plugin A Flutter sensor plugin which provide easy access to the Pitch and Roll on Android and iOS devices

Aeyrium 58 Nov 3, 2022
Scouter is a package which was made following the goal to provide a NestJS-like experience to Dart Developers that want to develop Rest APIS

Scouter is a package which was made following the goal to provide a NestJS-like experience to Dart Developers that want to develop Rest APIS Features

Vinicius Amélio 3 Sep 12, 2022
A Stable GeoFence Library - A flutter project to provide Geo Fence functionality in Android and IOS

A flutter project to provide Geo Fence functionality in Android and IOS Getting Started Android In your AndroidManifest.xml

TARIQUE KHAN 8 Nov 15, 2022
package library for extended_image, extended_text and extended_text_field,provide common base class.

extended_image_library package library for extended_image extended_image A powerful official extension library of image, which support placeholder(loa

FlutterCandies 124 Dec 31, 2022
Flutter Slides utilizes Flutter Desktop Embedding to provide a simple slide presentation app

Flutter Slides Flutter Slides utilizes Flutter Desktop Embedding to provide a simple slide presentation app. Presentations are data driven from files

Tim Sneath 12 Oct 31, 2022