flutter/examples/api/test/widgets
Kate Lovett 27caa7fed9
Add ScrollController.onAttach & onDetach, samples/docs on listening/getting scrolling info (#124823)
This PR does a couple of things!

https://user-images.githubusercontent.com/16964204/231897483-416287f9-50ce-468d-a714-2a4bc0f2e011.mov

![Screenshot 2023-04-13 at 3 24 28 PM](https://user-images.githubusercontent.com/16964204/231897497-f5bee17d-43ed-46e5-acd7-e1bd64768274.png)

Fixes #20819 
Fixes #41910 
Fixes #121419

### Adds ScrollController.onAttach and ScrollController.onDetach

This resolves a long held pain point for developers. When using a scroll controller, there is not scroll position until the scrollable widget is built, and almost all methods of notification are only triggered when scrolling happens. Adding these two methods will help developers gain access to the scroll position when it is created. A common workaround for this was using a post frame callback to access controller.position after the first frame, but this is ripe for issues such as having multiple positions attached to the controller, or the scrollable no longer existing after that post frame callback. I think this can also be helpful for folks to debug cases when the scroll controller has multiple positions attached.

In particular, this also resolves this commented case: https://github.com/flutter/flutter/issues/20819#issuecomment-417784218
The isScrollingNotifier is hard for developers to access.

### Docs & samples

I was surprised we did not have samples on scroll notification or scroll controller, so I overhauled it and added a lot of docs on all the different ways to access scrolling information, when it is available and how they differ.
2023-05-15 21:01:06 +00:00
..
actions Fix Action.overridable example (#110824) 2022-09-02 00:46:21 +00:00
animated_grid Add SliverAnimatedGrid and AnimatedGrid (#112982) 2022-10-07 22:15:11 +00:00
animated_list Fix gets removedItem instead of its index (#119638) 2023-02-03 00:15:58 +00:00
app Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
basic Fix MultiChildLayoutDelegate.hasChild doc (#126433) 2023-05-11 14:59:07 +00:00
binding Deprecate these old APIs (#116793) 2023-04-06 19:53:50 +00:00
editable_text Deprecate these old APIs (#116793) 2023-04-06 19:53:50 +00:00
gesture_detector Remove "note that" in our documentation (as per style guide) (#120842) 2023-02-17 22:27:33 +00:00
hardware_keyboard Explain the "patching" protocol in KeyMessageManager.keyMessageHandler and add an example (#105280) 2022-07-26 05:42:05 +00:00
heroes Revert "Reland: Set IconButton.visualDensity default to VisualDensity.standard (#109432)" (#110119) 2022-08-23 15:41:03 -07:00
implicit_animations Update AnimatedSlide example (#112803) 2022-10-03 18:44:13 +00:00
inherited_model InheritedModel: Add a complete interactive example and update snippet for null safety (#104174) 2022-05-30 06:13:10 -07:00
interactive_viewer Update example code and docs for InteractiveViewer.builder (#98623) 2022-02-16 17:25:17 -08:00
layout_builder Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
magnifier Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
overlay Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
routes Update PopupRoute docs and add an example (#106948) 2022-07-12 08:59:05 +00:00
scroll_position Add ScrollController.onAttach & onDetach, samples/docs on listening/getting scrolling info (#124823) 2023-05-15 21:01:06 +00:00
scroll_view Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
scrollbar Add an example for how to hide default scrollbar on desktop platform. (#108542) 2022-08-18 13:09:23 +00:00
shortcuts Add CallbackShortcuts example (#123944) 2023-04-05 22:17:59 +00:00
sliver Sliver Cross Axis Group (#123862) 2023-04-28 23:41:58 +00:00
slotted_render_object_widget Reland "Mixin for slotted RenderObjectWidgets and RenderBox (#94077)" (#94632) 2021-12-03 14:39:02 -08:00
tap_region Replace FocusTrap with TapRegionSurface (#107262) 2022-07-29 16:00:07 +00:00
text Add one DefaultTextStyle example (#122182) 2023-03-08 20:40:54 +00:00
text_magnifier Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
transitions Add ListenableBuilder with examples (#116543) 2022-12-07 01:15:22 +00:00
will_pop_scope Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00