Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit ea4e59f

Browse files
author
Michael Xia
committed
2 parents d1f7c8b + c3e03ba commit ea4e59f

File tree

97 files changed

+1846
-905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1846
-905
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,5 @@ Thumbs.db
6868
/mojo/common/dart/packages
6969
/sky/packages/**/packages
7070
/sky/packages/sky_services/lib/
71+
/sky/tools/pubspec_maintenance/packages/
72+
/sky/tools/pubspec_maintenance/pubspec.lock

DEPS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,7 @@ hooks = [
255255
'src/sky/tools/dart_pub_get.py',
256256
'--repository-root', '../..',
257257
'--dart-sdk-directory',
258-
'../../third_party/dart-sdk/dart-sdk',
259-
'--dirs-to-ignore', 'sky/packages/sky',
258+
'../../third_party/dart-sdk/dart-sdk'
260259
],
261260
},
262261
{

examples/address_book/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: address_book
22
dependencies:
3-
flutter: ">=0.0.3 <0.1.0"
3+
flutter:
4+
'0.0.15'
45
sky_tools: any
56
dependency_overrides:
67
material_design_icons:

examples/fitness/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: fitness
22
dependencies:
3-
flutter: ">=0.0.3 <0.1.0"
3+
flutter:
4+
'0.0.15'
45
playfair: ^0.0.10
56
path: ^1.3.6
67
sky_tools: any

examples/game/pubspec.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: asteroids
22
dependencies:
3-
flutter: ">=0.0.3 <0.1.0"
3+
flutter:
4+
'0.0.15'
45
sky_tools: any
5-
flutter_sprites: any
6+
flutter_sprites:
7+
'0.0.12'
68
box2d: any
79
dependency_overrides:
810
material_design_icons:

examples/hello_world/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: hello_world
22
dependencies:
3-
flutter: ">=0.0.3 <0.1.0"
3+
flutter:
4+
'0.0.15'
45
sky_tools: any
56
dependency_overrides:
67
material_design_icons:

examples/mine_digger/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: mine_digger
22
dependencies:
3-
flutter: ">=0.0.3 <0.1.0"
3+
flutter:
4+
'0.0.15'
45
sky_tools: any
56
dependency_overrides:
67
material_design_icons:

examples/raw/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: sky_raw_examples
22
dependencies:
3-
flutter: ">=0.0.3 <0.1.0"
3+
flutter:
4+
'0.0.15'
45
sky_tools: any
56
dependency_overrides:
67
material_design_icons:

examples/rendering/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: flutter_rendering_examples
22
dependencies:
3-
flutter: ">=0.0.3 <0.1.0"
3+
flutter:
4+
'0.0.15'
45
sky_tools: any
56
dependency_overrides:
67
material_design_icons:

examples/stocks/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: stocks
22
dependencies:
3-
flutter: ">=0.0.3 <0.1.0"
3+
flutter:
4+
'0.0.15'
45
sky_tools: any
56
dependency_overrides:
67
material_design_icons:

examples/widgets/card_collection.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class CardCollectionState extends State<CardCollection> {
301301
)
302302
: new DefaultTextStyle(
303303
style: DefaultTextStyle.of(context).merge(cardLabelStyle).merge(_textStyle).copyWith(
304-
fontSize: _varyFontSizes ? 5.0 + _cardModels.length.toDouble() : null
304+
fontSize: _varyFontSizes ? _cardModels.length.toDouble() : null
305305
),
306306
child: new Column(<Widget>[
307307
new Text(cardModel.label)

examples/widgets/media_query.dart

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import 'package:flutter/material.dart';
2+
3+
void main() {
4+
runApp(
5+
new MaterialApp(
6+
title: "Media Query Example",
7+
routes: <String, RouteBuilder>{
8+
'/': (RouteArguments args) => new MediaQueryExample()
9+
}
10+
)
11+
);
12+
}
13+
14+
class AdaptiveItem {
15+
AdaptiveItem(this.name);
16+
String name;
17+
18+
Widget toListItem() {
19+
return new Row(
20+
<Widget>[
21+
new Container(
22+
width: 32.0,
23+
height: 32.0,
24+
margin: const EdgeDims.all(8.0),
25+
decoration: new BoxDecoration(
26+
backgroundColor: Colors.lightBlueAccent[100]
27+
)
28+
),
29+
new Text(name)
30+
]
31+
);
32+
}
33+
34+
Widget toCard() {
35+
return new Card(
36+
child: new Column(
37+
<Widget>[
38+
new Flexible(
39+
child: new Container(
40+
decoration: new BoxDecoration(
41+
backgroundColor: Colors.lightBlueAccent[100]
42+
)
43+
)
44+
),
45+
new Container(
46+
margin: const EdgeDims.only(left: 8.0),
47+
child: new Row(
48+
<Widget>[
49+
new Flexible(
50+
child: new Text(name)
51+
),
52+
new IconButton(
53+
icon: "navigation/more_vert"
54+
)
55+
]
56+
)
57+
)
58+
]
59+
)
60+
);
61+
}
62+
}
63+
64+
class MediaQueryExample extends StatelessComponent {
65+
static const double _maxChildExtent = 150.0;
66+
static const double _gridViewBreakpoint = 450.0;
67+
68+
Widget _buildBody(BuildContext context) {
69+
List<AdaptiveItem> items = <AdaptiveItem>[];
70+
71+
for (int i = 0; i < 30; i++)
72+
items.add(new AdaptiveItem("Item $i"));
73+
74+
if (MediaQuery.of(context).size.width < _gridViewBreakpoint) {
75+
return new Block(
76+
items.map((AdaptiveItem item) => item.toListItem()).toList()
77+
);
78+
} else {
79+
return new Block(
80+
<Widget>[
81+
new Grid(
82+
items.map((AdaptiveItem item) => item.toCard()).toList(),
83+
maxChildExtent: _maxChildExtent
84+
)
85+
]
86+
);
87+
}
88+
}
89+
90+
Widget build(BuildContext context) {
91+
return new Scaffold(
92+
toolBar: new ToolBar(
93+
center: new Text("Media Query Example")
94+
),
95+
body: new Material(
96+
child: _buildBody(context)
97+
)
98+
);
99+
}
100+
}

examples/widgets/navigation.dart

Lines changed: 64 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,71 @@
44

55
import 'package:flutter/material.dart';
66

7+
import 'package:flutter/src/widgets/navigator2.dart' as n2;
8+
9+
class Home extends StatelessComponent {
10+
Widget build(BuildContext context) {
11+
return new Container(
12+
padding: const EdgeDims.all(30.0),
13+
decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
14+
child: new Column(<Widget>[
15+
new Text("You are at home"),
16+
new RaisedButton(
17+
child: new Text('GO SHOPPING'),
18+
onPressed: () => n2.Navigator.of(context).pushNamed('/shopping')
19+
),
20+
new RaisedButton(
21+
child: new Text('START ADVENTURE'),
22+
onPressed: () => n2.Navigator.of(context).pushNamed('/adventure')
23+
)],
24+
justifyContent: FlexJustifyContent.center
25+
)
26+
);
27+
}
28+
}
29+
30+
class Shopping extends StatelessComponent {
31+
Widget build(BuildContext context) {
32+
return new Container(
33+
padding: const EdgeDims.all(20.0),
34+
decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)),
35+
child: new Column(<Widget>[
36+
new Text("Village Shop"),
37+
new RaisedButton(
38+
child: new Text('RETURN HOME'),
39+
onPressed: () => n2.Navigator.of(context).pop()
40+
),
41+
new RaisedButton(
42+
child: new Text('GO TO DUNGEON'),
43+
onPressed: () => n2.Navigator.of(context).pushNamed('/adventure')
44+
)],
45+
justifyContent: FlexJustifyContent.center
46+
)
47+
);
48+
}
49+
}
50+
51+
class Adventure extends StatelessComponent {
52+
Widget build(BuildContext context) {
53+
return new Container(
54+
padding: const EdgeDims.all(20.0),
55+
decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)),
56+
child: new Column(<Widget>[
57+
new Text("Monster's Lair"),
58+
new RaisedButton(
59+
child: new Text('RUN!!!'),
60+
onPressed: () => n2.Navigator.of(context).pop()
61+
)],
62+
justifyContent: FlexJustifyContent.center
63+
)
64+
);
65+
}
66+
}
67+
768
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
8-
'/': (RouteArguments args) => new Container(
9-
padding: const EdgeDims.all(30.0),
10-
decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
11-
child: new Column(<Widget>[
12-
new Text("You are at home"),
13-
new RaisedButton(
14-
child: new Text('GO SHOPPING'),
15-
onPressed: () => Navigator.of(args.context).pushNamed('/shopping')
16-
),
17-
new RaisedButton(
18-
child: new Text('START ADVENTURE'),
19-
onPressed: () => Navigator.of(args.context).pushNamed('/adventure')
20-
)],
21-
justifyContent: FlexJustifyContent.center
22-
)
23-
),
24-
'/shopping': (RouteArguments args) => new Container(
25-
padding: const EdgeDims.all(20.0),
26-
decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)),
27-
child: new Column(<Widget>[
28-
new Text("Village Shop"),
29-
new RaisedButton(
30-
child: new Text('RETURN HOME'),
31-
onPressed: () => Navigator.of(args.context).pop()
32-
),
33-
new RaisedButton(
34-
child: new Text('GO TO DUNGEON'),
35-
onPressed: () => Navigator.of(args.context).pushNamed('/adventure')
36-
)],
37-
justifyContent: FlexJustifyContent.center
38-
)
39-
),
40-
'/adventure': (RouteArguments args) => new Container(
41-
padding: const EdgeDims.all(20.0),
42-
decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)),
43-
child: new Column(<Widget>[
44-
new Text("Monster's Lair"),
45-
new RaisedButton(
46-
child: new Text('RUN!!!'),
47-
onPressed: () => Navigator.of(args.context).pop()
48-
)],
49-
justifyContent: FlexJustifyContent.center
50-
)
51-
)
69+
'/': (_) => new Home(),
70+
'/shopping': (_) => new Shopping(),
71+
'/adventure': (_) => new Adventure(),
5272
};
5373

