{"action":"created","issue":{"url":"https://api.github.com/repos/flutter/flutter/issues/21764","repository_url":"https://api.github.com/repos/flutter/flutter","labels_url":"https://api.github.com/repos/flutter/flutter/issues/21764/labels{/name}","comments_url":"https://api.github.com/repos/flutter/flutter/issues/21764/comments","events_url":"https://api.github.com/repos/flutter/flutter/issues/21764/events","html_url":"https://github.com/flutter/flutter/pull/21764","id":359693036,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1MTI3ODc5","number":21764,"title":"Basic scroll semantics support","user":{"login":"jonahwilliams","id":8975114,"node_id":"MDQ6VXNlcjg5NzUxMTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8975114?v=4","gravatar_id":"","url":"https://api.github.com/users/jonahwilliams","html_url":"https://github.com/jonahwilliams","followers_url":"https://api.github.com/users/jonahwilliams/followers","following_url":"https://api.github.com/users/jonahwilliams/following{/other_user}","gists_url":"https://api.github.com/users/jonahwilliams/gists{/gist_id}","starred_url":"https://api.github.com/users/jonahwilliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonahwilliams/subscriptions","organizations_url":"https://api.github.com/users/jonahwilliams/orgs","repos_url":"https://api.github.com/users/jonahwilliams/repos","events_url":"https://api.github.com/users/jonahwilliams/events{/privacy}","received_events_url":"https://api.github.com/users/jonahwilliams/received_events","type":"User","site_admin":false},"labels":[{"id":487496476,"node_id":"MDU6TGFiZWw0ODc0OTY0NzY=","url":"https://api.github.com/repos/flutter/flutter/labels/cla:%20yes","name":"cla: yes","color":"ffffff","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-12T23:53:13Z","updated_at":"2018-10-04T02:20:07Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/flutter/flutter/pulls/21764","html_url":"https://github.com/flutter/flutter/pull/21764","diff_url":"https://github.com/flutter/flutter/pull/21764.diff","patch_url":"https://github.com/flutter/flutter/pull/21764.patch"},"body":"~~This change requires an engine roll that hasn't happened yet and updates to several dozen tests.~~\r\n\r\n----------\r\nNote: The concept of \"List\" as given here is what a user of an app would think of a list.\r\n\r\nGiven scrollIndex, the first visible child of a list and scrollChildren, the total number of items in a list, TalkBack and VoiceOver will provide additional context to the user:\r\n\r\n  `Showing items ${scrollIndex} to ${scrollIndex + visibleCount} of ${scrollChildren}`\r\n\r\nOr\r\n\r\n  `Showing item ${scrollIndex} of ${scrollChildren}`\r\n\r\nThis change requires a corresponding engine change which adds `scrollIndex` and `scrollChildren` to the semantics node. Having done that, what remains is to correctly pass this information through.\r\n\r\nSo given the three pieces of information needed above, we can start by having Scrollable/ScrollView take \"scrollChildren\" as a parameter. I called this field \"semanticChildren\" to distinguish it. In the case of ListView and other subclasses, we can usually infer this value from the length of children or item count passed - but we always allow it to be specified just in case they are different. For the CustomScrollView, the value always needs to be provided.\r\n\r\nThe next piece of information we need to pipe through is the first visible index. We already know what semantic node is visible by the time assembleSemanticNodes is called in the Scrollable, but at this point we have no to figure out what the index of this was, since slivers are lazily rendered. To solve this, I added `IndexedChildSemantics/RenderIndexedChildSemantics` which allows tagging a semantics node with `indexInParent`. Then we can simply read this value off of the semantic node.\r\n\r\nIt is the responsibility of specific subclasses to handle tagging correctly. For the `SliverChildListDelegate` and `SliverChildBuilderDelegate` classes I added three parameters to control this:\r\n\r\n  * addSemanticIndexes - defaults to true, whether to apply indexedChildSemantics. This would allow users to provide their own if necessary.\r\n\r\n  * semanticIndexOffset - defaults to 0, an offset to apply to each index added to a given child. For example, if you have a CustomScrollView with two SliverLists, you can give the second a semanticIndexOffset equal to the length of the first.\r\n\r\n  * semanticIndexCallback - defaults to always returning an index. A callback which takes a widget and the local index and provides a new index, with null based short circuit. This allows ListView.separated ti ignore odd indexes.\r\n\r\nTogether all of these additions allow the delegates to pass their builder's index to the child semantics.\r\n\r\n\r\nThe final piece of information, the number of visible children, is handled automatically in the engine by checking for the last child semantics node that isn't hidden.\r\n\r\n--------\r\n\r\nFor simple cases, like ListView/ListView.builder/ListView.separated no change needs to be made.\r\n\r\n\r\nFixes https://github.com/flutter/flutter/issues/10595"},"comment":{"url":"https://api.github.com/repos/flutter/flutter/issues/comments/426863568","html_url":"https://github.com/flutter/flutter/pull/21764#issuecomment-426863568","issue_url":"https://api.github.com/repos/flutter/flutter/issues/21764","id":426863568,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjg2MzU2OA==","user":{"login":"jonahwilliams","id":8975114,"node_id":"MDQ6VXNlcjg5NzUxMTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8975114?v=4","gravatar_id":"","url":"https://api.github.com/users/jonahwilliams","html_url":"https://github.com/jonahwilliams","followers_url":"https://api.github.com/users/jonahwilliams/followers","following_url":"https://api.github.com/users/jonahwilliams/following{/other_user}","gists_url":"https://api.github.com/users/jonahwilliams/gists{/gist_id}","starred_url":"https://api.github.com/users/jonahwilliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonahwilliams/subscriptions","organizations_url":"https://api.github.com/users/jonahwilliams/orgs","repos_url":"https://api.github.com/users/jonahwilliams/repos","events_url":"https://api.github.com/users/jonahwilliams/events{/privacy}","received_events_url":"https://api.github.com/users/jonahwilliams/received_events","type":"User","site_admin":false},"created_at":"2018-10-04T02:20:07Z","updated_at":"2018-10-04T02:20:07Z","author_association":"CONTRIBUTOR","body":"I believe I've addressed all of the comments wrt documentation. Whenever you have a chance PTAL - not tonight of course :)"}}
{"actor":{"display_login":"jonahwilliams"}}