-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add a DrivenScrollActivity.simulation constructor #166730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a DrivenScrollActivity.simulation constructor #166730
Conversation
I'd like to have a scroll activity that drives the scroll view through a particular animation -- just like a DrivenScrollActivity does -- but where the animation doesn't have an end point or duration that's known when the animation begins. (Concretely, this is to implement a "scroll to the end of history" button in the Zulip message list. The end point is maxScrollExtent... except that maxScrollExtent while in the middle of history is only an estimate, and will change as the list view scrolls through shorter and longer messages.) That means the animation is naturally described by a Simulation, but not by the parameters accepted by the current DrivenScrollActivity constructor, or by the animateTo method which wraps it. I think this can be handled quite cleanly with an alternate constructor on DrivenScrollActivity, one that accepts a Simulation instead of the from/to/duration/curve parameters accepted by the default constructor. The new constructor is very similar to the constructor of BallisticScrollActivity. Most of the changes here are in revising the docs of both DrivenScrollActivity and BallisticScrollActivity. The docs had characterized the difference between the two as about using a Simulation vs. the from/to/duration/curve animation parameters, but I think that's never been the most important difference between them: the key difference is really the `goBallistic` calls in BallisticScrollActivity, particularly in `applyNewDimensions`, and the implications those have for how the simulation needs to relate to the scroll physics. So this rewrites the docs to describe that.
|
Well, there's a failure mode I hadn't seen before:
That's from Mac framework_tests_impeller. Sounds like some sort of infra issue. I'll re-run and see if that helps. |
|
@Piinks is at Cloud Next and may miss this this week. |
victorsanni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well. I don't see a reason not to add this API, but I'll defer to someone with more context.
| /// scroll offset when the geometry of the scroll view changes. In these | ||
| /// situations, the [Simulation] typically starts with a zero velocity. | ||
| /// | ||
| /// The scrolling will be driven by the given [Simulation]. If a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// The scrolling will be driven by the given [Simulation]. If a | |
| /// The scrolling will be driven by the given [Simulation]. If a |
| /// | ||
| /// The scrolling will be driven by the given animation parameters | ||
| /// or the given [Simulation]. | ||
| /// Unlike a [BallisticScrollActivity], if a [DrivenScrollActivity] is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// Unlike a [BallisticScrollActivity], if a [DrivenScrollActivity] is | |
| /// Unlike a [BallisticScrollActivity], if a [DrivenScrollActivity] is |
Piinks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very cool, thank you @gnprice!
the animation doesn't have an end point or duration that's known when the animation begins.
This is actually something @chunhtai and I had a similar conversation about recently. :)
LGTM with exception of @victorsanni's notes below.
|
Thanks for the reviews! Applied those docs edits and will set to automerge. |
I'd like to have a scroll activity that drives the scroll view through a particular animation -- just like a DrivenScrollActivity does -- but where the animation doesn't have an end point or duration that's known when the animation begins. (Concretely, this is to implement a "scroll to the end of history" button in the Zulip message list. The end point is maxScrollExtent... except that maxScrollExtent while in the middle of history is only an estimate, and will change as the list view scrolls through shorter and longer messages.) That means the animation is naturally described by a Simulation, but not by the parameters accepted by the current DrivenScrollActivity constructor, or by the animateTo method which wraps it. I think this can be handled quite cleanly with an alternate constructor on DrivenScrollActivity, one that accepts a Simulation instead of the from/to/duration/curve parameters accepted by the default constructor. The new constructor is very similar to the constructor of BallisticScrollActivity. Most of the changes here are in revising the docs of both DrivenScrollActivity and BallisticScrollActivity. The docs had characterized the difference between the two as about using a Simulation vs. the from/to/duration/curve animation parameters, but I think that's never been the most important difference between them: the key difference is really the `goBallistic` calls in BallisticScrollActivity, particularly in `applyNewDimensions`, and the implications those have for how the simulation needs to relate to the scroll physics. So this rewrites the docs to describe that.
flutter/flutter@3ed38e2...cfb887c 2025-04-20 [email protected] Roll Fuchsia Linux SDK from 0U_vEALFF7qRJZ_cE... to RGmU4KeQhrxqE7hsr... (flutter/flutter#167447) 2025-04-19 [email protected] Roll Skia from 3dc3ffeb45f0 to bd9ef4955aad (1 revision) (flutter/flutter#167434) 2025-04-19 [email protected] Roll Fuchsia Linux SDK from MwYckh5OvwwmIYLx0... to 0U_vEALFF7qRJZ_cE... (flutter/flutter#167430) 2025-04-19 [email protected] Roll Skia from 177a2929e32f to 3dc3ffeb45f0 (1 revision) (flutter/flutter#167428) 2025-04-19 [email protected] Revert "Reduce app startup latency by initializing the engine on a separate thread (#166918)" (flutter/flutter#167427) 2025-04-18 [email protected] Fix keyboard cover SearchAnchor list results (flutter/flutter#165382) 2025-04-18 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Mark `windows_host_engine_test` flaky (#167419)" (flutter/flutter#167425) 2025-04-18 [email protected] Docs: Update date picker theme day color properties doc (flutter/flutter#166122) 2025-04-18 [email protected] Add ktlint test for generated files from templates (flutter/flutter#167378) 2025-04-18 [email protected] Revert "[Windows] Enable merged platform and UI thread by default" (flutter/flutter#167420) 2025-04-18 [email protected] Add a DrivenScrollActivity.simulation constructor (flutter/flutter#166730) 2025-04-18 [email protected] Added missing period for consistency and readability (flutter/flutter#162887) 2025-04-18 [email protected] Roll Skia from 6c4595124690 to 177a2929e32f (1 revision) (flutter/flutter#167417) 2025-04-18 [email protected] Fix codesigning for `Mac_arm64_ios imitation_game_flutter` (flutter/flutter#167307) 2025-04-18 [email protected] Mark `windows_host_engine_test` flaky (flutter/flutter#167419) 2025-04-18 [email protected] Roll Dart SDK from ab60afc99bcb to 0cfefe2a03fb (1 revision) (flutter/flutter#167414) 2025-04-18 [email protected] [web] close input connection when window/iframe loses focus (flutter/flutter#166804) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
And update Flutter's supporting libraries to match. In particular this pulls in a recent PR of mine so we can use it: flutter/flutter#166730
In order to implement the "scroll to bottom" button in a way that behaves well when scrolling to the growth end of a sliver -- in particular, when scrolling to the end of the message list after we split it into back-to-back slivers -- we'll want some differences from the behavior provided by DrivenScrollActivity, which we've used up until now (originally via the `animateTo` method). That calls for our own ScrollActivity subclass, ScrollToEndActivity. We'll want most of the same behavior as DrivenScrollActivity, with just a couple of changes; but one of the places we want to change isn't among the places that DrivenScrollActivity exposes for subclassing. So add this class, based on DrivenScrollActivity but with a customization point added in the additional spot we'll need. Originally there were two additional customization points needed. After first drafting this change, I sent those upstream as two PRs: flutter/flutter#166730 flutter/flutter#166731 The first one has already landed in DrivenScrollActivity: the applyMoveTo method now overridden by ScrollToEndActivity in a previous commit. The other one, a `.simulation` constructor, is pending. A "TODO(upstream)" comment points to that PR, because once it also merges we can dispense with this class.
…r#9118) flutter/flutter@3ed38e2...cfb887c 2025-04-20 [email protected] Roll Fuchsia Linux SDK from 0U_vEALFF7qRJZ_cE... to RGmU4KeQhrxqE7hsr... (flutter/flutter#167447) 2025-04-19 [email protected] Roll Skia from 3dc3ffeb45f0 to bd9ef4955aad (1 revision) (flutter/flutter#167434) 2025-04-19 [email protected] Roll Fuchsia Linux SDK from MwYckh5OvwwmIYLx0... to 0U_vEALFF7qRJZ_cE... (flutter/flutter#167430) 2025-04-19 [email protected] Roll Skia from 177a2929e32f to 3dc3ffeb45f0 (1 revision) (flutter/flutter#167428) 2025-04-19 [email protected] Revert "Reduce app startup latency by initializing the engine on a separate thread (#166918)" (flutter/flutter#167427) 2025-04-18 [email protected] Fix keyboard cover SearchAnchor list results (flutter/flutter#165382) 2025-04-18 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Mark `windows_host_engine_test` flaky (#167419)" (flutter/flutter#167425) 2025-04-18 [email protected] Docs: Update date picker theme day color properties doc (flutter/flutter#166122) 2025-04-18 [email protected] Add ktlint test for generated files from templates (flutter/flutter#167378) 2025-04-18 [email protected] Revert "[Windows] Enable merged platform and UI thread by default" (flutter/flutter#167420) 2025-04-18 [email protected] Add a DrivenScrollActivity.simulation constructor (flutter/flutter#166730) 2025-04-18 [email protected] Added missing period for consistency and readability (flutter/flutter#162887) 2025-04-18 [email protected] Roll Skia from 6c4595124690 to 177a2929e32f (1 revision) (flutter/flutter#167417) 2025-04-18 [email protected] Fix codesigning for `Mac_arm64_ios imitation_game_flutter` (flutter/flutter#167307) 2025-04-18 [email protected] Mark `windows_host_engine_test` flaky (flutter/flutter#167419) 2025-04-18 [email protected] Roll Dart SDK from ab60afc99bcb to 0cfefe2a03fb (1 revision) (flutter/flutter#167414) 2025-04-18 [email protected] [web] close input connection when window/iframe loses focus (flutter/flutter#166804) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
And update Flutter's supporting libraries to match. In particular this pulls in two recent PRs of mine so we can use them: flutter/flutter#166730 flutter/flutter#164818
In order to implement the "scroll to bottom" button in a way that behaves well when scrolling to the growth end of a sliver -- in particular, when scrolling to the end of the message list after we split it into back-to-back slivers -- we'll want some differences from the behavior provided by DrivenScrollActivity, which we've used up until now (originally via the `animateTo` method). That calls for our own ScrollActivity subclass, ScrollToEndActivity. We'll want most of the same behavior as DrivenScrollActivity, with just a couple of changes; but one of the places we want to change isn't among the places that DrivenScrollActivity exposes for subclassing. So add this class, based on DrivenScrollActivity but with a customization point added in the additional spot we'll need. Originally there were two additional customization points needed. After first drafting this change, I sent those upstream as two PRs: flutter/flutter#166730 flutter/flutter#166731 The first one has already landed in DrivenScrollActivity: the applyMoveTo method now overridden by ScrollToEndActivity in a previous commit. The other one, a `.simulation` constructor, is pending. A "TODO(upstream)" comment points to that PR, because once it also merges we can dispense with this class.
And update Flutter's supporting libraries to match. In particular this pulls in two recent PRs of mine so we can use them: flutter/flutter#166730 flutter/flutter#164818
As long as the bottom sliver is size zero (or more generally, as long as maxScrollExtent does not change during the animation), this is nearly NFC: I believe the only changes in behavior would come from differences in rounding. By describing the animation in terms of velocity, rather than a duration and exact target position, this lets us smoothly handle the case where we may not know exactly what the position coordinate of the end will be. A previous commit handled the case where the end comes sooner than estimated, by promptly stopping when that happens. This commit ensures the scroll continues past the original estimate, in the case where the end comes later. That case is a possibility as soon as there's a bottom sliver with a message in it: scroll up so the message is offscreen and no longer built; then have the message edited so it becomes taller; then scroll back down. It's impossible for the viewport to know that the bottom sliver's content has gotten taller until we actually scroll back down and cause the message's widget to get built. And naturally that will become even more salient of an issue when we enable the message list to jump into the middle of a long history, so that the bottom sliver may have content that hasn't yet been scrolled to, has never been built as widgets, and may not even have yet been fetched from the server. In order to control the behavior with a Simulation rather than a fixed endpoint and duration with a Curve, this commit uses a feature I added recently for this purpose to DrivenScrollActivity upstream: flutter/flutter#166730
As long as the bottom sliver is size zero (or more generally, as long as maxScrollExtent does not change during the animation), this is nearly NFC: I believe the only changes in behavior would come from differences in rounding. By describing the animation in terms of velocity, rather than a duration and exact target position, this lets us smoothly handle the case where we may not know exactly what the position coordinate of the end will be. A previous commit handled the case where the end comes sooner than estimated, by promptly stopping when that happens. This commit ensures the scroll continues past the original estimate, in the case where the end comes later. That case is a possibility as soon as there's a bottom sliver with a message in it: scroll up so the message is offscreen and no longer built; then have the message edited so it becomes taller; then scroll back down. It's impossible for the viewport to know that the bottom sliver's content has gotten taller until we actually scroll back down and cause the message's widget to get built. And naturally that will become even more salient of an issue when we enable the message list to jump into the middle of a long history, so that the bottom sliver may have content that hasn't yet been scrolled to, has never been built as widgets, and may not even have yet been fetched from the server. In order to control the behavior with a Simulation rather than a fixed endpoint and duration with a Curve, this commit uses a feature I added recently for this purpose to DrivenScrollActivity upstream: flutter/flutter#166730
…r#9118) flutter/flutter@3ed38e2...cfb887c 2025-04-20 [email protected] Roll Fuchsia Linux SDK from 0U_vEALFF7qRJZ_cE... to RGmU4KeQhrxqE7hsr... (flutter/flutter#167447) 2025-04-19 [email protected] Roll Skia from 3dc3ffeb45f0 to bd9ef4955aad (1 revision) (flutter/flutter#167434) 2025-04-19 [email protected] Roll Fuchsia Linux SDK from MwYckh5OvwwmIYLx0... to 0U_vEALFF7qRJZ_cE... (flutter/flutter#167430) 2025-04-19 [email protected] Roll Skia from 177a2929e32f to 3dc3ffeb45f0 (1 revision) (flutter/flutter#167428) 2025-04-19 [email protected] Revert "Reduce app startup latency by initializing the engine on a separate thread (#166918)" (flutter/flutter#167427) 2025-04-18 [email protected] Fix keyboard cover SearchAnchor list results (flutter/flutter#165382) 2025-04-18 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Mark `windows_host_engine_test` flaky (#167419)" (flutter/flutter#167425) 2025-04-18 [email protected] Docs: Update date picker theme day color properties doc (flutter/flutter#166122) 2025-04-18 [email protected] Add ktlint test for generated files from templates (flutter/flutter#167378) 2025-04-18 [email protected] Revert "[Windows] Enable merged platform and UI thread by default" (flutter/flutter#167420) 2025-04-18 [email protected] Add a DrivenScrollActivity.simulation constructor (flutter/flutter#166730) 2025-04-18 [email protected] Added missing period for consistency and readability (flutter/flutter#162887) 2025-04-18 [email protected] Roll Skia from 6c4595124690 to 177a2929e32f (1 revision) (flutter/flutter#167417) 2025-04-18 [email protected] Fix codesigning for `Mac_arm64_ios imitation_game_flutter` (flutter/flutter#167307) 2025-04-18 [email protected] Mark `windows_host_engine_test` flaky (flutter/flutter#167419) 2025-04-18 [email protected] Roll Dart SDK from ab60afc99bcb to 0cfefe2a03fb (1 revision) (flutter/flutter#167414) 2025-04-18 [email protected] [web] close input connection when window/iframe loses focus (flutter/flutter#166804) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#9118) flutter/flutter@3ed38e2...cfb887c 2025-04-20 [email protected] Roll Fuchsia Linux SDK from 0U_vEALFF7qRJZ_cE... to RGmU4KeQhrxqE7hsr... (flutter/flutter#167447) 2025-04-19 [email protected] Roll Skia from 3dc3ffeb45f0 to bd9ef4955aad (1 revision) (flutter/flutter#167434) 2025-04-19 [email protected] Roll Fuchsia Linux SDK from MwYckh5OvwwmIYLx0... to 0U_vEALFF7qRJZ_cE... (flutter/flutter#167430) 2025-04-19 [email protected] Roll Skia from 177a2929e32f to 3dc3ffeb45f0 (1 revision) (flutter/flutter#167428) 2025-04-19 [email protected] Revert "Reduce app startup latency by initializing the engine on a separate thread (#166918)" (flutter/flutter#167427) 2025-04-18 [email protected] Fix keyboard cover SearchAnchor list results (flutter/flutter#165382) 2025-04-18 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Mark `windows_host_engine_test` flaky (#167419)" (flutter/flutter#167425) 2025-04-18 [email protected] Docs: Update date picker theme day color properties doc (flutter/flutter#166122) 2025-04-18 [email protected] Add ktlint test for generated files from templates (flutter/flutter#167378) 2025-04-18 [email protected] Revert "[Windows] Enable merged platform and UI thread by default" (flutter/flutter#167420) 2025-04-18 [email protected] Add a DrivenScrollActivity.simulation constructor (flutter/flutter#166730) 2025-04-18 [email protected] Added missing period for consistency and readability (flutter/flutter#162887) 2025-04-18 [email protected] Roll Skia from 6c4595124690 to 177a2929e32f (1 revision) (flutter/flutter#167417) 2025-04-18 [email protected] Fix codesigning for `Mac_arm64_ios imitation_game_flutter` (flutter/flutter#167307) 2025-04-18 [email protected] Mark `windows_host_engine_test` flaky (flutter/flutter#167419) 2025-04-18 [email protected] Roll Dart SDK from ab60afc99bcb to 0cfefe2a03fb (1 revision) (flutter/flutter#167414) 2025-04-18 [email protected] [web] close input connection when window/iframe loses focus (flutter/flutter#166804) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#9118) flutter/flutter@3ed38e2...cfb887c 2025-04-20 [email protected] Roll Fuchsia Linux SDK from 0U_vEALFF7qRJZ_cE... to RGmU4KeQhrxqE7hsr... (flutter/flutter#167447) 2025-04-19 [email protected] Roll Skia from 3dc3ffeb45f0 to bd9ef4955aad (1 revision) (flutter/flutter#167434) 2025-04-19 [email protected] Roll Fuchsia Linux SDK from MwYckh5OvwwmIYLx0... to 0U_vEALFF7qRJZ_cE... (flutter/flutter#167430) 2025-04-19 [email protected] Roll Skia from 177a2929e32f to 3dc3ffeb45f0 (1 revision) (flutter/flutter#167428) 2025-04-19 [email protected] Revert "Reduce app startup latency by initializing the engine on a separate thread (#166918)" (flutter/flutter#167427) 2025-04-18 [email protected] Fix keyboard cover SearchAnchor list results (flutter/flutter#165382) 2025-04-18 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Mark `windows_host_engine_test` flaky (#167419)" (flutter/flutter#167425) 2025-04-18 [email protected] Docs: Update date picker theme day color properties doc (flutter/flutter#166122) 2025-04-18 [email protected] Add ktlint test for generated files from templates (flutter/flutter#167378) 2025-04-18 [email protected] Revert "[Windows] Enable merged platform and UI thread by default" (flutter/flutter#167420) 2025-04-18 [email protected] Add a DrivenScrollActivity.simulation constructor (flutter/flutter#166730) 2025-04-18 [email protected] Added missing period for consistency and readability (flutter/flutter#162887) 2025-04-18 [email protected] Roll Skia from 6c4595124690 to 177a2929e32f (1 revision) (flutter/flutter#167417) 2025-04-18 [email protected] Fix codesigning for `Mac_arm64_ios imitation_game_flutter` (flutter/flutter#167307) 2025-04-18 [email protected] Mark `windows_host_engine_test` flaky (flutter/flutter#167419) 2025-04-18 [email protected] Roll Dart SDK from ab60afc99bcb to 0cfefe2a03fb (1 revision) (flutter/flutter#167414) 2025-04-18 [email protected] [web] close input connection when window/iframe loses focus (flutter/flutter#166804) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
I'd like to have a scroll activity that drives the scroll view through a particular animation -- just like a DrivenScrollActivity does -- but where the animation doesn't have an end point or duration that's known when the animation begins. (Concretely, this is to implement a "scroll to the end of history" button in the Zulip message list. The end point is maxScrollExtent... except that maxScrollExtent while in the middle of history is only an estimate, and will change as the list view scrolls through shorter and longer messages.) That means the animation is naturally described by a Simulation, but not by the parameters accepted by the current DrivenScrollActivity constructor, or by the animateTo method which wraps it. I think this can be handled quite cleanly with an alternate constructor on DrivenScrollActivity, one that accepts a Simulation instead of the from/to/duration/curve parameters accepted by the default constructor. The new constructor is very similar to the constructor of BallisticScrollActivity. Most of the changes here are in revising the docs of both DrivenScrollActivity and BallisticScrollActivity. The docs had characterized the difference between the two as about using a Simulation vs. the from/to/duration/curve animation parameters, but I think that's never been the most important difference between them: the key difference is really the `goBallistic` calls in BallisticScrollActivity, particularly in `applyNewDimensions`, and the implications those have for how the simulation needs to relate to the scroll physics. So this rewrites the docs to describe that.
I'd like to have a scroll activity that drives the scroll view through a particular animation -- just like a DrivenScrollActivity does -- but where the animation doesn't have an end point or duration that's known when the animation begins.
(Concretely, this is to implement a "scroll to the end of history" button in the Zulip message list. The end point is maxScrollExtent... except that maxScrollExtent while in the middle of history is only an estimate, and will change as the list view scrolls through shorter and longer messages.)
That means the animation is naturally described by a Simulation, but not by the parameters accepted by the current DrivenScrollActivity constructor, or by the animateTo method which wraps it.
I think this can be handled quite cleanly with an alternate constructor on DrivenScrollActivity, one that accepts a Simulation instead of the from/to/duration/curve parameters accepted by the default constructor. The new constructor is very similar to the constructor of BallisticScrollActivity.
Most of the changes here are in revising the docs of both DrivenScrollActivity and BallisticScrollActivity. The docs had characterized the difference between the two as about using a Simulation vs. the from/to/duration/curve animation parameters, but I think that's never been the most important difference between them: the key difference is really the
goBallisticcalls in BallisticScrollActivity, particularly inapplyNewDimensions, and the implications those have for how the simulation needs to relate to the scroll physics. So this rewrites the docs to describe that.