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

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

Issue 1226113007: Add @override annotation to known overriden methods (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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/lib/animation/scroll_behavior.dart ('k') | sky/sdk/lib/mojo/asset_bundle.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';
(...skipping 11 matching lines...) Expand all
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); 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 @override
32 void syncFields(EditableText source) { 33 void syncFields(EditableText source) {
33 value = source.value; 34 value = source.value;
34 focused = source.focused; 35 focused = source.focused;
35 style = source.style; 36 style = source.style;
36 cursorColor = source.cursorColor; 37 cursorColor = source.cursorColor;
37 } 38 }
38 39
39 Timer _cursorTimer; 40 Timer _cursorTimer;
40 bool _showCursor = false; 41 bool _showCursor = false;
41 42
42 void _cursorTick(Timer timer) { 43 void _cursorTick(Timer timer) {
43 setState(() { 44 setState(() {
44 _showCursor = !_showCursor; 45 _showCursor = !_showCursor;
45 }); 46 });
46 } 47 }
47 48
48 void _startCursorTimer() { 49 void _startCursorTimer() {
49 _showCursor = true; 50 _showCursor = true;
50 _cursorTimer = new Timer.periodic( 51 _cursorTimer = new Timer.periodic(
51 new Duration(milliseconds: _kCursorBlinkPeriod), _cursorTick); 52 new Duration(milliseconds: _kCursorBlinkPeriod), _cursorTick);
52 } 53 }
53 54
55 @override
54 void didUnmount() { 56 void didUnmount() {
55 if (_cursorTimer != null) 57 if (_cursorTimer != null)
56 _stopCursorTimer(); 58 _stopCursorTimer();
57 super.didUnmount(); 59 super.didUnmount();
58 } 60 }
59 61
60 void _stopCursorTimer() { 62 void _stopCursorTimer() {
61 _cursorTimer.cancel(); 63 _cursorTimer.cancel();
62 _cursorTimer = null; 64 _cursorTimer = null;
63 _showCursor = false; 65 _showCursor = false;
64 } 66 }
65 67
66 void _paintCursor(sky.Canvas canvas, Size size) { 68 void _paintCursor(sky.Canvas canvas, Size size) {
67 if (!_showCursor) 69 if (!_showCursor)
68 return; 70 return;
69 71
70 Rect cursorRect = new Rect.fromLTWH( 72 Rect cursorRect = new Rect.fromLTWH(
71 _kCursorGap, 73 _kCursorGap,
72 -_kCursorHeightOffset, 74 -_kCursorHeightOffset,
73 _kCursorWidth, 75 _kCursorWidth,
74 style.fontSize + 2 * _kCursorHeightOffset 76 style.fontSize + 2 * _kCursorHeightOffset
75 ); 77 );
76 canvas.drawRect(cursorRect, new Paint()..color = cursorColor); 78 canvas.drawRect(cursorRect, new Paint()..color = cursorColor);
77 } 79 }
78 80
81 @override
79 Widget build() { 82 Widget build() {
80 assert(style != null); 83 assert(style != null);
81 assert(focused != null); 84 assert(focused != null);
82 assert(cursorColor != null); 85 assert(cursorColor != null);
83 86
84 if (focused && _cursorTimer == null) 87 if (focused && _cursorTimer == null)
85 _startCursorTimer(); 88 _startCursorTimer();
86 else if (!focused && _cursorTimer != null) 89 else if (!focused && _cursorTimer != null)
87 _stopCursorTimer(); 90 _stopCursorTimer();
88 91
(...skipping 11 matching lines...) Expand all
100 103
101 Widget cursor = new Container( 104 Widget cursor = new Container(
102 height: style.fontSize, 105 height: style.fontSize,
103 width: _kCursorGap + _kCursorWidth, 106 width: _kCursorGap + _kCursorWidth,
104 child: new CustomPaint(callback: _paintCursor, token: _showCursor) 107 child: new CustomPaint(callback: _paintCursor, token: _showCursor)
105 ); 108 );
106 109
107 return new Flex([text, cursor]); 110 return new Flex([text, cursor]);
108 } 111 }
109 } 112 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/animation/scroll_behavior.dart ('k') | sky/sdk/lib/mojo/asset_bundle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698