• Victoria Ashworth's avatar
    Set cacheExtent for SliverFillRemaining widget (#143612) · 825e901e
    Victoria Ashworth authored
    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](https://github.com/flutter/flutter/blob/f01ce9f4cb41beff7b85122b5fcf1228bb655a87/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.
      ```
    825e901e
Name
Last commit
Last update
..
annotated_region_test.dart Loading commit data...
aspect_ratio_test.dart Loading commit data...
baseline_test.dart Loading commit data...
binding_pipeline_manifold_init_test.dart Loading commit data...
binding_pipeline_manifold_test.dart Loading commit data...
binding_test.dart Loading commit data...
box_constraints_test.dart Loading commit data...
box_test.dart Loading commit data...
cached_intrinsics_test.dart Loading commit data...
constraints_test.dart Loading commit data...
debug_overflow_indicator_test.dart Loading commit data...
debug_test.dart Loading commit data...
dynamic_intrinsics_test.dart Loading commit data...
editable_gesture_test.dart Loading commit data...
editable_test.dart Loading commit data...
error_test.dart Loading commit data...
first_frame_test.dart Loading commit data...
flex_overflow_test.dart Loading commit data...
flex_test.dart Loading commit data...
image_test.dart Loading commit data...
independent_layout_test.dart Loading commit data...
intrinsic_width_test.dart Loading commit data...
layer_annotations_test.dart Loading commit data...
layers_test.dart Loading commit data...
limited_box_test.dart Loading commit data...
localized_fonts_test.dart Loading commit data...
memory_allocations_test.dart Loading commit data...
mouse_tracker_cursor_test.dart Loading commit data...
mouse_tracker_test.dart Loading commit data...
mouse_tracker_test_utils.dart Loading commit data...
multi_view_binding_test.dart Loading commit data...
mutations_test.dart Loading commit data...
non_normalized_constraints_test.dart Loading commit data...
object_paint_dispose_test.dart Loading commit data...
object_test.dart Loading commit data...
offstage_test.dart Loading commit data...
overflow_test.dart Loading commit data...
paint_error_test.dart Loading commit data...
painting_context_test.dart Loading commit data...
paragraph_intrinsics_test.dart Loading commit data...
paragraph_test.dart Loading commit data...
pipeline_owner_tree_test.dart Loading commit data...
platform_view_test.dart Loading commit data...
positioned_box_test.dart Loading commit data...
proxy_box_test.dart Loading commit data...
proxy_getters_and_setters_test.dart Loading commit data...
proxy_sliver_test.dart Loading commit data...
reattach_test.dart Loading commit data...
relative_rect_test.dart Loading commit data...
relayout_boundary_test.dart Loading commit data...
rendering_tester.dart Loading commit data...
repaint_boundary_2_test.dart Loading commit data...
repaint_boundary_test.dart Loading commit data...
selection_test.dart Loading commit data...
semantics_and_children_test.dart Loading commit data...
simple_semantics_test.dart Loading commit data...
size_test.dart Loading commit data...
sliver_cache_test.dart Loading commit data...
sliver_fixed_extent_layout_test.dart Loading commit data...
sliver_persistent_header_test.dart Loading commit data...
sliver_utils.dart Loading commit data...
slivers_block_test.dart Loading commit data...
slivers_helpers_test.dart Loading commit data...
slivers_layout_test.dart Loading commit data...
slivers_test.dart Loading commit data...
stack_test.dart Loading commit data...
table_border_test.dart Loading commit data...
table_test.dart Loading commit data...
transform_test.dart Loading commit data...
view_chrome_style_test.dart Loading commit data...
view_constraints_test.dart Loading commit data...
view_test.dart Loading commit data...
viewport_caching_test.dart Loading commit data...
viewport_test.dart Loading commit data...
wrap_test.dart Loading commit data...