Unverified Commit e3c3d6eb authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

text selection affinity can be null on web (#62778)

parent 2b51ac6f
...@@ -594,7 +594,7 @@ class TextInputConfiguration { ...@@ -594,7 +594,7 @@ class TextInputConfiguration {
} }
} }
TextAffinity? _toTextAffinity(String affinity) { TextAffinity? _toTextAffinity(String? affinity) {
switch (affinity) { switch (affinity) {
case 'TextAffinity.downstream': case 'TextAffinity.downstream':
return TextAffinity.downstream; return TextAffinity.downstream;
...@@ -662,7 +662,7 @@ class TextEditingValue { ...@@ -662,7 +662,7 @@ class TextEditingValue {
selection: TextSelection( selection: TextSelection(
baseOffset: encoded['selectionBase'] as int? ?? -1, baseOffset: encoded['selectionBase'] as int? ?? -1,
extentOffset: encoded['selectionExtent'] as int? ?? -1, extentOffset: encoded['selectionExtent'] as int? ?? -1,
affinity: _toTextAffinity(encoded['selectionAffinity'] as String) ?? TextAffinity.downstream, affinity: _toTextAffinity(encoded['selectionAffinity'] as String?) ?? TextAffinity.downstream,
isDirectional: encoded['selectionIsDirectional'] as bool? ?? false, isDirectional: encoded['selectionIsDirectional'] as bool? ?? false,
), ),
composing: TextRange( composing: TextRange(
......
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