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

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

Issue 1216133002: Theme Input, style EditableText, restore text input cursor (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Updated per review feedback 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/editing/editable_text.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/editing/input.dart
diff --git a/sky/sdk/lib/editing/input.dart b/sky/sdk/lib/editing/input.dart
index e8488ac7e95f1765dc94d088d8df81ebb8b05ad6..f86e993882ed14135ef81415111ec4f473993e8e 100644
--- a/sky/sdk/lib/editing/input.dart
+++ b/sky/sdk/lib/editing/input.dart
@@ -3,15 +3,17 @@
// found in the LICENSE file.
import '../painting/text_style.dart';
-import '../theme/colors.dart';
-import '../theme/typography.dart' as typography;
import '../widgets/basic.dart';
+import '../widgets/theme.dart';
import 'editable_string.dart';
import 'editable_text.dart';
import 'keyboard.dart';
typedef void ValueChanged(value);
+const double _kHintOpacity = 0.26;
+const EdgeDims _kTextfieldPadding = const EdgeDims.symmetric(vertical: 8.0);
+
class Input extends Component {
Input({String key,
@@ -25,8 +27,6 @@ class Input extends Component {
);
}
- static final TextStyle _placeholderStyle = typography.black.caption;
-
String placeholder;
ValueChanged onChanged;
bool focused = false;
@@ -56,23 +56,33 @@ class Input extends Component {
_isAttachedToKeyboard = true;
}
+ TextStyle textStyle = Theme.of(this).text.subhead;
List<Widget> textChildren = <Widget>[];
+
if (placeholder != null && _value.isEmpty) {
- textChildren.add(new Text(placeholder, style: _placeholderStyle));
+ Widget child = new Opacity(
+ key: "placeholder",
+ child: new Text(placeholder, style: textStyle),
+ opacity: _kHintOpacity
+ );
+ textChildren.add(child);
}
- textChildren.add(
- new EditableText(value: _editableValue, focused: focused)
- );
+
+ textChildren.add(new EditableText(
+ value: _editableValue,
+ focused: focused,
+ style: textStyle,
+ cursorColor: Theme.of(this).primary[200]
+ ));
Border focusHighlight = new Border(bottom: new BorderSide(
- color: focused ? Blue[400] : Grey[200],
+ color: focused ? Theme.of(this).primary[400] : Theme.of(this).primary[200],
width: focused ? 2.0 : 1.0
));
- // TODO(hansmuller): white-space: pre, height: 1.2em.
Container input = new Container(
child: new Stack(textChildren),
- padding: const EdgeDims.only(left: 8.0, right: 8.0, bottom: 12.0),
+ padding: _kTextfieldPadding,
decoration: new BoxDecoration(border: focusHighlight)
);
« no previous file with comments | « sky/sdk/lib/editing/editable_text.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698