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

Unified Diff: sky/sdk/lib/framework/editing2/editable_text.dart

Issue 1175753003: Kill onDidMount()/onDidUnmount() in favour of just overriding the relevant methods. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: git pull 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/lib/framework/components2/scrollable.dart ('k') | sky/sdk/lib/framework/fn2.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/framework/editing2/editable_text.dart
diff --git a/sky/sdk/lib/framework/editing2/editable_text.dart b/sky/sdk/lib/framework/editing2/editable_text.dart
index 711e930360c196665a5ddd2f588849160132047a..aa9df5164ff0e1e51dede92623832f0b09a9c5ad 100644
--- a/sky/sdk/lib/framework/editing2/editable_text.dart
+++ b/sky/sdk/lib/framework/editing2/editable_text.dart
@@ -9,6 +9,9 @@ import 'editable_string.dart';
class EditableText extends Component {
+ EditableText({Object key, this.value, this.focused})
+ : super(key: key, stateful: true);
+
// static final Style _cursorStyle = new Style('''
// width: 2px;
// height: 1.2em;
@@ -22,17 +25,15 @@ class EditableText extends Component {
EditableString value;
bool focused;
- Timer _cursorTimer;
- bool _showCursor = false;
- EditableText({Object key, this.value, this.focused})
- : super(key: key, stateful: true) {
- onDidUnmount(() {
- if (_cursorTimer != null)
- _stopCursorTimer();
- });
+ void syncFields(EditableText source) {
+ value = source.value;
+ focused = source.focused;
}
+ Timer _cursorTimer;
+ bool _showCursor = false;
+
void _cursorTick(Timer timer) {
setState(() {
_showCursor = !_showCursor;
@@ -45,6 +46,11 @@ class EditableText extends Component {
new Duration(milliseconds: 500), _cursorTick);
}
+ void didUnmount() {
+ if (_cursorTimer != null)
+ _stopCursorTimer();
+ }
abarth-chromium 2015/06/10 20:27:17 super.didUnmount()
+
void _stopCursorTimer() {
_cursorTimer.cancel();
_cursorTimer = null;
« no previous file with comments | « sky/sdk/lib/framework/components2/scrollable.dart ('k') | sky/sdk/lib/framework/fn2.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698