5474
final ThemeData theme = new ThemeData(

examples/widgets/piano.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class PianoApp extends StatelessComponent {
6868
Future _loadSounds() async {
6969
MediaServiceProxy mediaService = new MediaServiceProxy.unbound();
7070
try {
71-
shell.requestService(null, mediaService);
71+
shell.connectToService(null, mediaService);
7272
List<Future<MediaPlayerPrepareResponseParams>> pending = <Future<MediaPlayerPrepareResponseParams>>[];
7373
for (PianoKey key in keys)
7474
pending.add(key.load(mediaService));

examples/widgets/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: sky_widgets_examples
22
dependencies:
3-
flutter: ">=0.0.3 <0.1.0"
3+
flutter:
4+
'0.0.15'
45
sky_tools: any
56
flutter_rendering_examples: any
67
dependency_overrides:

examples/widgets/tabs.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,10 @@ class TabbedNavigatorAppState extends State<TabbedNavigatorApp> {
136136
}
137137

138138
void main() {
139-
runApp(new TabbedNavigatorApp());
139+
runApp(new MaterialApp(
140+
title: 'Tabs',
141+
routes: <String, RouteBuilder>{
142+
'/': (RouteArguments args) => new TabbedNavigatorApp(),
143+
}
144+
));
140145
}

sky/engine/bindings/dart_ui.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "gen/sky/bindings/DartGlobal.h"
88
#include "sky/engine/bindings/dart_runtime_hooks.h"
9+
#include "sky/engine/core/painting/painting.h"
910
#include "sky/engine/core/window/window.h"
1011
#include "sky/engine/tonic/dart_converter.h"
1112
#include "sky/engine/tonic/dart_error.h"
@@ -38,6 +39,7 @@ void DartUI::InitForIsolate() {
3839
g_natives = new DartLibraryNatives();
3940
DartRuntimeHooks::RegisterNatives(g_natives);
4041
Window::RegisterNatives(g_natives);
42+
Painting::RegisterNatives(g_natives);
4143
}
4244

4345
DART_CHECK_VALID(Dart_SetNativeResolver(

0 commit comments

Comments
 (0)