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

Unified Diff: sky/sdk/lib/widgets/README.md

Issue 1188163004: Improve widgets/README.md based on Hixie's feeback (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/README.md
diff --git a/sky/sdk/lib/widgets/README.md b/sky/sdk/lib/widgets/README.md
index ea79e329a60b165b0b43652f674ba9e54d864188..67510a32599a9ebe6b6049453c8b60c863b452e7 100644
--- a/sky/sdk/lib/widgets/README.md
+++ b/sky/sdk/lib/widgets/README.md
@@ -69,16 +69,16 @@ import 'package:sky/widgets/basic.dart';
class MyToolBar extends Component {
Widget build() {
return new Container(
- child: new Flex([
- new Image(src: 'menu.png', size: const Size(25.0, 25.0)),
- new Flexible(child: new Text('My awesome toolbar')),
- new Image(src: 'search.png', size: const Size(25.0, 25.0)),
- ]),
height: 56.0,
padding: new EdgeDims.symmetric(horizontal: 8.0),
decoration: const BoxDecoration(
Hixie 2015/06/17 17:13:16 decoration should go first, since you say "cyan" b
abarth-chromium 2015/06/17 17:39:29 Done.
backgroundColor: const Color(0xFF00FFFF),
- )
+ ),
+ child: new Flex([
+ new Image(src: 'menu.png', size: const Size(25.0, 25.0)),
+ new Flexible(child: new Text('My awesome toolbar')),
+ new Image(src: 'search.png', size: const Size(25.0, 25.0)),
+ ])
);
}
}
@@ -113,8 +113,9 @@ void main() {
```
Here, we've used the `Center` widget to center the toolbar within the view, both
-vertically and horizontally. Because the toolbar uses a flexible layout
-internally, it expands to fill all the available horizontal space.
+vertically and horizontally. If we didn't center the toolbar, it would fill the
+view, both vertically and horizontally, because the root widget is sized to fill
+the view.
Listening to Events
-------------------
@@ -137,18 +138,18 @@ final BoxDecoration _decoration = new BoxDecoration(
class MyButton extends Component {
Widget build() {
return new Listener(
+ onGestureTap: (event) {
+ print('MyButton was tapped!');
+ },
child: new Container(
- child: new Center(
- child: new Text('Engage')
- ),
height: 36.0,
padding: new EdgeDims.all(8.0),
margin: new EdgeDims.symmetric(horizontal: 8.0),
- decoration: _decoration
- ),
- onGestureTap: (event) {
- print('MyButton was tapped!');
- }
+ decoration: _decoration,
+ child: new Center(
+ child: new Text('Engage')
+ )
+ )
);
}
}
@@ -180,17 +181,17 @@ class MyButton extends Component {
Widget build() {
return new Listener(
+ onGestureTap: (_) {
+ if (onPressed != null)
+ onPressed();
+ },
child: new Container(
- child: new Center(child: child),
height: 36.0,
padding: new EdgeDims.all(8.0),
margin: new EdgeDims.symmetric(horizontal: 8.0),
- decoration: _decoration
- ),
- onGestureTap: (_) {
- if (onPressed != null)
- onPressed();
- }
+ decoration: _decoration,
+ child: new Center(child: child)
+ )
);
}
}
@@ -208,8 +209,8 @@ button:
child: new Flex([
new Image(src: 'thumbs-up.png', size: const Size(25.0, 25.0)),
new Container(
- child: new Text('Thumbs up'),
padding: new EdgeDims.only(left: 10.0)
+ child: new Text('Thumbs up'),
)
])
)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698