Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/flutter/engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Xia committed Oct 29, 2015
2 parents d1f7c8b + c3e03ba commit ea4e59f
Show file tree
Hide file tree
Showing 97 changed files with 1,846 additions and 905 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ Thumbs.db
/mojo/common/dart/packages
/sky/packages/**/packages
/sky/packages/sky_services/lib/
/sky/tools/pubspec_maintenance/packages/
/sky/tools/pubspec_maintenance/pubspec.lock
3 changes: 1 addition & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ hooks = [
'src/sky/tools/dart_pub_get.py',
'--repository-root', '../..',
'--dart-sdk-directory',
'../../third_party/dart-sdk/dart-sdk',
'--dirs-to-ignore', 'sky/packages/sky',
'../../third_party/dart-sdk/dart-sdk'
],
},
{
Expand Down
3 changes: 2 additions & 1 deletion examples/address_book/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: address_book
dependencies:
flutter: ">=0.0.3 <0.1.0"
flutter:
'0.0.15'
sky_tools: any
dependency_overrides:
material_design_icons:
Expand Down
3 changes: 2 additions & 1 deletion examples/fitness/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: fitness
dependencies:
flutter: ">=0.0.3 <0.1.0"
flutter:
'0.0.15'
playfair: ^0.0.10
path: ^1.3.6
sky_tools: any
Expand Down
6 changes: 4 additions & 2 deletions examples/game/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: asteroids
dependencies:
flutter: ">=0.0.3 <0.1.0"
flutter:
'0.0.15'
sky_tools: any
flutter_sprites: any
flutter_sprites:
'0.0.12'
box2d: any
dependency_overrides:
material_design_icons:
Expand Down
3 changes: 2 additions & 1 deletion examples/hello_world/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: hello_world
dependencies:
flutter: ">=0.0.3 <0.1.0"
flutter:
'0.0.15'
sky_tools: any
dependency_overrides:
material_design_icons:
Expand Down
3 changes: 2 additions & 1 deletion examples/mine_digger/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: mine_digger
dependencies:
flutter: ">=0.0.3 <0.1.0"
flutter:
'0.0.15'
sky_tools: any
dependency_overrides:
material_design_icons:
Expand Down
3 changes: 2 additions & 1 deletion examples/raw/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: sky_raw_examples
dependencies:
flutter: ">=0.0.3 <0.1.0"
flutter:
'0.0.15'
sky_tools: any
dependency_overrides:
material_design_icons:
Expand Down
3 changes: 2 additions & 1 deletion examples/rendering/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: flutter_rendering_examples
dependencies:
flutter: ">=0.0.3 <0.1.0"
flutter:
'0.0.15'
sky_tools: any
dependency_overrides:
material_design_icons:
Expand Down
3 changes: 2 additions & 1 deletion examples/stocks/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: stocks
dependencies:
flutter: ">=0.0.3 <0.1.0"
flutter:
'0.0.15'
sky_tools: any
dependency_overrides:
material_design_icons:
Expand Down
2 changes: 1 addition & 1 deletion examples/widgets/card_collection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class CardCollectionState extends State<CardCollection> {
)
: new DefaultTextStyle(
style: DefaultTextStyle.of(context).merge(cardLabelStyle).merge(_textStyle).copyWith(
fontSize: _varyFontSizes ? 5.0 + _cardModels.length.toDouble() : null
fontSize: _varyFontSizes ? _cardModels.length.toDouble() : null
),
child: new Column(<Widget>[
new Text(cardModel.label)
Expand Down
100 changes: 100 additions & 0 deletions examples/widgets/media_query.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import 'package:flutter/material.dart';

void main() {
runApp(
new MaterialApp(
title: "Media Query Example",
routes: <String, RouteBuilder>{
'/': (RouteArguments args) => new MediaQueryExample()
}
)
);
}

class AdaptiveItem {
AdaptiveItem(this.name);
String name;

Widget toListItem() {
return new Row(
<Widget>[
new Container(
width: 32.0,
height: 32.0,
margin: const EdgeDims.all(8.0),
decoration: new BoxDecoration(
backgroundColor: Colors.lightBlueAccent[100]
)
),
new Text(name)
]
);
}

Widget toCard() {
return new Card(
child: new Column(
<Widget>[
new Flexible(
child: new Container(
decoration: new BoxDecoration(
backgroundColor: Colors.lightBlueAccent[100]
)
)
),
new Container(
margin: const EdgeDims.only(left: 8.0),
child: new Row(
<Widget>[
new Flexible(
child: new Text(name)
),
new IconButton(
icon: "navigation/more_vert"
)
]
)
)
]
)
);
}
}

class MediaQueryExample extends StatelessComponent {
static const double _maxChildExtent = 150.0;
static const double _gridViewBreakpoint = 450.0;

Widget _buildBody(BuildContext context) {
List<AdaptiveItem> items = <AdaptiveItem>[];

for (int i = 0; i < 30; i++)
items.add(new AdaptiveItem("Item $i"));

if (MediaQuery.of(context).size.width < _gridViewBreakpoint) {
return new Block(
items.map((AdaptiveItem item) => item.toListItem()).toList()
);
} else {
return new Block(
<Widget>[
new Grid(
items.map((AdaptiveItem item) => item.toCard()).toList(),
maxChildExtent: _maxChildExtent
)
]
);
}
}

Widget build(BuildContext context) {
return new Scaffold(
toolBar: new ToolBar(
center: new Text("Media Query Example")
),
body: new Material(
child: _buildBody(context)
)
);
}
}
108 changes: 64 additions & 44 deletions examples/widgets/navigation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,71 @@

import 'package:flutter/material.dart';

import 'package:flutter/src/widgets/navigator2.dart' as n2;

class Home extends StatelessComponent {
Widget build(BuildContext context) {
return new Container(
padding: const EdgeDims.all(30.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
child: new Column(<Widget>[
new Text("You are at home"),
new RaisedButton(
child: new Text('GO SHOPPING'),
onPressed: () => n2.Navigator.of(context).pushNamed('/shopping')
),
new RaisedButton(
child: new Text('START ADVENTURE'),
onPressed: () => n2.Navigator.of(context).pushNamed('/adventure')
)],
justifyContent: FlexJustifyContent.center
)
);
}
}

class Shopping extends StatelessComponent {
Widget build(BuildContext context) {
return new Container(
padding: const EdgeDims.all(20.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)),
child: new Column(<Widget>[
new Text("Village Shop"),
new RaisedButton(
child: new Text('RETURN HOME'),
onPressed: () => n2.Navigator.of(context).pop()
),
new RaisedButton(
child: new Text('GO TO DUNGEON'),
onPressed: () => n2.Navigator.of(context).pushNamed('/adventure')
)],
justifyContent: FlexJustifyContent.center
)
);
}
}

class Adventure extends StatelessComponent {
Widget build(BuildContext context) {
return new Container(
padding: const EdgeDims.all(20.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)),
child: new Column(<Widget>[
new Text("Monster's Lair"),
new RaisedButton(
child: new Text('RUN!!!'),
onPressed: () => n2.Navigator.of(context).pop()
)],
justifyContent: FlexJustifyContent.center
)
);
}
}

final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
'/': (RouteArguments args) => new Container(
padding: const EdgeDims.all(30.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
child: new Column(<Widget>[
new Text("You are at home"),
new RaisedButton(
child: new Text('GO SHOPPING'),
onPressed: () => Navigator.of(args.context).pushNamed('/shopping')
),
new RaisedButton(
child: new Text('START ADVENTURE'),
onPressed: () => Navigator.of(args.context).pushNamed('/adventure')
)],
justifyContent: FlexJustifyContent.center
)
),
'/shopping': (RouteArguments args) => new Container(
padding: const EdgeDims.all(20.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)),
child: new Column(<Widget>[
new Text("Village Shop"),
new RaisedButton(
child: new Text('RETURN HOME'),
onPressed: () => Navigator.of(args.context).pop()
),
new RaisedButton(
child: new Text('GO TO DUNGEON'),
onPressed: () => Navigator.of(args.context).pushNamed('/adventure')
)],
justifyContent: FlexJustifyContent.center
)
),
'/adventure': (RouteArguments args) => new Container(
padding: const EdgeDims.all(20.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)),
child: new Column(<Widget>[
new Text("Monster's Lair"),
new RaisedButton(
child: new Text('RUN!!!'),
onPressed: () => Navigator.of(args.context).pop()
)],
justifyContent: FlexJustifyContent.center
)
)
'/': (_) => new Home(),
'/shopping': (_) => new Shopping(),
'/adventure': (_) => new Adventure(),
};

final ThemeData theme = new ThemeData(
Expand Down
2 changes: 1 addition & 1 deletion examples/widgets/piano.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class PianoApp extends StatelessComponent {
Future _loadSounds() async {
MediaServiceProxy mediaService = new MediaServiceProxy.unbound();
try {
shell.requestService(null, mediaService);
shell.connectToService(null, mediaService);
List<Future<MediaPlayerPrepareResponseParams>> pending = <Future<MediaPlayerPrepareResponseParams>>[];
for (PianoKey key in keys)
pending.add(key.load(mediaService));
Expand Down
3 changes: 2 additions & 1 deletion examples/widgets/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: sky_widgets_examples
dependencies:
flutter: ">=0.0.3 <0.1.0"
flutter:
'0.0.15'
sky_tools: any
flutter_rendering_examples: any
dependency_overrides:
Expand Down
7 changes: 6 additions & 1 deletion examples/widgets/tabs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,10 @@ class TabbedNavigatorAppState extends State<TabbedNavigatorApp> {
}

void main() {
runApp(new TabbedNavigatorApp());
runApp(new MaterialApp(
title: 'Tabs',
routes: <String, RouteBuilder>{
'/': (RouteArguments args) => new TabbedNavigatorApp(),
}
));
}
2 changes: 2 additions & 0 deletions sky/engine/bindings/dart_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "gen/sky/bindings/DartGlobal.h"
#include "sky/engine/bindings/dart_runtime_hooks.h"
#include "sky/engine/core/painting/painting.h"
#include "sky/engine/core/window/window.h"
#include "sky/engine/tonic/dart_converter.h"
#include "sky/engine/tonic/dart_error.h"
Expand Down Expand Up @@ -38,6 +39,7 @@ void DartUI::InitForIsolate() {
g_natives = new DartLibraryNatives();
DartRuntimeHooks::RegisterNatives(g_natives);
Window::RegisterNatives(g_natives);
Painting::RegisterNatives(g_natives);
}

DART_CHECK_VALID(Dart_SetNativeResolver(
Expand Down
Loading

0 comments on commit ea4e59f

Please sign in to comment.