提交 589290ad 编写于 作者: E Eric Seidel

Deploy TaskDescription to the rest of our demos

R=abarth@chromium.org, abarth@google.com

Review URL: https://codereview.chromium.org/1218293017 .
上级 3f3b07ac
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import 'dart:sky'; import 'dart:sky';
import 'package:mojom/intents/intents.mojom.dart';
import 'package:sky/mojo/activity.dart' as activity; import 'package:sky/mojo/activity.dart' as activity;
import 'package:sky/mojo/asset_bundle.dart'; import 'package:sky/mojo/asset_bundle.dart';
import 'package:sky/mojo/shell.dart' as shell; import 'package:sky/mojo/shell.dart' as shell;
...@@ -17,6 +16,7 @@ import 'package:sky/widgets/fixed_height_scrollable.dart'; ...@@ -17,6 +16,7 @@ import 'package:sky/widgets/fixed_height_scrollable.dart';
import 'package:sky/widgets/flat_button.dart'; import 'package:sky/widgets/flat_button.dart';
import 'package:sky/widgets/material.dart'; import 'package:sky/widgets/material.dart';
import 'package:sky/widgets/scaffold.dart'; import 'package:sky/widgets/scaffold.dart';
import 'package:sky/widgets/task_description.dart';
import 'package:sky/widgets/theme.dart'; import 'package:sky/widgets/theme.dart';
import 'package:sky/widgets/tool_bar.dart'; import 'package:sky/widgets/tool_bar.dart';
...@@ -32,18 +32,17 @@ final AssetBundle _bundle = _initBundle(); ...@@ -32,18 +32,17 @@ final AssetBundle _bundle = _initBundle();
void launch(String relativeUrl, String bundle) { void launch(String relativeUrl, String bundle) {
Uri url = Uri.base.resolve(relativeUrl); Uri url = Uri.base.resolve(relativeUrl);
ActivityManagerProxy activityManager = new ActivityManagerProxy.unbound(); activity.ComponentName component = new activity.ComponentName()
ComponentName component = new ComponentName()
..packageName = 'org.domokit.sky.demo' ..packageName = 'org.domokit.sky.demo'
..className = 'org.domokit.sky.demo.SkyDemoActivity'; ..className = 'org.domokit.sky.demo.SkyDemoActivity';
Intent intent = new Intent() activity.Intent intent = new activity.Intent()
..action = 'android.intent.action.VIEW' ..action = 'android.intent.action.VIEW'
..component = component ..component = component
..flags = activity.MULTIPLE_TASK | activity.NEW_DOCUMENT ..flags = activity.MULTIPLE_TASK | activity.NEW_DOCUMENT
..url = url.toString(); ..url = url.toString();
if (bundle != null) { if (bundle != null) {
StringExtra extra = new StringExtra() activity.StringExtra extra = new activity.StringExtra()
..name = 'bundleName' ..name = 'bundleName'
..value = bundle; ..value = bundle;
intent.stringExtras = [extra]; intent.stringExtras = [extra];
...@@ -179,11 +178,14 @@ class SkyHome extends App { ...@@ -179,11 +178,14 @@ class SkyHome extends App {
brightness: ThemeBrightness.dark, brightness: ThemeBrightness.dark,
primarySwatch: colors.Teal primarySwatch: colors.Teal
), ),
child: new Scaffold( child: new TaskDescription(
toolbar: new ToolBar(center: new Text('Sky Demos')), label: 'Sky Demos',
body: new Material( child: new Scaffold(
type: MaterialType.canvas, toolbar: new ToolBar(center: new Text('Sky Demos')),
child: new DemoList() body: new Material(
type: MaterialType.canvas,
child: new DemoList()
)
) )
) )
); );
......
...@@ -5,13 +5,14 @@ ...@@ -5,13 +5,14 @@
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'dart:math'; import 'dart:math';
import 'package:sky/painting/text_style.dart';
import 'package:sky/rendering/flex.dart'; import 'package:sky/rendering/flex.dart';
import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/widgets/basic.dart'; import 'package:sky/widgets/basic.dart';
import 'package:sky/widgets/scaffold.dart'; import 'package:sky/widgets/scaffold.dart';
import 'package:sky/widgets/tool_bar.dart'; import 'package:sky/widgets/task_description.dart';
import 'package:sky/widgets/theme.dart'; import 'package:sky/widgets/theme.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/widgets/tool_bar.dart';
import 'package:sky/painting/text_style.dart';
// Classic minesweeper-inspired game. The mouse controls are standard except // Classic minesweeper-inspired game. The mouse controls are standard except
// for left + right combo which is not implemented. For touch, the duration of // for left + right combo which is not implemented. For touch, the duration of
...@@ -174,11 +175,14 @@ class Game { ...@@ -174,11 +175,14 @@ class Game {
// FIXME: We need to build the board before we build the toolbar because // FIXME: We need to build the board before we build the toolbar because
// we compute the win state during build step. // we compute the win state during build step.
Widget board = buildBoard(); Widget board = buildBoard();
return new Scaffold( return new TaskDescription(
toolbar: buildToolBar(), label: 'Mine Digger',
body: new Container( child: new Scaffold(
child: new Center(child: board), toolbar: buildToolBar(),
decoration: new BoxDecoration(backgroundColor: colors.Grey[50]) body: new Container(
child: new Center(child: board),
decoration: new BoxDecoration(backgroundColor: colors.Grey[50])
)
) )
); );
} }
......
...@@ -75,7 +75,8 @@ void main() { ...@@ -75,7 +75,8 @@ void main() {
RenderFlex column = new RenderFlex(direction: FlexDirection.vertical); RenderFlex column = new RenderFlex(direction: FlexDirection.vertical);
// Top cell // Top cell
addFlexChildSolidColor(column, const Color(0xFF55DDCA), flex: 1); final Color topColor = const Color(0xFF55DDCA);
addFlexChildSolidColor(column, topColor, flex: 1);
// The internet is a beautiful place. https://baconipsum.com/ // The internet is a beautiful place. https://baconipsum.com/
String meatyString = """Bacon ipsum dolor amet ham fatback tri-tip, prosciutto String meatyString = """Bacon ipsum dolor amet ham fatback tri-tip, prosciutto
...@@ -102,6 +103,7 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin."""; ...@@ -102,6 +103,7 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin.""";
child: row child: row
); );
activity.updateTaskDescription('Interactive Flex', topColor);
new SkyBinding(root: root); new SkyBinding(root: root);
view.setEventCallback(handleEvent); view.setEventCallback(handleEvent);
} }
...@@ -11,6 +11,7 @@ import 'package:sky/widgets/basic.dart'; ...@@ -11,6 +11,7 @@ import 'package:sky/widgets/basic.dart';
import 'package:sky/widgets/material.dart'; import 'package:sky/widgets/material.dart';
import 'package:sky/widgets/raised_button.dart'; import 'package:sky/widgets/raised_button.dart';
import 'package:sky/widgets/scaffold.dart'; import 'package:sky/widgets/scaffold.dart';
import 'package:sky/widgets/task_description.dart';
import 'package:sky/widgets/theme.dart'; import 'package:sky/widgets/theme.dart';
import 'package:sky/widgets/tool_bar.dart'; import 'package:sky/widgets/tool_bar.dart';
import 'package:sky/widgets/widget.dart'; import 'package:sky/widgets/widget.dart';
...@@ -71,64 +72,72 @@ class SectorApp extends App { ...@@ -71,64 +72,72 @@ class SectorApp extends App {
}); });
} }
Widget build() { Widget buildBody() {
return new Theme( return new Material(
data: new ThemeData.light(), type: MaterialType.canvas,
child: new Scaffold( child: new Flex([
toolbar: new ToolBar( new Container(
center: new Text('Sector Layout in a Widget Tree')), padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
body: new Material( child: new Flex([
type: MaterialType.canvas, new RaisedButton(
child: new Flex([ enabled: enabledAdd,
new Container( child: new ShrinkWrapWidth(
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0), child: new Flex([
child: new Flex([ new Container(
new RaisedButton( padding: new EdgeDims.all(4.0),
enabled: enabledAdd, margin: new EdgeDims.only(right: 10.0),
child: new ShrinkWrapWidth( child: new WidgetToRenderBoxAdapter(sectorAddIcon)
child: new Flex([
new Container(
padding: new EdgeDims.all(4.0),
margin: new EdgeDims.only(right: 10.0),
child: new WidgetToRenderBoxAdapter(sectorAddIcon)
),
new Text('ADD SECTOR'),
])
), ),
onPressed: addSector new Text('ADD SECTOR'),
), ])
new RaisedButton( ),
enabled: enabledRemove, onPressed: addSector
child: new ShrinkWrapWidth( ),
child: new Flex([ new RaisedButton(
new Container( enabled: enabledRemove,
padding: new EdgeDims.all(4.0), child: new ShrinkWrapWidth(
margin: new EdgeDims.only(right: 10.0), child: new Flex([
child: new WidgetToRenderBoxAdapter(sectorRemoveIcon) new Container(
), padding: new EdgeDims.all(4.0),
new Text('REMOVE SECTOR'), margin: new EdgeDims.only(right: 10.0),
]) child: new WidgetToRenderBoxAdapter(sectorRemoveIcon)
), ),
onPressed: removeSector new Text('REMOVE SECTOR'),
) ])
],
justifyContent: FlexJustifyContent.spaceAround
)
),
new Flexible(
child: new Container(
margin: new EdgeDims.all(8.0),
decoration: new BoxDecoration(
border: new Border.all(new BorderSide(color: new Color(0xFF000000)))
), ),
padding: new EdgeDims.all(8.0), onPressed: removeSector
child: new WidgetToRenderBoxAdapter(sectors)
) )
],
justifyContent: FlexJustifyContent.spaceAround
)
),
new Flexible(
child: new Container(
margin: new EdgeDims.all(8.0),
decoration: new BoxDecoration(
border: new Border.all(new BorderSide(color: new Color(0xFF000000)))
), ),
], padding: new EdgeDims.all(8.0),
direction: FlexDirection.vertical, child: new WidgetToRenderBoxAdapter(sectors)
justifyContent: FlexJustifyContent.spaceBetween )
) ),
],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.spaceBetween
)
);
}
Widget build() {
return new Theme(
data: new ThemeData.light(),
child: new TaskDescription(
label: 'Sector Layout',
child: new Scaffold(
toolbar: new ToolBar(
center: new Text('Sector Layout in a Widget Tree')
),
body: buildBody()
) )
) )
); );
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'dart:sky'; import 'dart:sky';
import 'package:mojom/intents/intents.mojom.dart'; import 'package:mojom/intents/intents.mojom.dart';
import 'package:sky/mojo/shell.dart' as shell; import 'package:sky/mojo/shell.dart' as shell;
export 'package:mojom/intents/intents.mojom.dart' show Intent, ComponentName, StringExtra;
const int NEW_DOCUMENT = 0x00080000; const int NEW_DOCUMENT = 0x00080000;
const int NEW_TASK = 0x10000000; const int NEW_TASK = 0x10000000;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册