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

Side by Side Diff: sky/sdk/lib/framework/components2/floating_action_button.dart

Issue 1174023003: Remove one more use of mirrors: Components now have to explicitly sync their fields. (Closed) Base URL: https://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 unified diff | Download patch
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 '../fn2.dart'; 5 import '../fn2.dart';
6 import '../rendering/box.dart'; 6 import '../rendering/box.dart';
7 import '../painting/shadows.dart'; 7 import '../painting/shadows.dart';
8 import '../theme2/colors.dart'; 8 import '../theme2/colors.dart';
9 import 'dart:sky' as sky; 9 import 'dart:sky' as sky;
10 import 'ink_well.dart'; 10 import 'ink_well.dart';
11 import 'material.dart'; 11 import 'material.dart';
12 12
13 const double _kSize = 56.0; 13 const double _kSize = 56.0;
14 14
15 class FloatingActionButton extends Component { 15 class FloatingActionButton extends Component {
16 16
17 FloatingActionButton({ Object key, this.content, this.level: 0 }) 17 FloatingActionButton({ Object key, this.content, this.level: 0 })
18 : super(key: key); 18 : super(key: key);
19 19
20 UINode content; 20 final UINode content;
21 int level; 21 final int level;
22 22
23 UINode build() { 23 UINode build() {
24 List<UINode> children = []; 24 List<UINode> children = [];
25 25
26 if (content != null) 26 if (content != null)
27 children.add(content); 27 children.add(content);
28 28
29 return new Material( 29 return new Material(
30 content: new CustomPaint( 30 content: new CustomPaint(
31 callback: (sky.Canvas canvas) { 31 callback: (sky.Canvas canvas) {
32 const double radius = _kSize / 2.0; 32 const double radius = _kSize / 2.0;
33 sky.Paint paint = new sky.Paint()..color = Red[500]; 33 sky.Paint paint = new sky.Paint()..color = Red[500];
34 var builder = new ShadowDrawLooperBuilder() 34 var builder = new ShadowDrawLooperBuilder()
35 ..addShadow(const sky.Size(0.0, 5.0), 35 ..addShadow(const sky.Size(0.0, 5.0),
36 const sky.Color(0x77000000), 36 const sky.Color(0x77000000),
37 5.0); 37 5.0);
38 paint.setDrawLooper(builder.build()); 38 paint.setDrawLooper(builder.build());
39 canvas.drawCircle(radius, radius, radius, paint); 39 canvas.drawCircle(radius, radius, radius, paint);
40 }, 40 },
41 child: new Container( 41 child: new Container(
42 width: _kSize, 42 width: _kSize,
43 height: _kSize, 43 height: _kSize,
44 child: new InkWell(children: children))), 44 child: new InkWell(children: children))),
45 level: level); 45 level: level);
46 } 46 }
47 47
48 } 48 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/components2/fixed_height_scrollable.dart ('k') | sky/sdk/lib/framework/components2/icon.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698