Refactor to remove flutter_hooks dependency#135
Conversation
Replaced `flutter_hooks` usage with standard `StatefulWidget` implementations in `FortuneBar`, `FortuneWheel`, and `PanAwareBuilder`. Introduced `FortuneAnimationManager` to handle shared animation logic. Removed `flutter_hooks` from `pubspec.yaml` and imports.
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Tests are failing |
I've refactored the widgets to improve testability and stability. |
- Updated `FortuneAnimationManager` to support property updates (duration, curve, selected stream) without recreating the controller. - Moved `animateFirst` logic to `addPostFrameCallback` in `FortuneBar` and `FortuneWheel` to ensure proper timing (matching `useEffect`). - Fixed callback handling to avoid unnecessary re-subscriptions.
|
lib/src/core/animations.dart:23:3: Error: Type 'StreamSubscription' not found.
|
I've fixed the compilation errors by adding the missing imports. |
- Added `import 'dart:async'` to `lib/src/core/core.dart`. - Added `import '../util.dart'` to `lib/src/wheel/wheel.dart`.
This PR removes the
flutter_hooksdependency from the package. It refactorsFortuneBar,FortuneWheel, andPanAwareBuilderto useStatefulWidgetand standard state management. A new helper classFortuneAnimationManagerwas created inlib/src/core/animations.dartto encapsulate the fortune animation logic previously handled byuseFortuneAnimationhook.Key changes:
lib/src/core/animations.dart: ReplaceduseFortuneAnimationwithFortuneAnimationManager.lib/src/core/pan_detector.dart: ConvertedPanAwareBuildertoStatefulWidget.lib/src/bar/fortune_bar.dart: ConvertedFortuneBartoStatefulWidget.lib/src/wheel/fortune_wheel.dart: ConvertedFortuneWheeltoStatefulWidget.flutter_hooksimports and dependency.PR created automatically by Jules for task 5516356372207270902 started by @kevlatus