| OLD | NEW |
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void _stopCursorTimer() { | 60 void _stopCursorTimer() { |
| 61 _cursorTimer.cancel(); | 61 _cursorTimer.cancel(); |
| 62 _cursorTimer = null; | 62 _cursorTimer = null; |
| 63 _showCursor = false; | 63 _showCursor = false; |
| 64 } | 64 } |
| 65 | 65 |
| 66 void _paintCursor(sky.Canvas canvas, Size size) { | 66 void _paintCursor(sky.Canvas canvas, Size size) { |
| 67 if (!_showCursor) | 67 if (!_showCursor) |
| 68 return; | 68 return; |
| 69 | 69 |
| 70 print("Draw cursor"); | |
| 71 Rect cursorRect = new Rect.fromLTWH( | 70 Rect cursorRect = new Rect.fromLTWH( |
| 72 _kCursorGap, | 71 _kCursorGap, |
| 73 -_kCursorHeightOffset, | 72 -_kCursorHeightOffset, |
| 74 _kCursorWidth, | 73 _kCursorWidth, |
| 75 style.fontSize + 2 * _kCursorHeightOffset | 74 style.fontSize + 2 * _kCursorHeightOffset |
| 76 ); | 75 ); |
| 77 canvas.drawRect(cursorRect, new Paint()..color = cursorColor); | 76 canvas.drawRect(cursorRect, new Paint()..color = cursorColor); |
| 78 } | 77 } |
| 79 | 78 |
| 80 Widget build() { | 79 Widget build() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 101 | 100 |
| 102 Widget cursor = new Container( | 101 Widget cursor = new Container( |
| 103 height: style.fontSize, | 102 height: style.fontSize, |
| 104 width: _kCursorGap + _kCursorWidth, | 103 width: _kCursorGap + _kCursorWidth, |
| 105 child: new CustomPaint(callback: _paintCursor, token: _showCursor) | 104 child: new CustomPaint(callback: _paintCursor, token: _showCursor) |
| 106 ); | 105 ); |
| 107 | 106 |
| 108 return new Flex([text, cursor]); | 107 return new Flex([text, cursor]); |
| 109 } | 108 } |
| 110 } | 109 } |
| OLD | NEW |