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

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

Issue 1175683002: Add a shadow to the FloatingActionButton. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: moved to painting/ 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
« no previous file with comments | « sky/sdk/BUILD.gn ('k') | sky/sdk/lib/framework/painting/shadows.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 '../theme2/colors.dart'; 8 import '../theme2/colors.dart';
8 import 'dart:sky' as sky; 9 import 'dart:sky' as sky;
9 import 'ink_well.dart'; 10 import 'ink_well.dart';
10 import 'material.dart'; 11 import 'material.dart';
11 12
12 const double _kSize = 56.0; 13 const double _kSize = 56.0;
13 14
14 class FloatingActionButton extends Component { 15 class FloatingActionButton extends Component {
15 UINode content; 16 UINode content;
16 int level; 17 int level;
17 18
18 FloatingActionButton({ Object key, this.content, this.level: 0 }) 19 FloatingActionButton({ Object key, this.content, this.level: 0 })
19 : super(key: key); 20 : super(key: key);
20 21
21 UINode build() { 22 UINode build() {
22 List<UINode> children = []; 23 List<UINode> children = [];
23 24
24 if (content != null) 25 if (content != null)
25 children.add(content); 26 children.add(content);
26 27
27 return new Material( 28 return new Material(
28 content: new CustomPaint( 29 content: new CustomPaint(
29 callback: (sky.Canvas canvas) { 30 callback: (sky.Canvas canvas) {
30 const double radius = _kSize / 2.0; 31 const double radius = _kSize / 2.0;
31 canvas.drawCircle(radius, radius, radius, new sky.Paint()..color = Red [500]); 32 sky.Paint paint = new sky.Paint()..color = Red[500];
33 var builder = new ShadowDrawLooperBuilder()
34 ..addShadow(const sky.Size(0.0, 5.0),
35 const sky.Color(0x77000000),
36 5.0);
37 paint.setDrawLooper(builder.build());
38 canvas.drawCircle(radius, radius, radius, paint);
32 }, 39 },
33 child: new Container( 40 child: new Container(
34 width: _kSize, 41 width: _kSize,
35 height: _kSize, 42 height: _kSize,
36 child: new InkWell(children: children))), 43 child: new InkWell(children: children))),
37 level: level); 44 level: level);
38 } 45 }
39 } 46 }
OLDNEW
« no previous file with comments | « sky/sdk/BUILD.gn ('k') | sky/sdk/lib/framework/painting/shadows.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698