Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: sky/sdk/example/demo_launcher/lib/main.dart

Issue 1218293017: Deploy TaskDescription to the rest of our demos (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sky/sdk/example/mine_digger/lib/main.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'dart:sky'; 5 import 'dart:sky';
6 6
7 import 'package:mojom/intents/intents.mojom.dart';
8 import 'package:sky/mojo/activity.dart' as activity; 7 import 'package:sky/mojo/activity.dart' as activity;
9 import 'package:sky/mojo/asset_bundle.dart'; 8 import 'package:sky/mojo/asset_bundle.dart';
10 import 'package:sky/mojo/shell.dart' as shell; 9 import 'package:sky/mojo/shell.dart' as shell;
11 import 'package:sky/painting/box_painter.dart'; 10 import 'package:sky/painting/box_painter.dart';
12 import 'package:sky/theme/colors.dart' as colors; 11 import 'package:sky/theme/colors.dart' as colors;
13 import 'package:sky/theme/typography.dart' as typography; 12 import 'package:sky/theme/typography.dart' as typography;
14 import 'package:sky/widgets/basic.dart'; 13 import 'package:sky/widgets/basic.dart';
15 import 'package:sky/widgets/card.dart'; 14 import 'package:sky/widgets/card.dart';
16 import 'package:sky/widgets/fixed_height_scrollable.dart'; 15 import 'package:sky/widgets/fixed_height_scrollable.dart';
17 import 'package:sky/widgets/flat_button.dart'; 16 import 'package:sky/widgets/flat_button.dart';
18 import 'package:sky/widgets/material.dart'; 17 import 'package:sky/widgets/material.dart';
19 import 'package:sky/widgets/scaffold.dart'; 18 import 'package:sky/widgets/scaffold.dart';
19 import 'package:sky/widgets/task_description.dart';
20 import 'package:sky/widgets/theme.dart'; 20 import 'package:sky/widgets/theme.dart';
21 import 'package:sky/widgets/tool_bar.dart'; 21 import 'package:sky/widgets/tool_bar.dart';
22 22
23 AssetBundle _initBundle() { 23 AssetBundle _initBundle() {
24 if (rootBundle != null) 24 if (rootBundle != null)
25 return rootBundle; 25 return rootBundle;
26 const String _kAssetBase = '..'; 26 const String _kAssetBase = '..';
27 return new NetworkAssetBundle(Uri.base.resolve(_kAssetBase)); 27 return new NetworkAssetBundle(Uri.base.resolve(_kAssetBase));
28 } 28 }
29 29
30 final AssetBundle _bundle = _initBundle(); 30 final AssetBundle _bundle = _initBundle();
31 31
32 void launch(String relativeUrl, String bundle) { 32 void launch(String relativeUrl, String bundle) {
33 Uri url = Uri.base.resolve(relativeUrl); 33 Uri url = Uri.base.resolve(relativeUrl);
34 34
35 ActivityManagerProxy activityManager = new ActivityManagerProxy.unbound(); 35 activity.ComponentName component = new activity.ComponentName()
36 ComponentName component = new ComponentName()
37 ..packageName = 'org.domokit.sky.demo' 36 ..packageName = 'org.domokit.sky.demo'
38 ..className = 'org.domokit.sky.demo.SkyDemoActivity'; 37 ..className = 'org.domokit.sky.demo.SkyDemoActivity';
39 Intent intent = new Intent() 38 activity.Intent intent = new activity.Intent()
40 ..action = 'android.intent.action.VIEW' 39 ..action = 'android.intent.action.VIEW'
41 ..component = component 40 ..component = component
42 ..flags = activity.MULTIPLE_TASK | activity.NEW_DOCUMENT 41 ..flags = activity.MULTIPLE_TASK | activity.NEW_DOCUMENT
43 ..url = url.toString(); 42 ..url = url.toString();
44 43
45 if (bundle != null) { 44 if (bundle != null) {
46 StringExtra extra = new StringExtra() 45 activity.StringExtra extra = new activity.StringExtra()
47 ..name = 'bundleName' 46 ..name = 'bundleName'
48 ..value = bundle; 47 ..value = bundle;
49 intent.stringExtras = [extra]; 48 intent.stringExtras = [extra];
50 } 49 }
51 50
52 activity.startActivity(intent); 51 activity.startActivity(intent);
53 } 52 }
54 53
55 class SkyDemo { 54 class SkyDemo {
56 String name; 55 String name;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 171 }
173 } 172 }
174 173
175 class SkyHome extends App { 174 class SkyHome extends App {
176 Widget build() { 175 Widget build() {
177 return new Theme( 176 return new Theme(
178 data: new ThemeData( 177 data: new ThemeData(
179 brightness: ThemeBrightness.dark, 178 brightness: ThemeBrightness.dark,
180 primarySwatch: colors.Teal 179 primarySwatch: colors.Teal
181 ), 180 ),
182 child: new Scaffold( 181 child: new TaskDescription(
183 toolbar: new ToolBar(center: new Text('Sky Demos')), 182 label: 'Sky Demos',
184 body: new Material( 183 child: new Scaffold(
185 type: MaterialType.canvas, 184 toolbar: new ToolBar(center: new Text('Sky Demos')),
186 child: new DemoList() 185 body: new Material(
186 type: MaterialType.canvas,
187 child: new DemoList()
188 )
187 ) 189 )
188 ) 190 )
189 ); 191 );
190 } 192 }
191 } 193 }
192 194
193 void main() { 195 void main() {
194 runApp(new SkyHome()); 196 runApp(new SkyHome());
195 } 197 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/example/mine_digger/lib/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698