{"action":"created","comment":{"url":"https://api.github.com/repos/flutter/plugins/pulls/comments/172144469","pull_request_review_id":101099293,"id":172144469,"diff_hunk":"@@ -0,0 +1,212 @@\n+// Copyright 2018 The Chromium Authors. All rights reserved.\n+// Use of this source code is governed by a BSD-style license that can be\n+// found in the LICENSE file.\n+\n+import 'dart:async';\n+import 'dart:ui';\n+\n+import 'package:flutter/material.dart';\n+import 'package:flutter/widgets.dart';\n+import 'package:flutter/scheduler.dart';\n+import 'package:meta/meta.dart';\n+\n+/// Base class for controllers of platform overlays.\n+///\n+/// Platform overlays are normal platform-specific views that are\n+/// created, shown on top of the Flutter view, or hidden below it,\n+/// under control of the Flutter app. The platform overlay is\n+/// typically placed on top of a [Texture] widget acting as stand-in\n+/// while Flutter movement or transformations are ongoing.\n+///\n+/// Overlays are attached to a [BuildContext] when used in a Widget and\n+/// are deactivated when the ambient ModalRoute (if any) is not on top of the\n+/// navigator stack.\n+///\n+/// *Warning*: Platform overlays cannot be freely composed with\n+/// over widgets.\n+///\n+/// Limitations and caveats:\n+///\n+/// * TODO(mravn)\n+abstract class PlatformOverlayController extends NavigatorObserver\n+    with WidgetsBindingObserver {\n+  final double width;\n+  final double height;\n+  final Completer<int> _overlayIdCompleter = new Completer<int>();\n+  BuildContext _context;\n+  Route<dynamic> _currentRoute;\n+  Route<dynamic> _previousRoute;\n+  Route<dynamic> _routeWithOverlay;\n+  int _activationCount = 0;\n+  bool _deactivatedByPush = false;\n+  bool _disposed = false;\n+\n+  PlatformOverlayController(this.width, this.height);\n+\n+  void attachTo(BuildContext context) {\n+    _context = context;\n+    _routeWithOverlay = _currentRoute;\n+    _activateOverlayAfterPushAnimations(_routeWithOverlay, _previousRoute);\n+    WidgetsBinding.instance.addObserver(this);\n+    SchedulerBinding.instance.addPostFrameCallback((_) {\n+      if (_disposed) {\n+        return;\n+      }\n+      if (!_overlayIdCompleter.isCompleted) {\n+        _overlayIdCompleter.complete(\n+            createOverlay(new Size(width, height) * window.devicePixelRatio));\n+      }\n+    });\n+  }\n+\n+  void detach() {\n+    WidgetsBinding.instance.removeObserver(this);\n+  }\n+\n+  /// Allow activating the overlay, unless there are other pending calls to\n+  /// [deactivateOverlay].\n+  void activateOverlay() {\n+    _activationCount += 1;\n+    if (_activationCount == 1) {\n+      SchedulerBinding.instance.addPostFrameCallback((_) {\n+        if (_disposed) {\n+          return;\n+        }\n+        final RenderObject object = _context?.findRenderObject();\n+        Offset offset;\n+        if (object is RenderBox) {\n+          offset = object.localToGlobal(Offset.zero) * window.devicePixelRatio;\n+        } else {\n+          offset = Offset.zero;\n+        }\n+        showOverlay(offset);\n+      });\n+    }\n+  }\n+\n+  /// Prevent activating the overlay until a matching call to [activateOverlay].\n+  void deactivateOverlay() {\n+    _activationCount -= 1;\n+    if (_activationCount == 0) {\n+      hideOverlay();\n+    }\n+  }\n+\n+  @override\n+  void didPush(Route<dynamic> route, Route<dynamic> previousRoute) {\n+    _currentRoute = route;\n+    _previousRoute = previousRoute;\n+    if (previousRoute != null && identical(previousRoute, _routeWithOverlay)) {\n+      deactivateOverlay();\n+      _deactivatedByPush = true;\n+    }\n+  }\n+\n+  @override\n+  void didPop(Route<dynamic> route, Route<dynamic> previousRoute) {\n+    _currentRoute = previousRoute;\n+    _previousRoute = route;\n+    if (identical(route, _routeWithOverlay)) {\n+      deactivateOverlay();\n+    } else if (identical(previousRoute, _routeWithOverlay) &&\n+        _deactivatedByPush) {\n+      _activateOverlayAfterPopAnimations(route, previousRoute);\n+    }\n+  }\n+\n+  void _activateOverlayAfterPopAnimations(\n+      Route<dynamic> route, Route<dynamic> previousRoute) {\n+    if (route is ModalRoute && previousRoute is ModalRoute) {\n+      _doOnceAfter(route.animation, () {\n+        _doOnceAfter(previousRoute.secondaryAnimation, () {\n+          activateOverlay();\n+          _deactivatedByPush = false;\n+        });\n+      });\n+    } else if (route is ModalRoute) {\n+      _doOnceAfter(route.animation, () {\n+        activateOverlay();\n+        _deactivatedByPush = false;\n+      });\n+    } else if (previousRoute is ModalRoute) {\n+      _doOnceAfter(previousRoute.secondaryAnimation, () {\n+        activateOverlay();\n+        _deactivatedByPush = false;\n+      });\n+    }\n+  }\n+\n+  void _activateOverlayAfterPushAnimations(\n+      Route<dynamic> route, Route<dynamic> previousRoute) {\n+    if (route is ModalRoute && previousRoute is ModalRoute) {\n+      _doOnceAfter(route.animation, () {\n+        _doOnceAfter(previousRoute.secondaryAnimation, () {\n+          activateOverlay();\n+        });\n+      });\n+    } else if (route is ModalRoute) {\n+      _doOnceAfter(route.animation, () {\n+        activateOverlay();\n+      });\n+    } else if (previousRoute is ModalRoute) {\n+      _doOnceAfter(previousRoute.secondaryAnimation, () {\n+        activateOverlay();\n+      });\n+    }\n+  }\n+\n+  void _doOnceAfter(Animation<dynamic> animation, void onDone()) {\n+    void listener() {\n+      if (animation.status != AnimationStatus.forward &&\n+          animation.status != AnimationStatus.reverse) {\n+        animation.removeListener(listener);\n+        onDone();\n+      }\n+    }\n+\n+    if (animation.status != AnimationStatus.completed &&\n+        animation.status != AnimationStatus.dismissed) {\n+      animation.addListener(listener);\n+    } else {\n+      onDone();\n+    }\n+  }\n+\n+  @override\n+  void didRemove(Route<dynamic> route, Route<dynamic> previousRoute) {\n+    // TODO(mravn)\n+  }\n+\n+  void dispose() {\n+    if (!_disposed) {\n+      disposeOverlay();\n+      _disposed = true;\n+    }\n+  }\n+\n+  @override\n+  void didChangeMetrics() {\n+    super.didChangeMetrics();\n+    deactivateOverlay();\n+    activateOverlay();\n+  }\n+\n+  /// Subclasses implement this method to create a platform view of the\n+  /// specified [physicalSize] (in device pixels).\n+  ///\n+  /// The view should remain hidden.\n+  @protected\n+  Future<int> createOverlay(Size physicalSize);","path":"packages/google_mobile_maps/lib/platform_overlay.dart","position":199,"original_position":199,"commit_id":"181597397c40bcf2d352fca3ba86281348ac38d4","original_commit_id":"181597397c40bcf2d352fca3ba86281348ac38d4","user":{"login":"sigurdm","id":8613953,"avatar_url":"https://avatars1.githubusercontent.com/u/8613953?v=4","gravatar_id":"","url":"https://api.github.com/users/sigurdm","html_url":"https://github.com/sigurdm","followers_url":"https://api.github.com/users/sigurdm/followers","following_url":"https://api.github.com/users/sigurdm/following{/other_user}","gists_url":"https://api.github.com/users/sigurdm/gists{/gist_id}","starred_url":"https://api.github.com/users/sigurdm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sigurdm/subscriptions","organizations_url":"https://api.github.com/users/sigurdm/orgs","repos_url":"https://api.github.com/users/sigurdm/repos","events_url":"https://api.github.com/users/sigurdm/events{/privacy}","received_events_url":"https://api.github.com/users/sigurdm/received_events","type":"User","site_admin":false},"body":"Perhaps move these to a delegate","created_at":"2018-03-05T10:33:14Z","updated_at":"2018-03-05T10:43:32Z","html_url":"https://github.com/flutter/plugins/pull/405#discussion_r172144469","pull_request_url":"https://api.github.com/repos/flutter/plugins/pulls/405","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/flutter/plugins/pulls/comments/172144469"},"html":{"href":"https://github.com/flutter/plugins/pull/405#discussion_r172144469"},"pull_request":{"href":"https://api.github.com/repos/flutter/plugins/pulls/405"}}},"pull_request":{"url":"https://api.github.com/repos/flutter/plugins/pulls/405","id":172511965,"html_url":"https://github.com/flutter/plugins/pull/405","diff_url":"https://github.com/flutter/plugins/pull/405.diff","patch_url":"https://github.com/flutter/plugins/pull/405.patch","issue_url":"https://api.github.com/repos/flutter/plugins/issues/405","number":405,"state":"open","locked":false,"title":"Google maps plugin stub","user":{"login":"mravn-google","id":22935389,"avatar_url":"https://avatars0.githubusercontent.com/u/22935389?v=4","gravatar_id":"","url":"https://api.github.com/users/mravn-google","html_url":"https://github.com/mravn-google","followers_url":"https://api.github.com/users/mravn-google/followers","following_url":"https://api.github.com/users/mravn-google/following{/other_user}","gists_url":"https://api.github.com/users/mravn-google/gists{/gist_id}","starred_url":"https://api.github.com/users/mravn-google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mravn-google/subscriptions","organizations_url":"https://api.github.com/users/mravn-google/orgs","repos_url":"https://api.github.com/users/mravn-google/repos","events_url":"https://api.github.com/users/mravn-google/events{/privacy}","received_events_url":"https://api.github.com/users/mravn-google/received_events","type":"User","site_admin":false},"body":"This is a stub implementation, and is not ready for publication yet.\r\n* Minimal API to the GoogleMaps instance.\r\n* Limited help in working with platform overlays.\r\n* iOS not supported yet.","created_at":"2018-03-02T14:11:06Z","updated_at":"2018-03-05T10:43:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b3f3aad24cc663db3a68044d7fc8b76716f69588","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":616170846,"url":"https://api.github.com/repos/flutter/plugins/labels/cla:%20yes","name":"cla: yes","color":"FFFFFF","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/flutter/plugins/pulls/405/commits","review_comments_url":"https://api.github.com/repos/flutter/plugins/pulls/405/comments","review_comment_url":"https://api.github.com/repos/flutter/plugins/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flutter/plugins/issues/405/comments","statuses_url":"https://api.github.com/repos/flutter/plugins/statuses/181597397c40bcf2d352fca3ba86281348ac38d4","head":{"label":"mravn-google:google_maps","ref":"google_maps","sha":"181597397c40bcf2d352fca3ba86281348ac38d4","user":{"login":"mravn-google","id":22935389,"avatar_url":"https://avatars0.githubusercontent.com/u/22935389?v=4","gravatar_id":"","url":"https://api.github.com/users/mravn-google","html_url":"https://github.com/mravn-google","followers_url":"https://api.github.com/users/mravn-google/followers","following_url":"https://api.github.com/users/mravn-google/following{/other_user}","gists_url":"https://api.github.com/users/mravn-google/gists{/gist_id}","starred_url":"https://api.github.com/users/mravn-google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mravn-google/subscriptions","organizations_url":"https://api.github.com/users/mravn-google/orgs","repos_url":"https://api.github.com/users/mravn-google/repos","events_url":"https://api.github.com/users/mravn-google/events{/privacy}","received_events_url":"https://api.github.com/users/mravn-google/received_events","type":"User","site_admin":false},"repo":{"id":98638562,"name":"plugins","full_name":"mravn-google/plugins","owner":{"login":"mravn-google","id":22935389,"avatar_url":"https://avatars0.githubusercontent.com/u/22935389?v=4","gravatar_id":"","url":"https://api.github.com/users/mravn-google","html_url":"https://github.com/mravn-google","followers_url":"https://api.github.com/users/mravn-google/followers","following_url":"https://api.github.com/users/mravn-google/following{/other_user}","gists_url":"https://api.github.com/users/mravn-google/gists{/gist_id}","starred_url":"https://api.github.com/users/mravn-google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mravn-google/subscriptions","organizations_url":"https://api.github.com/users/mravn-google/orgs","repos_url":"https://api.github.com/users/mravn-google/repos","events_url":"https://api.github.com/users/mravn-google/events{/privacy}","received_events_url":"https://api.github.com/users/mravn-google/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mravn-google/plugins","description":"Plugins for Flutter maintained by the Flutter team","fork":true,"url":"https://api.github.com/repos/mravn-google/plugins","forks_url":"https://api.github.com/repos/mravn-google/plugins/forks","keys_url":"https://api.github.com/repos/mravn-google/plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mravn-google/plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mravn-google/plugins/teams","hooks_url":"https://api.github.com/repos/mravn-google/plugins/hooks","issue_events_url":"https://api.github.com/repos/mravn-google/plugins/issues/events{/number}","events_url":"https://api.github.com/repos/mravn-google/plugins/events","assignees_url":"https://api.github.com/repos/mravn-google/plugins/assignees{/user}","branches_url":"https://api.github.com/repos/mravn-google/plugins/branches{/branch}","tags_url":"https://api.github.com/repos/mravn-google/plugins/tags","blobs_url":"https://api.github.com/repos/mravn-google/plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mravn-google/plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mravn-google/plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/mravn-google/plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mravn-google/plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/mravn-google/plugins/languages","stargazers_url":"https://api.github.com/repos/mravn-google/plugins/stargazers","contributors_url":"https://api.github.com/repos/mravn-google/plugins/contributors","subscribers_url":"https://api.github.com/repos/mravn-google/plugins/subscribers","subscription_url":"https://api.github.com/repos/mravn-google/plugins/subscription","commits_url":"https://api.github.com/repos/mravn-google/plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/mravn-google/plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/mravn-google/plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/mravn-google/plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/mravn-google/plugins/contents/{+path}","compare_url":"https://api.github.com/repos/mravn-google/plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mravn-google/plugins/merges","archive_url":"https://api.github.com/repos/mravn-google/plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mravn-google/plugins/downloads","issues_url":"https://api.github.com/repos/mravn-google/plugins/issues{/number}","pulls_url":"https://api.github.com/repos/mravn-google/plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/mravn-google/plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/mravn-google/plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mravn-google/plugins/labels{/name}","releases_url":"https://api.github.com/repos/mravn-google/plugins/releases{/id}","deployments_url":"https://api.github.com/repos/mravn-google/plugins/deployments","created_at":"2017-07-28T10:23:56Z","updated_at":"2017-07-28T10:23:58Z","pushed_at":"2018-03-04T15:19:35Z","git_url":"git://github.com/mravn-google/plugins.git","ssh_url":"git@github.com:mravn-google/plugins.git","clone_url":"https://github.com/mravn-google/plugins.git","svn_url":"https://github.com/mravn-google/plugins","homepage":"http://flutter.io/","size":7294,"stargazers_count":0,"watchers_count":0,"language":"Dart","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"flutter:master","ref":"master","sha":"61bd006842c0adf2c09cb2b5c5a2bf6f80b04764","user":{"login":"flutter","id":14101776,"avatar_url":"https://avatars3.githubusercontent.com/u/14101776?v=4","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":88650014,"name":"plugins","full_name":"flutter/plugins","owner":{"login":"flutter","id":14101776,"avatar_url":"https://avatars3.githubusercontent.com/u/14101776?v=4","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/plugins","description":"Plugins for Flutter, including FlutterFire, maintained by the Flutter team","fork":false,"url":"https://api.github.com/repos/flutter/plugins","forks_url":"https://api.github.com/repos/flutter/plugins/forks","keys_url":"https://api.github.com/repos/flutter/plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flutter/plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flutter/plugins/teams","hooks_url":"https://api.github.com/repos/flutter/plugins/hooks","issue_events_url":"https://api.github.com/repos/flutter/plugins/issues/events{/number}","events_url":"https://api.github.com/repos/flutter/plugins/events","assignees_url":"https://api.github.com/repos/flutter/plugins/assignees{/user}","branches_url":"https://api.github.com/repos/flutter/plugins/branches{/branch}","tags_url":"https://api.github.com/repos/flutter/plugins/tags","blobs_url":"https://api.github.com/repos/flutter/plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flutter/plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flutter/plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/flutter/plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flutter/plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/flutter/plugins/languages","stargazers_url":"https://api.github.com/repos/flutter/plugins/stargazers","contributors_url":"https://api.github.com/repos/flutter/plugins/contributors","subscribers_url":"https://api.github.com/repos/flutter/plugins/subscribers","subscription_url":"https://api.github.com/repos/flutter/plugins/subscription","commits_url":"https://api.github.com/repos/flutter/plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/flutter/plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/flutter/plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/flutter/plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/flutter/plugins/contents/{+path}","compare_url":"https://api.github.com/repos/flutter/plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flutter/plugins/merges","archive_url":"https://api.github.com/repos/flutter/plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flutter/plugins/downloads","issues_url":"https://api.github.com/repos/flutter/plugins/issues{/number}","pulls_url":"https://api.github.com/repos/flutter/plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/flutter/plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/flutter/plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flutter/plugins/labels{/name}","releases_url":"https://api.github.com/repos/flutter/plugins/releases{/id}","deployments_url":"https://api.github.com/repos/flutter/plugins/deployments","created_at":"2017-04-18T17:02:37Z","updated_at":"2018-03-05T10:24:42Z","pushed_at":"2018-03-05T04:38:16Z","git_url":"git://github.com/flutter/plugins.git","ssh_url":"git@github.com:flutter/plugins.git","clone_url":"https://github.com/flutter/plugins.git","svn_url":"https://github.com/flutter/plugins","homepage":"https://flutter.io/","size":7208,"stargazers_count":353,"watchers_count":353,"language":"Dart","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":171,"mirror_url":null,"archived":false,"open_issues_count":14,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":171,"open_issues":14,"watchers":353,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flutter/plugins/pulls/405"},"html":{"href":"https://github.com/flutter/plugins/pull/405"},"issue":{"href":"https://api.github.com/repos/flutter/plugins/issues/405"},"comments":{"href":"https://api.github.com/repos/flutter/plugins/issues/405/comments"},"review_comments":{"href":"https://api.github.com/repos/flutter/plugins/pulls/405/comments"},"review_comment":{"href":"https://api.github.com/repos/flutter/plugins/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flutter/plugins/pulls/405/commits"},"statuses":{"href":"https://api.github.com/repos/flutter/plugins/statuses/181597397c40bcf2d352fca3ba86281348ac38d4"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sigurdm"}}