Unverified Commit 1fd3d6c3 authored by Justin McCandless's avatar Justin McCandless Committed by GitHub

Make TextInputClient a mixin (#104291)

TextInputClient and DeltaTextInputClient are now mixins, which helps with breaking changes and future deltas work
parent 28311e8b
...@@ -1086,11 +1086,7 @@ mixin TextSelectionDelegate { ...@@ -1086,11 +1086,7 @@ mixin TextSelectionDelegate {
/// * [EditableText], a [TextInputClient] implementation. /// * [EditableText], a [TextInputClient] implementation.
/// * [DeltaTextInputClient], a [TextInputClient] extension that receives /// * [DeltaTextInputClient], a [TextInputClient] extension that receives
/// granular information from the platform's text input. /// granular information from the platform's text input.
abstract class TextInputClient { mixin TextInputClient {
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const TextInputClient();
/// The current state of the [TextEditingValue] held by this client. /// The current state of the [TextEditingValue] held by this client.
TextEditingValue? get currentTextEditingValue; TextEditingValue? get currentTextEditingValue;
...@@ -1225,7 +1221,7 @@ class SelectionRect { ...@@ -1225,7 +1221,7 @@ class SelectionRect {
/// * [TextInputConfiguration], to opt-in to receive [TextEditingDelta]'s from /// * [TextInputConfiguration], to opt-in to receive [TextEditingDelta]'s from
/// the platforms [TextInput] you must set [TextInputConfiguration.enableDeltaModel] /// the platforms [TextInput] you must set [TextInputConfiguration.enableDeltaModel]
/// to true. /// to true.
abstract class DeltaTextInputClient extends TextInputClient { mixin DeltaTextInputClient implements TextInputClient {
/// Requests that this client update its editing state by applying the deltas /// Requests that this client update its editing state by applying the deltas
/// received from the engine. /// received from the engine.
/// ///
......
...@@ -1676,7 +1676,7 @@ class EditableText extends StatefulWidget { ...@@ -1676,7 +1676,7 @@ class EditableText extends StatefulWidget {
} }
/// State for a [EditableText]. /// State for a [EditableText].
class EditableTextState extends State<EditableText> with AutomaticKeepAliveClientMixin<EditableText>, WidgetsBindingObserver, TickerProviderStateMixin<EditableText>, TextSelectionDelegate implements TextInputClient, AutofillClient { class EditableTextState extends State<EditableText> with AutomaticKeepAliveClientMixin<EditableText>, WidgetsBindingObserver, TickerProviderStateMixin<EditableText>, TextSelectionDelegate, TextInputClient implements AutofillClient {
Timer? _cursorTimer; Timer? _cursorTimer;
AnimationController get _cursorBlinkOpacityController { AnimationController get _cursorBlinkOpacityController {
return _backingCursorBlinkOpacityController ??= AnimationController( return _backingCursorBlinkOpacityController ??= AnimationController(
......
...@@ -701,7 +701,7 @@ void main() { ...@@ -701,7 +701,7 @@ void main() {
}); });
} }
class FakeTextInputClient implements TextInputClient { class FakeTextInputClient with TextInputClient {
FakeTextInputClient(this.currentTextEditingValue); FakeTextInputClient(this.currentTextEditingValue);
String latestMethodCall = ''; String latestMethodCall = '';
......
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