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

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

Issue 1179713004: Material and RaisedButton. (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 'dart:sky' as sky;
6
7 import '../painting/shadows.dart';
8 import '../theme2/colors.dart'; 5 import '../theme2/colors.dart';
6 import '../theme2/edges.dart';
7 import 'button_base.dart';
9 import 'ink_well.dart'; 8 import 'ink_well.dart';
10 import 'material.dart'; 9 import 'material.dart';
11 import 'wrappers.dart'; 10 import 'wrappers.dart';
12 11
13 // TODO(eseidel): This needs to change based on device size? 12 // TODO(eseidel): This needs to change based on device size?
14 // http://www.google.com/design/spec/layout/metrics-keylines.html#metrics-keylin es-keylines-spacing 13 // http://www.google.com/design/spec/layout/metrics-keylines.html#metrics-keylin es-keylines-spacing
15 const double _kSize = 56.0; 14 const double _kSize = 56.0;
16 15
17 class FloatingActionButton extends Component { 16 class FloatingActionButton extends ButtonBase {
18 17
19 FloatingActionButton({ Object key, this.content, this.level: 0 }) 18 FloatingActionButton({ Object key, this.child })
20 : super(key: key); 19 : super(key: key);
21 20
22 final UINode content; 21 final UINode child;
23 final int level;
24 22
25 UINode build() { 23 UINode buildContent() {
26 List<UINode> children = [];
27
28 if (content != null)
29 children.add(content);
30
31 return new Material( 24 return new Material(
32 content: new CustomPaint( 25 child: new ClipOval(
33 callback: (sky.Canvas canvas, Size size) { 26 child: new Container(
34 const double radius = _kSize / 2.0; 27 width: _kSize,
35 sky.Paint paint = new sky.Paint()..color = Red[500]; 28 height: _kSize,
36 var builder = new ShadowDrawLooperBuilder() 29 child: new InkWell(child: new Center(child: child))
37 ..addShadow(const sky.Size(0.0, 5.0),
38 const sky.Color(0x77000000),
39 5.0);
40 paint.setDrawLooper(builder.build());
41 canvas.drawCircle(radius, radius, radius, paint);
42 },
43 child: new ClipOval(
44 child: new Container(
45 width: _kSize,
46 height: _kSize,
47 child: new InkWell(children: children)
48 )
49 ) 30 )
50 ), 31 ),
51 level: level); 32 color: Red[500],
33 edge: MaterialEdge.circle,
34 level: highlight ? 3 : 2
35 );
52 } 36 }
53 37
54 } 38 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/widgets/fixed_height_scrollable.dart ('k') | sky/sdk/lib/framework/widgets/ink_well.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698