-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SuperTextField] Fix text capitalization configuration (Resolves #1617)…
… (#1619)
- Loading branch information
1 parent
ab19396
commit 67c0332
Showing
6 changed files
with
206 additions
and
1 deletion.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
super_editor/lib/src/infrastructure/flutter/text_input_configuration.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import 'package:collection/collection.dart'; | ||
import 'package:flutter/services.dart'; | ||
|
||
extension TextInputConfigurationEquivalency on TextInputConfiguration { | ||
/// Whether this [TextInputConfiguration] is equivalent to [other]. | ||
/// | ||
/// Two [TextInputConfiguration]s are considered to be equal | ||
/// if all properties are equal. | ||
bool isEquivalentTo(TextInputConfiguration other) { | ||
return inputType == other.inputType && | ||
readOnly == other.readOnly && | ||
obscureText == other.obscureText && | ||
autocorrect == other.autocorrect && | ||
autofillConfiguration.isEquivalentTo(other.autofillConfiguration) && | ||
smartDashesType == other.smartDashesType && | ||
smartQuotesType == other.smartQuotesType && | ||
enableSuggestions == other.enableSuggestions && | ||
enableInteractiveSelection == other.enableInteractiveSelection && | ||
actionLabel == other.actionLabel && | ||
inputAction == other.inputAction && | ||
textCapitalization == other.textCapitalization && | ||
keyboardAppearance == other.keyboardAppearance && | ||
enableIMEPersonalizedLearning == other.enableIMEPersonalizedLearning && | ||
enableDeltaModel == other.enableDeltaModel && | ||
const DeepCollectionEquality().equals(allowedMimeTypes, other.allowedMimeTypes); | ||
} | ||
} | ||
|
||
extension AutofillConfigurationEquivalency on AutofillConfiguration { | ||
/// Whether this [AutofillConfiguration] is equivalent to [other]. | ||
/// | ||
/// Two [AutofillConfiguration]s are considered to be equal | ||
/// if all properties are equal. | ||
/// | ||
/// The [currentEditingValue] isn't considered in the comparison. | ||
/// Otherwise, whenever the user changes the text or selection | ||
/// would result in two configurations being unequal. | ||
bool isEquivalentTo(AutofillConfiguration other) { | ||
return enabled == other.enabled && | ||
uniqueIdentifier == other.uniqueIdentifier && | ||
const DeepCollectionEquality().equals(autofillHints, other.autofillHints) && | ||
hintText == other.hintText; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters