spinning_wheel 1.0.0
spinning_wheel: ^1.0.0 copied to clipboard
Customizable animated spinning wheel for Flutter: fortune wheel, prize wheel and lucky draw with weighted odds, swipe to spin and themed frames.
0.0.1 #
- initial draft of the fortune wheel.
0.0.2 #
- SetState issue of view fixed.
0.0.3 #
- Wheel responsiveness is fixed.
0.0.4 #
- Added
backgroundparameter toSpinnerWheelfor custom background widgets. - Added
shouldDrawBackgroundto toggle background visibility. - Added weighted probability support (
probabilityfield inWheelSegment). - Added performance optimizations (
RepaintBoundary) for smoother animations. - Made
coloroptional inWheelSegment(defaults to random color).
0.0.5 #
- Dual Image Support: Pass both local asset paths and Network URLs (e.g.,
https://...) toWheelSegment. - Improved
image_loaderlogic to automatically detect and fetch network images. - Documentation Update: Added comprehensive Dartdoc comments to improve pub.dev score.
0.0.6 #
- Advanced Label Styling: Introduced
WheelLabelStyleclass for professional label configuration. - Text Rotation: Added
anglesupport inWheelLabelStyleto allow manual rotation of segment labels. - Refactoring: Renamed
labelStyleandlabelDesignConfigto a unifiedWheelLabelStyleobject.
0.0.7 #
- Automatic Text Clipping: Added
overflowandmaxLinestoWheelLabelStylefor smart label containment. - Slice Padding: Upgraded
slicePaddingto useEdgeInsetsfor precise radial and horizontal control inside segments. - Layout Optimization: Text labels now automatically calculate available width to prevent slice overlapping.
1.0.0 #
Breaking changes
WheelSegment<T>andSpinnerWheel<T>are generic over the segment value. Lists typed asList<WheelSegment>now havedynamicvalues; useList<WheelSegment<int>>. See "Upgrading from 0.0.x" in the README.- Requires Flutter 3.27 / Dart 3.6 or newer.
startSpin()now completes when the wheel stops, with aWheelSpinResult, instead of right away.- The wheel's frame is now painted instead of an image, so it stays sharp at any size.
wheelColorsets the frame's rim color. Theassets/wheel.pngimage was removed (about 1 MB less in apps). - Segments without a
colorget a stable color based on their label and value instead of a random one. - The default
spinCurveis nowCurves.decelerate, and spins are limited to 40% of a slice per frame, so the wheel no longer appears to spin backwards at high speed. Wheels with many slices may make fewer turns thanminSpins; a longerspinDurationallows more.
New
SpinnerControlleris aChangeNotifierwithisSpinning,lastResult,isAttached,spinTo(index)andstop().spinDuration,spinCurve,minSpinsandmaxSpinsto tune spins.onSpinStartandonSegmentPasscallbacks.tapToSpinandswipeToSpin(drag and fling the wheel).indicatorPosition(top, right, bottom, left) andindicatorBounce.sliceSizing(slices sized by probability),sliceStyle(flat or gradient),sliceBorderColorandsliceBorderWidth.highlightWinnerandhighlightColor.- Per-segment
childwidget,imageProvider,textStyleandsemanticLabel. imagePlaceholder,imageErrorWidgetandonImageError. Images now appear one by one as they load.framewith four ready-made frames:WheelFrame.classic(),WheelFrame.royal(),WheelFrame.neon()andWheelFrame.wooden(), each with its own colors and options.WheelFrame.custom()and subclassingWheelFrameto paint your own frame, withWheelFrameGeometryto line it up with the slices.wheelInsetto set how wide the frame is. It defaults to what the frame needs.WheelLabelStyle.copyWithand value equality.- Screen reader support and right-to-left label text.
Fixes
- Segments without a
probabilitycould never win when others had one. - Changing
segmentsafter the first build had no effect. - Calling
startSpin()mid-spin made the wheel jump back; it is now ignored. startSpin()after the wheel was disposed threw an error.- An empty
segmentslist crashed. - A
CurvedAnimationwas leaked on every animation frame. - Labels with
clip,fadeorellipsisoverflow now stay inside their slice;fadeactually fades. - A one-segment wheel showed no label.
- The wheel crashed when given no size limits on either axis.
- Loaded images were never disposed, and 2x/3x asset variants weren't used.
- Asset paths starting with "http" were treated as URLs.