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

Side by Side Diff: sky/sdk/lib/editing/editable_text.dart

Issue 1217093005: Refactor stateful parts of Component into StatefulComponent (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase Created 5 years, 5 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/example/stocks/lib/stock_settings.dart ('k') | sky/sdk/lib/editing/input.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 'dart:async'; 5 import 'dart:async';
6 import 'dart:sky' as sky; 6 import 'dart:sky' as sky;
7 7
8 import '../painting/text_style.dart'; 8 import '../painting/text_style.dart';
9 import '../rendering/object.dart'; 9 import '../rendering/object.dart';
10 import '../widgets/basic.dart'; 10 import '../widgets/basic.dart';
11 import 'editable_string.dart'; 11 import 'editable_string.dart';
12 12
13 const _kCursorBlinkPeriod = 500; // milliseconds 13 const _kCursorBlinkPeriod = 500; // milliseconds
14 const _kCursorGap = 1.0; 14 const _kCursorGap = 1.0;
15 const _kCursorHeightOffset = 2.0; 15 const _kCursorHeightOffset = 2.0;
16 const _kCursorWidth = 1.0; 16 const _kCursorWidth = 1.0;
17 17
18 class EditableText extends Component { 18 class EditableText extends StatefulComponent {
19 19
20 EditableText({ 20 EditableText({
21 String key, 21 String key,
22 this.value, 22 this.value,
23 this.focused: false, 23 this.focused: false,
24 this.style, 24 this.style,
25 this.cursorColor}) : super(key: key, stateful: true); 25 this.cursorColor}) : super(key: key);
26 26
27 EditableString value; 27 EditableString value;
28 bool focused; 28 bool focused;
29 TextStyle style; 29 TextStyle style;
30 Color cursorColor; 30 Color cursorColor;
31 31
32 void syncFields(EditableText source) { 32 void syncFields(EditableText source) {
33 value = source.value; 33 value = source.value;
34 focused = source.focused; 34 focused = source.focused;
35 style = source.style; 35 style = source.style;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 Widget cursor = new Container( 101 Widget cursor = new Container(
102 height: style.fontSize, 102 height: style.fontSize,
103 width: _kCursorGap + _kCursorWidth, 103 width: _kCursorGap + _kCursorWidth,
104 child: new CustomPaint(callback: _paintCursor, token: _showCursor) 104 child: new CustomPaint(callback: _paintCursor, token: _showCursor)
105 ); 105 );
106 106
107 return new Flex([text, cursor]); 107 return new Flex([text, cursor]);
108 } 108 }
109 } 109 }
OLDNEW
« no previous file with comments | « sky/sdk/example/stocks/lib/stock_settings.dart ('k') | sky/sdk/lib/editing/input.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698