Rodrigo Gomes Dias adca933962
Add semanticIndexOffset argument to SliverList.builder, SliverGrid.builder, and SliverFixedExtentList.builder (#174856)
Issue: #173019 

This pull request adds support for the `semanticIndexOffset` parameter
to the `SliverList.builder`, `SliverFixedExtentList.builder`, and
`SliverGrid.builder` constructors in Flutter. This allows developers to
offset the starting semantic index for items in these slivers, which is
important for accessibility scenarios (such as when combining multiple
slivers). The changes are thoroughly tested with new widget tests to
ensure correct behavior.

**Accessibility improvements:**

* Added `semanticIndexOffset` parameter to the constructors of
`SliverList.builder`, `SliverFixedExtentList.builder`, and
`SliverGrid.builder`, and ensured it is passed to the underlying
`SliverChildBuilderDelegate`. This allows customization of the starting
semantic index for sliver children.
[[1]](diffhunk://#diff-a7ccc8e04affff00abaa0800e680e94c325930dac396f134a70ce5c5c17f8c4dR219)
[[2]](diffhunk://#diff-a7ccc8e04affff00abaa0800e680e94c325930dac396f134a70ce5c5c17f8c4dR228)
[[3]](diffhunk://#diff-a7ccc8e04affff00abaa0800e680e94c325930dac396f134a70ce5c5c17f8c4dR476)
[[4]](diffhunk://#diff-a7ccc8e04affff00abaa0800e680e94c325930dac396f134a70ce5c5c17f8c4dR485)
[[5]](diffhunk://#diff-a7ccc8e04affff00abaa0800e680e94c325930dac396f134a70ce5c5c17f8c4dR751)
[[6]](diffhunk://#diff-a7ccc8e04affff00abaa0800e680e94c325930dac396f134a70ce5c5c17f8c4dR760)

**Testing:**

* Added a new test for `SliverList.builder` to verify that the
`semanticIndexOffset` is respected in the generated semantics tree.
[[1]](diffhunk://#diff-9aec0ee8c35ea1c71be420610fe37f772e45b5c1f715285fe76ac5ba328ea76dR366-R382)
[[2]](diffhunk://#diff-9aec0ee8c35ea1c71be420610fe37f772e45b5c1f715285fe76ac5ba328ea76dR446-R474)
* Added a new test for `SliverFixedExtentList.builder` to verify correct
semantics index offsetting.
* Added a new test for `SliverGrid.builder` to ensure it respects the
`semanticIndexOffset` parameter.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

---------

Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
2025-09-12 22:19:41 +00:00
..