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

Side by Side Diff: sky/framework/components/checkbox.dart

Issue 1128173007: [Effen] remove some redundant styles (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 '../fn.dart'; 5 import '../fn.dart';
6 import '../layout.dart';
6 import 'button_base.dart'; 7 import 'button_base.dart';
7 import 'dart:sky' as sky; 8 import 'dart:sky' as sky;
8 9
9 typedef void ValueChanged(value); 10 typedef void ValueChanged(value);
10 11
11 class Checkbox extends ButtonBase { 12 class Checkbox extends ButtonBase {
12 static final Style _style = new Style(''' 13 static final Style _style = new Style('''
13 transform: translateX(0); 14 transform: translateX(0);
14 display: flex;
15 flex-direction: row;
16 justify-content: center; 15 justify-content: center;
17 align-items: center; 16 align-items: center;
18 -webkit-user-select: none; 17 -webkit-user-select: none;
19 cursor: pointer; 18 cursor: pointer;
20 width: 30px; 19 width: 30px;
21 height: 30px;''' 20 height: 30px;'''
22 ); 21 );
23 22
24 static final Style _containerStyle = new Style(''' 23 static final Style _containerStyle = new Style('''
25 border: solid 2px; 24 border: solid 2px;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 ValueChanged onChanged; 60 ValueChanged onChanged;
62 61
63 Checkbox({ Object key, this.onChanged, this.checked }) : super(key: key); 62 Checkbox({ Object key, this.onChanged, this.checked }) : super(key: key);
64 63
65 void _handleClick(sky.Event e) { 64 void _handleClick(sky.Event e) {
66 onChanged(!checked); 65 onChanged(!checked);
67 } 66 }
68 67
69 UINode buildContent() { 68 UINode buildContent() {
70 return new EventListenerNode( 69 return new EventListenerNode(
71 new Container( 70 new FlexContainer(
72 style: _style, 71 style: _style,
72 direction: FlexDirection.Row,
73 children: [ 73 children: [
74 new Container( 74 new Container(
75 style: highlight ? _containerHighlightStyle : _containerStyle, 75 style: highlight ? _containerHighlightStyle : _containerStyle,
76 children: [ 76 children: [
77 new Container( 77 new Container(
78 style: checked ? _checkedStyle : _uncheckedStyle 78 style: checked ? _checkedStyle : _uncheckedStyle
79 ) 79 )
80 ] 80 ]
81 ) 81 )
82 ] 82 ]
83 ), 83 ),
84 onGestureTap: _handleClick 84 onGestureTap: _handleClick
85 ); 85 );
86 } 86 }
87 } 87 }
OLDNEW
« no previous file with comments | « sky/framework/components/button.dart ('k') | sky/framework/components/floating_action_button.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698