flutter/packages
Victoria Ashworth 825e901e00
Set cacheExtent for SliverFillRemaining widget (#143612)
When a Sliver with items is outside of the Viewport, but within the Viewport's `cacheExtent`, the framework should create SemanticNodes for the items even though they are out of view. However, for this to work, the Sliver's geometry must have a `cacheExtent` (how much space the sliver took up of the Viewport's `cacheExtent`) greater than 0, otherwise it is [excluded](f01ce9f4cb/packages/flutter/lib/src/rendering/viewport.dart (L311-L315)).

`SliverFillRemaining` widgets that fall outside the viewport did not have this set and therefore were being excluded when SemanticNodes were created, even if they were within the Viewport's `cacheExtent`. This PR sets the `cacheExtent` for `SliverFillRemaining` widgets.

In addition, `RenderSliverFillRemainingWithScrollable` would get dropped from the semantic tree because it's child had a size of 0 when outside the remaining paint extent. To fix, we give the child a `maxExtent` of the sliver's `cacheExtent` if it's outside the remaining paint extent but within the viewport's cacheExtent.

Fixes https://github.com/flutter/flutter/issues/142065.

Definitions:
* `RenderViewport.cacheExtent`:
  ```dart
  /// The viewport has an area before and after the visible area to cache items
  /// that are about to become visible when the user scrolls.
  ///
  /// Items that fall in this cache area are laid out even though they are not
  /// (yet) visible on screen. The [cacheExtent] describes how many pixels
  /// the cache area extends before the leading edge and after the trailing edge
  /// of the viewport.
  ///
  /// The total extent, which the viewport will try to cover with children, is
  /// [cacheExtent] before the leading edge + extent of the main axis +
  /// [cacheExtent] after the trailing edge.
  ///
  /// The cache area is also used to implement implicit accessibility scrolling
  /// on iOS: When the accessibility focus moves from an item in the visible
  /// viewport to an invisible item in the cache area, the framework will bring
  /// that item into view with an (implicit) scroll action.
  ```
* `SliverGeometry.cacheExtent`:
  ```dart
  /// How many pixels the sliver has consumed in the
  /// [SliverConstraints.remainingCacheExtent].
  ```
* `SliverContraints.remainingCacheExtent`:
  ```dart
  /// Describes how much content the sliver should provide starting from the
  /// [cacheOrigin].
  ///
  /// Not all content in the [remainingCacheExtent] will be visible as some
  /// of it might fall into the cache area of the viewport.
  ///
  /// Each sliver should start laying out content at the [cacheOrigin] and
  /// try to provide as much content as the [remainingCacheExtent] allows.
  ```
2024-03-13 16:34:25 +00:00
..
flutter Set cacheExtent for SliverFillRemaining widget (#143612) 2024-03-13 16:34:25 +00:00
flutter_driver Manually roll pub packages (#145005) 2024-03-12 19:53:57 +00:00
flutter_goldens Rename isAvailableForEnvironment to isForEnvironment (#143176) (#144858) 2024-03-10 06:20:38 +00:00
flutter_localizations Upgrade vm_service. (#144845) 2024-03-08 17:09:07 -08:00
flutter_test Reland "Fail tests on exceptions raised after test completed (#144706)" (#144980) 2024-03-12 18:17:10 +00:00
flutter_tools Flutter Web Bootstrapping Improvements (#144434) 2024-03-12 22:41:26 +00:00
flutter_web_plugins Upgrade vm_service. (#144845) 2024-03-08 17:09:07 -08:00
fuchsia_remote_debug_protocol Manually roll pub packages (#145005) 2024-03-12 19:53:57 +00:00
integration_test Manually roll pub packages (#145005) 2024-03-12 19:53:57 +00:00
analysis_options.yaml