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

Unified Diff: sky/sdk/lib/editing/input.dart

Issue 1234963002: Start an AddressBook example (to test text fields) (Closed) Base URL: git@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 side-by-side diff with in-line comments
Download patch
Index: sky/sdk/lib/editing/input.dart
diff --git a/sky/sdk/lib/editing/input.dart b/sky/sdk/lib/editing/input.dart
index 11f3a59b28711d8263c5a6da3e6157236d57453c..992f0cbfb79b66d12496c92039393c40cb02f7f3 100644
--- a/sky/sdk/lib/editing/input.dart
+++ b/sky/sdk/lib/editing/input.dart
@@ -11,11 +11,20 @@ import 'package:sky/widgets/theme.dart';
typedef void ValueChanged(value);
-const double _kHintOpacity = 0.26;
+// TODO(eseidel): This isn't right, it's 16px on the bottom:
+// http://www.google.com/design/spec/components/text-fields.html#text-fields-single-line-text-field
const EdgeDims _kTextfieldPadding = const EdgeDims.symmetric(vertical: 8.0);
class Input extends StatefulComponent {
+ // Current thinking is that Widget will have an optional globalKey
+ // or heroKey and it will ask Focus.from(this).isFocused which will
+ // check using its globalKey.
+ // Only one element can use a globalKey at a time and its' up to
+ // Widget.sync to maintain the mapping.
+ // Never makes sense to have both a localKey and a globalKey.
+ // Possibly a class HeroKey who functions as a UUID.
+
Input({String key,
this.placeholder,
this.onChanged,
@@ -54,29 +63,30 @@ class Input extends StatefulComponent {
}
Widget build() {
+ ThemeData themeData = Theme.of(this);
+
if (focused && !_isAttachedToKeyboard) {
keyboard.show(_editableValue.stub);
_isAttachedToKeyboard = true;
}
- TextStyle textStyle = Theme.of(this).text.subhead;
+ TextStyle textStyle = themeData.text.subhead;
List<Widget> textChildren = <Widget>[];
if (placeholder != null && _value.isEmpty) {
Widget child = new Opacity(
key: "placeholder",
child: new Text(placeholder, style: textStyle),
- opacity: _kHintOpacity
+ opacity: themeData.hintOpacity
);
textChildren.add(child);
}
- ThemeData themeData = Theme.of(this);
Color focusHighlightColor = themeData.accentColor;
Color cursorColor = themeData.accentColor;
if (themeData.primarySwatch != null) {
- cursorColor = Theme.of(this).primarySwatch[200];
- focusHighlightColor = focused ? themeData.primarySwatch[400] : themeData.primarySwatch[200];
+ cursorColor = themeData.primarySwatch[200];
+ focusHighlightColor = focused ? themeData.primarySwatch[400] : themeData.hintColor;
}
textChildren.add(new EditableText(

Powered by Google App Engine
This is Rietveld 408576698