{"action":"created","comment":{"url":"https://api.github.com/repos/flutter/flutter/pulls/comments/52645261","id":52645261,"diff_hunk":"@@ -0,0 +1,486 @@\n+// Copyright 2015 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:math' as math;\n+import 'dart:ui' as ui;\n+import 'package:flutter/material.dart';\n+import 'package:flutter/services.dart';\n+import 'package:flutter_sprites/flutter_sprites.dart';\n+\n+ImageMap _images;\n+SpriteSheet _sprites;\n+\n+class FitnessDemo extends StatefulComponent {\n+  FitnessDemo({ Key key }) : super(key: key);\n+  _FitnessDemoState createState() => new _FitnessDemoState();\n+}\n+\n+class _FitnessDemoState extends State<FitnessDemo> {\n+\n+  Future _loadAssets(AssetBundle bundle) async {\n+    _images = new ImageMap(bundle);\n+    await _images.load(<String>[\n+      'packages/flutter_gallery_assets/jumpingjack.png',\n+    ]);\n+\n+    String json = await DefaultAssetBundle.of(context).loadString('packages/flutter_gallery_assets/jumpingjack.json');\n+    _sprites = new SpriteSheet(_images['packages/flutter_gallery_assets/jumpingjack.png'], json);\n+  }\n+\n+  void initState() {\n+    super.initState();\n+\n+    AssetBundle bundle = DefaultAssetBundle.of(context);\n+    _loadAssets(bundle).then((_) {\n+      setState(() {\n+        assetsLoaded = true;\n+        workoutAnimation = new _WorkoutAnimationNode(onValueUpdate: (){\n+          setState((){});\n+        });\n+      });\n+    });\n+  }\n+\n+  bool assetsLoaded = false;\n+  _WorkoutAnimationNode workoutAnimation;\n+\n+  Widget build(BuildContext context) {\n+    if (!assetsLoaded) {\n+      return new Scaffold(\n+        toolBar: new ToolBar(\n+          center: new Text(\"Fitness\")\n+        )\n+      );\n+    }\n+\n+    return new Scaffold(\n+      toolBar: new ToolBar(\n+        center: new Text(\"Fitness\")\n+      ),\n+      body: new Material(\n+        child: new Column(\n+          justifyContent: FlexJustifyContent.center,\n+          children: <Widget>[\n+            _createWorkoutAnimation(),\n+            _createWorkoutText(),\n+            _createInfoPanel(),\n+            _createWorkoutButton()\n+          ]\n+        )\n+      )\n+    );\n+  }\n+\n+  Widget _createWorkoutAnimation() {\n+    return new Flexible(\n+      child: new Container(\n+        decoration: new BoxDecoration(backgroundColor: Colors.grey[800]),\n+        child: new SpriteWidget(workoutAnimation, SpriteBoxTransformMode.scaleToFit)\n+      )\n+    );\n+  }\n+\n+  Widget _createWorkoutText() {\n+    return new Padding(\n+      padding: new EdgeDims.only(top: 20.0),\n+      child: new Text(\"JUMPING JACKS\", style: Theme.of(context).text.title)\n+    );\n+  }\n+\n+  Widget _createInfoPanel() {\n+    return new Padding(\n+      padding: new EdgeDims.only(top: 20.0, bottom: 20.0),\n+      child: new Row(\n+        justifyContent: FlexJustifyContent.center,\n+        children: <Widget>[\n+          _createInfoPanelCell(\"action/accessibility\", \"${workoutAnimation.count}\", \"COUNT\"),\n+          _createInfoPanelCell(\"image/timer\", _formatSeconds(workoutAnimation.seconds), \"TIME\"),\n+          _createInfoPanelCell(\"image/flash_on\", \"${workoutAnimation.kcal}\", \"KCAL\")\n+        ]\n+      )\n+    );\n+  }\n+\n+  Widget _createInfoPanelCell(String icon, String value, String description) {\n+    Color color;\n+    if (workoutAnimation.workingOut)\n+      color = Colors.black87;\n+    else\n+      color = Theme.of(context).disabledColor;\n+\n+    return new Container(\n+      width: 100.0,\n+      child: new Center(\n+        child: new Column(\n+          children: <Widget>[\n+            new Icon(icon: icon, size: IconSize.s48, color: color),\n+            new Text(value, style: new TextStyle(fontSize: 24.0, color: color)),\n+            new Text(description, style: new TextStyle(color: color))\n+          ]\n+        )\n+      )\n+    );\n+  }\n+\n+  Widget _createWorkoutButton() {\n+    Color color;\n+    String text;\n+    VoidCallback onPressed;\n+\n+    if (workoutAnimation.workingOut) {\n+      color = Colors.red[500];\n+      text = \"STOP WORKOUT\";\n+      onPressed = endWorkout;\n+    } else {\n+      color = Theme.of(context).primaryColor;\n+      text = \"START WORKOUT\";\n+      onPressed = startWorkout;\n+    }\n+\n+    return new Padding(\n+      padding: new EdgeDims.only(bottom: 10.0),\n+      child: new SizedBox(\n+        width: 300.0,\n+        height: 72.0,\n+        child: new RaisedButton (\n+          onPressed: onPressed,\n+          color: color,\n+          child: new Text(\n+            text,\n+            style: new TextStyle(color: Colors.white, fontSize: 18.0)","path":"examples/material_gallery/lib/demo/fitness_demo.dart","position":152,"original_position":152,"commit_id":"f1aa1a07fef8baf5afaae1d1d3b29542ffe0590b","original_commit_id":"f1aa1a07fef8baf5afaae1d1d3b29542ffe0590b","user":{"login":"vlidholt","id":1539812,"avatar_url":"https://avatars.githubusercontent.com/u/1539812?v=3","gravatar_id":"","url":"https://api.github.com/users/vlidholt","html_url":"https://github.com/vlidholt","followers_url":"https://api.github.com/users/vlidholt/followers","following_url":"https://api.github.com/users/vlidholt/following{/other_user}","gists_url":"https://api.github.com/users/vlidholt/gists{/gist_id}","starred_url":"https://api.github.com/users/vlidholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlidholt/subscriptions","organizations_url":"https://api.github.com/users/vlidholt/orgs","repos_url":"https://api.github.com/users/vlidholt/repos","events_url":"https://api.github.com/users/vlidholt/events{/privacy}","received_events_url":"https://api.github.com/users/vlidholt/received_events","type":"User","site_admin":false},"body":"Well, that currently doesn't happen. Will file a bug and leave this in the code for now","created_at":"2016-02-11T18:34:18Z","updated_at":"2016-02-11T18:34:18Z","html_url":"https://github.com/flutter/flutter/pull/1777#discussion_r52645261","pull_request_url":"https://api.github.com/repos/flutter/flutter/pulls/1777","_links":{"self":{"href":"https://api.github.com/repos/flutter/flutter/pulls/comments/52645261"},"html":{"href":"https://github.com/flutter/flutter/pull/1777#discussion_r52645261"},"pull_request":{"href":"https://api.github.com/repos/flutter/flutter/pulls/1777"}}},"pull_request":{"url":"https://api.github.com/repos/flutter/flutter/pulls/1777","id":59070179,"html_url":"https://github.com/flutter/flutter/pull/1777","diff_url":"https://github.com/flutter/flutter/pull/1777.diff","patch_url":"https://github.com/flutter/flutter/pull/1777.patch","issue_url":"https://api.github.com/repos/flutter/flutter/issues/1777","number":1777,"state":"open","locked":false,"title":"Fitness demo, initial version","user":{"login":"vlidholt","id":1539812,"avatar_url":"https://avatars.githubusercontent.com/u/1539812?v=3","gravatar_id":"","url":"https://api.github.com/users/vlidholt","html_url":"https://github.com/vlidholt","followers_url":"https://api.github.com/users/vlidholt/followers","following_url":"https://api.github.com/users/vlidholt/following{/other_user}","gists_url":"https://api.github.com/users/vlidholt/gists{/gist_id}","starred_url":"https://api.github.com/users/vlidholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlidholt/subscriptions","organizations_url":"https://api.github.com/users/vlidholt/orgs","repos_url":"https://api.github.com/users/vlidholt/repos","events_url":"https://api.github.com/users/vlidholt/events{/privacy}","received_events_url":"https://api.github.com/users/vlidholt/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-11T18:06:33Z","updated_at":"2016-02-11T18:34:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"28292d9c6cd1fd14fe5cdf67c48b32cefd4c637a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/flutter/flutter/pulls/1777/commits","review_comments_url":"https://api.github.com/repos/flutter/flutter/pulls/1777/comments","review_comment_url":"https://api.github.com/repos/flutter/flutter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flutter/flutter/issues/1777/comments","statuses_url":"https://api.github.com/repos/flutter/flutter/statuses/f1aa1a07fef8baf5afaae1d1d3b29542ffe0590b","head":{"label":"vlidholt:master","ref":"master","sha":"f1aa1a07fef8baf5afaae1d1d3b29542ffe0590b","user":{"login":"vlidholt","id":1539812,"avatar_url":"https://avatars.githubusercontent.com/u/1539812?v=3","gravatar_id":"","url":"https://api.github.com/users/vlidholt","html_url":"https://github.com/vlidholt","followers_url":"https://api.github.com/users/vlidholt/followers","following_url":"https://api.github.com/users/vlidholt/following{/other_user}","gists_url":"https://api.github.com/users/vlidholt/gists{/gist_id}","starred_url":"https://api.github.com/users/vlidholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlidholt/subscriptions","organizations_url":"https://api.github.com/users/vlidholt/orgs","repos_url":"https://api.github.com/users/vlidholt/repos","events_url":"https://api.github.com/users/vlidholt/events{/privacy}","received_events_url":"https://api.github.com/users/vlidholt/received_events","type":"User","site_admin":false},"repo":{"id":46521777,"name":"flutter","full_name":"vlidholt/flutter","owner":{"login":"vlidholt","id":1539812,"avatar_url":"https://avatars.githubusercontent.com/u/1539812?v=3","gravatar_id":"","url":"https://api.github.com/users/vlidholt","html_url":"https://github.com/vlidholt","followers_url":"https://api.github.com/users/vlidholt/followers","following_url":"https://api.github.com/users/vlidholt/following{/other_user}","gists_url":"https://api.github.com/users/vlidholt/gists{/gist_id}","starred_url":"https://api.github.com/users/vlidholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlidholt/subscriptions","organizations_url":"https://api.github.com/users/vlidholt/orgs","repos_url":"https://api.github.com/users/vlidholt/repos","events_url":"https://api.github.com/users/vlidholt/events{/privacy}","received_events_url":"https://api.github.com/users/vlidholt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vlidholt/flutter","description":"The Flutter framework","fork":true,"url":"https://api.github.com/repos/vlidholt/flutter","forks_url":"https://api.github.com/repos/vlidholt/flutter/forks","keys_url":"https://api.github.com/repos/vlidholt/flutter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vlidholt/flutter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vlidholt/flutter/teams","hooks_url":"https://api.github.com/repos/vlidholt/flutter/hooks","issue_events_url":"https://api.github.com/repos/vlidholt/flutter/issues/events{/number}","events_url":"https://api.github.com/repos/vlidholt/flutter/events","assignees_url":"https://api.github.com/repos/vlidholt/flutter/assignees{/user}","branches_url":"https://api.github.com/repos/vlidholt/flutter/branches{/branch}","tags_url":"https://api.github.com/repos/vlidholt/flutter/tags","blobs_url":"https://api.github.com/repos/vlidholt/flutter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vlidholt/flutter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vlidholt/flutter/git/refs{/sha}","trees_url":"https://api.github.com/repos/vlidholt/flutter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vlidholt/flutter/statuses/{sha}","languages_url":"https://api.github.com/repos/vlidholt/flutter/languages","stargazers_url":"https://api.github.com/repos/vlidholt/flutter/stargazers","contributors_url":"https://api.github.com/repos/vlidholt/flutter/contributors","subscribers_url":"https://api.github.com/repos/vlidholt/flutter/subscribers","subscription_url":"https://api.github.com/repos/vlidholt/flutter/subscription","commits_url":"https://api.github.com/repos/vlidholt/flutter/commits{/sha}","git_commits_url":"https://api.github.com/repos/vlidholt/flutter/git/commits{/sha}","comments_url":"https://api.github.com/repos/vlidholt/flutter/comments{/number}","issue_comment_url":"https://api.github.com/repos/vlidholt/flutter/issues/comments{/number}","contents_url":"https://api.github.com/repos/vlidholt/flutter/contents/{+path}","compare_url":"https://api.github.com/repos/vlidholt/flutter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vlidholt/flutter/merges","archive_url":"https://api.github.com/repos/vlidholt/flutter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vlidholt/flutter/downloads","issues_url":"https://api.github.com/repos/vlidholt/flutter/issues{/number}","pulls_url":"https://api.github.com/repos/vlidholt/flutter/pulls{/number}","milestones_url":"https://api.github.com/repos/vlidholt/flutter/milestones{/number}","notifications_url":"https://api.github.com/repos/vlidholt/flutter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vlidholt/flutter/labels{/name}","releases_url":"https://api.github.com/repos/vlidholt/flutter/releases{/id}","deployments_url":"https://api.github.com/repos/vlidholt/flutter/deployments","created_at":"2015-11-19T21:35:17Z","updated_at":"2016-01-29T22:35:25Z","pushed_at":"2016-02-11T18:05:07Z","git_url":"git://github.com/vlidholt/flutter.git","ssh_url":"git@github.com:vlidholt/flutter.git","clone_url":"https://github.com/vlidholt/flutter.git","svn_url":"https://github.com/vlidholt/flutter","homepage":"http://flutter.io","size":12543,"stargazers_count":0,"watchers_count":0,"language":"Dart","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":"abce29f118cc01e4d2ebd98a6ca8b250184e5f7d","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":31792824,"name":"flutter","full_name":"flutter/flutter","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/flutter","description":"Framework for building high-performance, high-fidelity iOS and Android apps","fork":false,"url":"https://api.github.com/repos/flutter/flutter","forks_url":"https://api.github.com/repos/flutter/flutter/forks","keys_url":"https://api.github.com/repos/flutter/flutter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flutter/flutter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flutter/flutter/teams","hooks_url":"https://api.github.com/repos/flutter/flutter/hooks","issue_events_url":"https://api.github.com/repos/flutter/flutter/issues/events{/number}","events_url":"https://api.github.com/repos/flutter/flutter/events","assignees_url":"https://api.github.com/repos/flutter/flutter/assignees{/user}","branches_url":"https://api.github.com/repos/flutter/flutter/branches{/branch}","tags_url":"https://api.github.com/repos/flutter/flutter/tags","blobs_url":"https://api.github.com/repos/flutter/flutter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flutter/flutter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flutter/flutter/git/refs{/sha}","trees_url":"https://api.github.com/repos/flutter/flutter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flutter/flutter/statuses/{sha}","languages_url":"https://api.github.com/repos/flutter/flutter/languages","stargazers_url":"https://api.github.com/repos/flutter/flutter/stargazers","contributors_url":"https://api.github.com/repos/flutter/flutter/contributors","subscribers_url":"https://api.github.com/repos/flutter/flutter/subscribers","subscription_url":"https://api.github.com/repos/flutter/flutter/subscription","commits_url":"https://api.github.com/repos/flutter/flutter/commits{/sha}","git_commits_url":"https://api.github.com/repos/flutter/flutter/git/commits{/sha}","comments_url":"https://api.github.com/repos/flutter/flutter/comments{/number}","issue_comment_url":"https://api.github.com/repos/flutter/flutter/issues/comments{/number}","contents_url":"https://api.github.com/repos/flutter/flutter/contents/{+path}","compare_url":"https://api.github.com/repos/flutter/flutter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flutter/flutter/merges","archive_url":"https://api.github.com/repos/flutter/flutter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flutter/flutter/downloads","issues_url":"https://api.github.com/repos/flutter/flutter/issues{/number}","pulls_url":"https://api.github.com/repos/flutter/flutter/pulls{/number}","milestones_url":"https://api.github.com/repos/flutter/flutter/milestones{/number}","notifications_url":"https://api.github.com/repos/flutter/flutter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flutter/flutter/labels{/name}","releases_url":"https://api.github.com/repos/flutter/flutter/releases{/id}","deployments_url":"https://api.github.com/repos/flutter/flutter/deployments","created_at":"2015-03-06T22:54:58Z","updated_at":"2016-02-11T18:16:24Z","pushed_at":"2016-02-11T18:21:28Z","git_url":"git://github.com/flutter/flutter.git","ssh_url":"git@github.com:flutter/flutter.git","clone_url":"https://github.com/flutter/flutter.git","svn_url":"https://github.com/flutter/flutter","homepage":"http://flutter.io","size":104985,"stargazers_count":2612,"watchers_count":2612,"language":"Dart","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":253,"mirror_url":null,"open_issues_count":567,"forks":253,"open_issues":567,"watchers":2612,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flutter/flutter/pulls/1777"},"html":{"href":"https://github.com/flutter/flutter/pull/1777"},"issue":{"href":"https://api.github.com/repos/flutter/flutter/issues/1777"},"comments":{"href":"https://api.github.com/repos/flutter/flutter/issues/1777/comments"},"review_comments":{"href":"https://api.github.com/repos/flutter/flutter/pulls/1777/comments"},"review_comment":{"href":"https://api.github.com/repos/flutter/flutter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flutter/flutter/pulls/1777/commits"},"statuses":{"href":"https://api.github.com/repos/flutter/flutter/statuses/f1aa1a07fef8baf5afaae1d1d3b29542ffe0590b"}}}}