Commit b6234414 authored by Adam Barth's avatar Adam Barth

Merge pull request #363 from abarth/empty_cursor

Cursor is tiny when there's no text in an input
parents 71578c8b 69e511d2
...@@ -29,14 +29,11 @@ class RenderEditableParagraph extends RenderParagraph { ...@@ -29,14 +29,11 @@ class RenderEditableParagraph extends RenderParagraph {
_scrollOffset = scrollOffset, _scrollOffset = scrollOffset,
super(text); super(text);
Color _cursorColor;
bool _showCursor;
SizeChangedCallback onContentSizeChanged; SizeChangedCallback onContentSizeChanged;
Offset _scrollOffset;
Size _contentSize; Size _contentSize;
Color get cursorColor => _cursorColor; Color get cursorColor => _cursorColor;
Color _cursorColor;
void set cursorColor(Color value) { void set cursorColor(Color value) {
if (_cursorColor == value) if (_cursorColor == value)
return; return;
...@@ -45,6 +42,7 @@ class RenderEditableParagraph extends RenderParagraph { ...@@ -45,6 +42,7 @@ class RenderEditableParagraph extends RenderParagraph {
} }
bool get showCursor => _showCursor; bool get showCursor => _showCursor;
bool _showCursor;
void set showCursor(bool value) { void set showCursor(bool value) {
if (_showCursor == value) if (_showCursor == value)
return; return;
...@@ -53,6 +51,7 @@ class RenderEditableParagraph extends RenderParagraph { ...@@ -53,6 +51,7 @@ class RenderEditableParagraph extends RenderParagraph {
} }
Offset get scrollOffset => _scrollOffset; Offset get scrollOffset => _scrollOffset;
Offset _scrollOffset;
void set scrollOffset(Offset value) { void set scrollOffset(Offset value) {
if (_scrollOffset == value) if (_scrollOffset == value)
return; return;
......
...@@ -222,6 +222,8 @@ class EditableTextState extends State<EditableText> { ...@@ -222,6 +222,8 @@ class EditableTextState extends State<EditableText> {
} }
} }
final String _kZeroWidthSpace = new String.fromCharCode(0x200B);
class _EditableTextWidget extends LeafRenderObjectWidget { class _EditableTextWidget extends LeafRenderObjectWidget {
_EditableTextWidget({ _EditableTextWidget({
Key key, Key key,
...@@ -275,8 +277,9 @@ class _EditableTextWidget extends LeafRenderObjectWidget { ...@@ -275,8 +277,9 @@ class _EditableTextWidget extends LeafRenderObjectWidget {
]); ]);
} }
String text = value.text;
return new StyledTextSpan(style, <TextSpan>[ return new StyledTextSpan(style, <TextSpan>[
new PlainTextSpan(value.text) new PlainTextSpan(text.isEmpty ? _kZeroWidthSpace : text)
]); ]);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment