{"action":"created","comment":{"url":"https://api.github.com/repos/flutter/engine/pulls/comments/40596672","id":40596672,"diff_hunk":"@@ -22,6 +22,7 @@ const double _kMinFlingVelocity = -kMaxFlingVelocity * _kMillisecondsPerSecond;\n const double _kMaxFlingVelocity = kMaxFlingVelocity * _kMillisecondsPerSecond;\n \n typedef void ScrollListener(double scrollOffset);\n+typedef double ToSnapOffset(double scrollOffset);","path":"sky/packages/sky/lib/src/fn3/scrollable.dart","position":4,"original_position":4,"commit_id":"cfc74f84d890b45fa1c65a260dce64116ff86b60","original_commit_id":"cfc74f84d890b45fa1c65a260dce64116ff86b60","user":{"login":"Hixie","id":551196,"avatar_url":"https://avatars.githubusercontent.com/u/551196?v=3","gravatar_id":"","url":"https://api.github.com/users/Hixie","html_url":"https://github.com/Hixie","followers_url":"https://api.github.com/users/Hixie/followers","following_url":"https://api.github.com/users/Hixie/following{/other_user}","gists_url":"https://api.github.com/users/Hixie/gists{/gist_id}","starred_url":"https://api.github.com/users/Hixie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hixie/subscriptions","organizations_url":"https://api.github.com/users/Hixie/orgs","repos_url":"https://api.github.com/users/Hixie/repos","events_url":"https://api.github.com/users/Hixie/events{/privacy}","received_events_url":"https://api.github.com/users/Hixie/received_events","type":"User","site_admin":false},"body":"ToSnapOffset sounds like a subclass of Offset.\r\nMaybe call this ToSnapOffsetCallback or some such?","created_at":"2015-09-28T19:50:08Z","updated_at":"2015-09-28T19:50:08Z","html_url":"https://github.com/flutter/engine/pull/1379#discussion_r40596672","pull_request_url":"https://api.github.com/repos/flutter/engine/pulls/1379","_links":{"self":{"href":"https://api.github.com/repos/flutter/engine/pulls/comments/40596672"},"html":{"href":"https://github.com/flutter/engine/pull/1379#discussion_r40596672"},"pull_request":{"href":"https://api.github.com/repos/flutter/engine/pulls/1379"}}},"pull_request":{"url":"https://api.github.com/repos/flutter/engine/pulls/1379","id":46197843,"html_url":"https://github.com/flutter/engine/pull/1379","diff_url":"https://github.com/flutter/engine/pull/1379.diff","patch_url":"https://github.com/flutter/engine/pull/1379.patch","issue_url":"https://api.github.com/repos/flutter/engine/issues/1379","number":1379,"state":"open","locked":false,"title":"SnapOffsets for fling scrolling","user":{"login":"HansMuller","id":1377460,"avatar_url":"https://avatars.githubusercontent.com/u/1377460?v=3","gravatar_id":"","url":"https://api.github.com/users/HansMuller","html_url":"https://github.com/HansMuller","followers_url":"https://api.github.com/users/HansMuller/followers","following_url":"https://api.github.com/users/HansMuller/following{/other_user}","gists_url":"https://api.github.com/users/HansMuller/gists{/gist_id}","starred_url":"https://api.github.com/users/HansMuller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HansMuller/subscriptions","organizations_url":"https://api.github.com/users/HansMuller/orgs","repos_url":"https://api.github.com/users/HansMuller/repos","events_url":"https://api.github.com/users/HansMuller/events{/privacy}","received_events_url":"https://api.github.com/users/HansMuller/received_events","type":"User","site_admin":false},"body":"SnapOffsets for fling scrolling\r\n\r\nInitial snap offset support for ScrollableWidgetList (and ScrollableList<T>) and ScrollableMixedWidgetList. If a ```toSnapOffset(scrollOffset)``` function is provided, fling Scrolls will coast to the returned value. If ```alignmentOffset``` is specified then fling scrolls conclude when toSnapOffset's value lines up with the Scrollable widget's origin + alignmentOffset. For example if the Scrollable widget's height was 200.0, and alignmentOffset:100.0 was specified, then fling scrolls would end with the value returned by toSnapOffset() lined up with the center of the Scrollable.\r\n\r\nThis approach to Scrollable snapping assumes that the layout of whatever the Scrollable contains is known at the outset. This is often true however a ScrollableMixedWidgetList may not know its items' sizes until they've been reached by scrolling.\r\n\r\nThis is a first cut at snapping support. Among the things that remain to be done:\r\n- Scrolling limits trump snapping. Snapping should probably trump scrolling limits.\r\n- Drag scrolls aren't snapped. This may be desirable so perhaps the feature should be controlled with a flag.\r\n- Specifying alignmentOffset as a percentage would probably be more convenient.\r\n- It would be nice if one could wrap items in a SnapOffset value like: ```new SnapOffset(0.5, child: myItem)``` to snap to the center of the item.\r\n\r\nUpdated the CardCollection example: snapping and fixed size items can be turned on/off with Drawer checkboxes.\r\n","created_at":"2015-09-28T19:31:39Z","updated_at":"2015-09-28T19:50:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b35d031faf0b83f10c71f8ef72b1e9f9cb538a78","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/flutter/engine/pulls/1379/commits","review_comments_url":"https://api.github.com/repos/flutter/engine/pulls/1379/comments","review_comment_url":"https://api.github.com/repos/flutter/engine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flutter/engine/issues/1379/comments","statuses_url":"https://api.github.com/repos/flutter/engine/statuses/cfc74f84d890b45fa1c65a260dce64116ff86b60","head":{"label":"HansMuller:scrolling_snap_offsets","ref":"scrolling_snap_offsets","sha":"cfc74f84d890b45fa1c65a260dce64116ff86b60","user":{"login":"HansMuller","id":1377460,"avatar_url":"https://avatars.githubusercontent.com/u/1377460?v=3","gravatar_id":"","url":"https://api.github.com/users/HansMuller","html_url":"https://github.com/HansMuller","followers_url":"https://api.github.com/users/HansMuller/followers","following_url":"https://api.github.com/users/HansMuller/following{/other_user}","gists_url":"https://api.github.com/users/HansMuller/gists{/gist_id}","starred_url":"https://api.github.com/users/HansMuller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HansMuller/subscriptions","organizations_url":"https://api.github.com/users/HansMuller/orgs","repos_url":"https://api.github.com/users/HansMuller/repos","events_url":"https://api.github.com/users/HansMuller/events{/privacy}","received_events_url":"https://api.github.com/users/HansMuller/received_events","type":"User","site_admin":false},"repo":{"id":39275287,"name":"engine","full_name":"HansMuller/engine","owner":{"login":"HansMuller","id":1377460,"avatar_url":"https://avatars.githubusercontent.com/u/1377460?v=3","gravatar_id":"","url":"https://api.github.com/users/HansMuller","html_url":"https://github.com/HansMuller","followers_url":"https://api.github.com/users/HansMuller/followers","following_url":"https://api.github.com/users/HansMuller/following{/other_user}","gists_url":"https://api.github.com/users/HansMuller/gists{/gist_id}","starred_url":"https://api.github.com/users/HansMuller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HansMuller/subscriptions","organizations_url":"https://api.github.com/users/HansMuller/orgs","repos_url":"https://api.github.com/users/HansMuller/repos","events_url":"https://api.github.com/users/HansMuller/events{/privacy}","received_events_url":"https://api.github.com/users/HansMuller/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/HansMuller/engine","description":"The Sky engine","fork":true,"url":"https://api.github.com/repos/HansMuller/engine","forks_url":"https://api.github.com/repos/HansMuller/engine/forks","keys_url":"https://api.github.com/repos/HansMuller/engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HansMuller/engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HansMuller/engine/teams","hooks_url":"https://api.github.com/repos/HansMuller/engine/hooks","issue_events_url":"https://api.github.com/repos/HansMuller/engine/issues/events{/number}","events_url":"https://api.github.com/repos/HansMuller/engine/events","assignees_url":"https://api.github.com/repos/HansMuller/engine/assignees{/user}","branches_url":"https://api.github.com/repos/HansMuller/engine/branches{/branch}","tags_url":"https://api.github.com/repos/HansMuller/engine/tags","blobs_url":"https://api.github.com/repos/HansMuller/engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HansMuller/engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HansMuller/engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/HansMuller/engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HansMuller/engine/statuses/{sha}","languages_url":"https://api.github.com/repos/HansMuller/engine/languages","stargazers_url":"https://api.github.com/repos/HansMuller/engine/stargazers","contributors_url":"https://api.github.com/repos/HansMuller/engine/contributors","subscribers_url":"https://api.github.com/repos/HansMuller/engine/subscribers","subscription_url":"https://api.github.com/repos/HansMuller/engine/subscription","commits_url":"https://api.github.com/repos/HansMuller/engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/HansMuller/engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/HansMuller/engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/HansMuller/engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/HansMuller/engine/contents/{+path}","compare_url":"https://api.github.com/repos/HansMuller/engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HansMuller/engine/merges","archive_url":"https://api.github.com/repos/HansMuller/engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HansMuller/engine/downloads","issues_url":"https://api.github.com/repos/HansMuller/engine/issues{/number}","pulls_url":"https://api.github.com/repos/HansMuller/engine/pulls{/number}","milestones_url":"https://api.github.com/repos/HansMuller/engine/milestones{/number}","notifications_url":"https://api.github.com/repos/HansMuller/engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HansMuller/engine/labels{/name}","releases_url":"https://api.github.com/repos/HansMuller/engine/releases{/id}","created_at":"2015-07-17T21:07:51Z","updated_at":"2015-09-21T17:28:09Z","pushed_at":"2015-09-28T18:49:05Z","git_url":"git://github.com/HansMuller/engine.git","ssh_url":"git@github.com:HansMuller/engine.git","clone_url":"https://github.com/HansMuller/engine.git","svn_url":"https://github.com/HansMuller/engine","homepage":null,"size":75767,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"flutter:master","ref":"master","sha":"16d05d1f9cc9f1c1c978393c00694b2bacbcd666","user":{"login":"flutter","id":14101776,"avatar_url":"https://avatars.githubusercontent.com/u/14101776?v=3","gravatar_id":"","url":"https://api.github.com/users/flutter","html_url":"https://github.com/flutter","followers_url":"https://api.github.com/users/flutter/followers","following_url":"https://api.github.com/users/flutter/following{/other_user}","gists_url":"https://api.github.com/users/flutter/gists{/gist_id}","starred_url":"https://api.github.com/users/flutter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flutter/subscriptions","organizations_url":"https://api.github.com/users/flutter/orgs","repos_url":"https://api.github.com/users/flutter/repos","events_url":"https://api.github.com/users/flutter/events{/privacy}","received_events_url":"https://api.github.com/users/flutter/received_events","type":"Organization","site_admin":false},"repo":{"id":39211337,"name":"engine","full_name":"flutter/engine","owner":{"login":"flutter","id":14101776,"avatar_url":"https://avatars.githubusercontent.com/u/14101776?v=3","gravatar_id":"","url":"https://api.github.com/users/flutter","html_url":"https://github.com/flutter","followers_url":"https://api.github.com/users/flutter/followers","following_url":"https://api.github.com/users/flutter/following{/other_user}","gists_url":"https://api.github.com/users/flutter/gists{/gist_id}","starred_url":"https://api.github.com/users/flutter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flutter/subscriptions","organizations_url":"https://api.github.com/users/flutter/orgs","repos_url":"https://api.github.com/users/flutter/repos","events_url":"https://api.github.com/users/flutter/events{/privacy}","received_events_url":"https://api.github.com/users/flutter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flutter/engine","description":"The Flutter engine","fork":false,"url":"https://api.github.com/repos/flutter/engine","forks_url":"https://api.github.com/repos/flutter/engine/forks","keys_url":"https://api.github.com/repos/flutter/engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flutter/engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flutter/engine/teams","hooks_url":"https://api.github.com/repos/flutter/engine/hooks","issue_events_url":"https://api.github.com/repos/flutter/engine/issues/events{/number}","events_url":"https://api.github.com/repos/flutter/engine/events","assignees_url":"https://api.github.com/repos/flutter/engine/assignees{/user}","branches_url":"https://api.github.com/repos/flutter/engine/branches{/branch}","tags_url":"https://api.github.com/repos/flutter/engine/tags","blobs_url":"https://api.github.com/repos/flutter/engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flutter/engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flutter/engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/flutter/engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flutter/engine/statuses/{sha}","languages_url":"https://api.github.com/repos/flutter/engine/languages","stargazers_url":"https://api.github.com/repos/flutter/engine/stargazers","contributors_url":"https://api.github.com/repos/flutter/engine/contributors","subscribers_url":"https://api.github.com/repos/flutter/engine/subscribers","subscription_url":"https://api.github.com/repos/flutter/engine/subscription","commits_url":"https://api.github.com/repos/flutter/engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/flutter/engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/flutter/engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/flutter/engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/flutter/engine/contents/{+path}","compare_url":"https://api.github.com/repos/flutter/engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flutter/engine/merges","archive_url":"https://api.github.com/repos/flutter/engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flutter/engine/downloads","issues_url":"https://api.github.com/repos/flutter/engine/issues{/number}","pulls_url":"https://api.github.com/repos/flutter/engine/pulls{/number}","milestones_url":"https://api.github.com/repos/flutter/engine/milestones{/number}","notifications_url":"https://api.github.com/repos/flutter/engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flutter/engine/labels{/name}","releases_url":"https://api.github.com/repos/flutter/engine/releases{/id}","created_at":"2015-07-16T17:39:56Z","updated_at":"2015-09-28T17:18:04Z","pushed_at":"2015-09-28T19:40:27Z","git_url":"git://github.com/flutter/engine.git","ssh_url":"git@github.com:flutter/engine.git","clone_url":"https://github.com/flutter/engine.git","svn_url":"https://github.com/flutter/engine","homepage":"http://flutter.io","size":87255,"stargazers_count":244,"watchers_count":244,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":66,"mirror_url":null,"open_issues_count":243,"forks":66,"open_issues":243,"watchers":244,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flutter/engine/pulls/1379"},"html":{"href":"https://github.com/flutter/engine/pull/1379"},"issue":{"href":"https://api.github.com/repos/flutter/engine/issues/1379"},"comments":{"href":"https://api.github.com/repos/flutter/engine/issues/1379/comments"},"review_comments":{"href":"https://api.github.com/repos/flutter/engine/pulls/1379/comments"},"review_comment":{"href":"https://api.github.com/repos/flutter/engine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flutter/engine/pulls/1379/commits"},"statuses":{"href":"https://api.github.com/repos/flutter/engine/statuses/cfc74f84d890b45fa1c65a260dce64116ff86b60"}}}}