Skip to content

Support weighted items in FortuneWheel#138

Merged
kevlatus merged 3 commits into
mainfrom
weighted-items-5010871680406073538
Jan 10, 2026
Merged

Support weighted items in FortuneWheel#138
kevlatus merged 3 commits into
mainfrom
weighted-items-5010871680406073538

Conversation

@google-labs-jules
Copy link
Copy Markdown
Contributor

Implemented weighted items for FortuneWheel. Each item can now have a weight, and the slice size is proportional to the weight. Fixed haptic feedback and selection logic to work with non-uniform slices.


PR created automatically by Jules for task 5010871680406073538 started by @kevlatus

This change allows `FortuneItem`s to have a `weight` property, which determines the angular size of the slice in the `FortuneWheel`.
- Added `double weight` to `FortuneItem`.
- Updated `FortuneWheel` to calculate slice angles and rotation based on weights.
- Updated `_borderCross` to handle weighted sectors for haptic feedback and focus events.
@google-labs-jules
Copy link
Copy Markdown
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@kevlatus
Copy link
Copy Markdown
Owner

remove the pubspec.lock change.
Apply the same change to the FortuneBar.
Include unit and widget tests

@google-labs-jules
Copy link
Copy Markdown
Contributor Author

remove the pubspec.lock change.
Apply the same change to the FortuneBar.
Include unit and widget tests

I have removed the pubspec.lock change, implemented weighted item support for FortuneBar, and added unit/widget tests for both FortuneWheel and FortuneBar.

- Added `double weight` property to `FortuneItem`.
- Updated `FortuneWheel` to calculate slice angles based on item weights.
- Updated `FortuneBar` to calculate item widths based on item weights.
- Refactored `_InfiniteBar` to handle variable item widths.
- Added tests for weighted items.
- Reverted unintentional `pubspec.lock` changes.
Comment thread test/weighted_test.dart Outdated

void main() {
group('FortuneBar Weighted Items', () {
testWidgets('renders items with different weights', (tester) async {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weights are not really tested

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated test/weighted_test.dart to verify the actual widths (for FortuneBar) and angles (for FortuneWheel) of the rendered items, ensuring the weights are correctly applied.

- Added `double weight` property to `FortuneItem`.
- Updated `FortuneWheel` to calculate slice angles based on item weights.
- Updated `FortuneBar` to calculate item widths based on item weights.
- Refactored `_InfiniteBar` to handle variable item widths.
- Added comprehensive tests for weighted items verifying rendering sizes and angles.
- Reverted unintentional `pubspec.lock` changes.
@kevlatus kevlatus marked this pull request as ready for review January 10, 2026 11:52
@kevlatus kevlatus merged commit e8d849a into main Jan 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant