Skip to content

Conversation

@JesperBellenbaum
Copy link
Contributor

@JesperBellenbaum JesperBellenbaum commented Dec 25, 2025

Description:

This PR implements support for Heroine animations during interactive route transitions (e.g., user-driven back swipes).

Motion Handoff Strategy
A challenge was defining the hero's motion after a user releases a gesture. We use a clamped motion with the current progress + let go velocity.

  • HeroineVelocityTracker: Added to sample position data during the gesture. The calculated release velocity is passed to the handoff builder to preserve momentum when the spring simulation takes over.

API Changes

  • animateOnUserGestures: A flag on the Heroine widget to enable participation in interactive transitions. Defaults to false to match existing behavior.

@JesperBellenbaum JesperBellenbaum changed the title Feat route gesture tracking feat: route gesture tracking Dec 25, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 25, 2025

Coverage Report

This is an automatic coverage report for 2fcd095, proudly generated by Dart Coverage Assistant 🎯🧪.

Monorepo coverage

This repository contains 6 Dart projects. This is is the total coverage across all of them:

70.86929716399507% - pass ⬇️ -1.74%

heroine

The queen of hero transitions. Flutter's most addictive interactions.

57.12250712250713% - pass ⬇️ -6.77%

Coverage Details for heroine
File Line Percentage Line Count
lib/src
drag_dismissable.dart 0.00 87
heroine_route_mixin.dart 0.00 24
heroine_velocity.dart 42.86 7
heroines.dart 71.74 138
heroine_velocity_tracker.dart 0.00 47
heroine_widget.dart 97.78 90
heroine_location.dart 85.71 21
flight_controller.dart 62.26 159
flight_spec.dart 78.79 33
shuttle_builders.dart 70.83 96

motor

A unified motion system for Flutter - physics-based springs and duration-based curves under one API.

75.33898305084745% - pass ➡️ 0.00%

Coverage Details for motor
File Line Percentage Line Count
lib/src
motion.dart 56.28 183
motion_sequence.dart 75.16 161
motion_converter.dart 74.36 78
motion_curve.dart 75.00 8
phase_transition.dart 52.17 23
lib/src/controllers
motion_controller.dart 89.35 310
single_motion_controller.dart 100.00 4
lib/src/simulations
curve_simulation.dart 100.00 15
no_motion_simulation.dart 100.00 7
lib/src/widgets
motion_builder.dart 81.82 11
motion_draggable.dart 84.69 98
sequence_motion_builder.dart 94.85 97
velocity_motion_builder.dart 84.62 13
base_motion_builder.dart 72.92 48
lib/src/widgets/layout
padding_extended.dart 50.45 111
lib/src/widgets/motion
motion_padding.dart 0.00 13

rivership

An opinionated infrastructure package for use with hooks_riverpod.

61.712846347607055% - pass ➡️ 0.00%

Coverage Details for rivership
File Line Percentage Line Count
lib/src/design
blend_color_tween.dart 0.00 4
simple_widget_states.dart 0.00 11
lib/src/extensions
async_value_tools.dart 50.00 2
brightness_tools.dart 100.00 4
date_time_tools.dart 90.57 53
duration_formatting.dart 100.00 10
hct_tools.dart 14.29 14
iterable_tools.dart 100.00 24
object_try_as.dart 100.00 1
ref_cache.dart 28.57 14
string_if_not_empty.dart 100.00 1
lib/src/hooks
use_date_format.dart 0.00 8
use_delayed.dart 100.00 15
use_fixed_extent_scroll_controller.dart 100.00 15
use_keyed_state.dart 76.47 17
use_motion.dart 67.27 55
use_motion_utils.dart 20.00 10
use_page.dart 100.00 14
use_tween_animation.dart 85.48 62
lib/src/widgets
animated_size_switcher.dart 2.63 38
animated_text.dart 0.00 25

snaptest

Snap photos in your widget tests.

67.94258373205741% - pass ➡️ 0.00%

Coverage Details for snaptest
File Line Percentage Line Count
lib/src
fake_device.dart 60.00 5
font_loading.dart 64.23 123
screenshot_test_function.dart 100.00 6
snap.dart 90.70 172
snaptest_settings.dart 30.77 13
blocked_text_painting_context.dart 33.33 93
flutter_sdk_root.dart 83.33 6

springster

Spring animations and simulations, simplified.

90.27777777777779% - pass ➡️ 0.00%

Coverage Details for springster
File Line Percentage Line Count
lib/src
spring.dart 70.97 31
spring_builder.dart 100.00 23
spring_curve.dart 100.00 6
spring_draggable.dart 100.00 25
spring_simulation_controller.dart 90.91 22
spring_simulation_controller_2d.dart 93.75 32
spring_simulation_controller_base.dart 80.00 5

stupid_simple_sheet

A simple sheet widget for Flutter.

86.848635235732% - pass ➡️ 0.00%

Coverage Details for stupid_simple_sheet
File Line Percentage Line Count
lib
stupid_simple_sheet.dart 90.12 162
lib/src
clamped_animation.dart 100.00 9
cupertino_sheet_copy.dart 100.00 86
optimized_clip.dart 65.00 20
sheet_background.dart 100.00 14
snapping_point.dart 66.67 66
stupid_simple_cupertino_sheet.dart 82.61 46

Copy link
Contributor

@timcreatedit timcreatedit left a comment

Choose a reason for hiding this comment

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

I didn't have time to review this fully but let's talk about it conceptually to help me understand. Right now I feel like this adds a lot of complexity and abstraction to this package (which is already a bit more complex than it could be to be fair) and I'm a bit scared to introduce too much maintenance overhead. I wonder if we can move things around and keep the feature set a bit more minimal to keep it simpler :)

Comment on lines 535 to 554
class _TransitionBarrier {
_TransitionBarrier({
required this.transitionId,
required this.tags,
}) : _remaining = Set<Object>.from(tags);

final int transitionId;
final Set<Object> tags;
final Set<Object> _remaining;

bool markComplete(Object tag) {
_remaining.remove(tag);
return _remaining.isEmpty;
}

bool removeTag(Object tag) {
_remaining.remove(tag);
return _remaining.isEmpty;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I don't understand what this is for, and it seems to add a lot of complexity, is this related to user gestures?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, technically that could be on its own branch. The problem was that, when multiple heroes fly around, their shuttles should disappear at once; otherwise, we could see strange pop effects. For example when the heroes fly onto a stack, since the shuttles and the actual widgets live in different 'z-index spaces'.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's strange... I think that's a new artifact, since the shuttles should disappear when the route transition ends iirc, shouldn't that be the same timing for all heroes? Or did that change with the gesture support

@JesperBellenbaum JesperBellenbaum marked this pull request as ready for review December 30, 2025 16:35
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.

3 participants