From 1fd3d6c3c9340210922a096e3a69bd2ccf42f984 Mon Sep 17 00:00:00 2001 From: Justin McCandless Date: Tue, 28 Jun 2022 10:14:50 -0700 Subject: [PATCH] Make TextInputClient a mixin (#104291) TextInputClient and DeltaTextInputClient are now mixins, which helps with breaking changes and future deltas work --- packages/flutter/lib/src/services/text_input.dart | 8 ++------ packages/flutter/lib/src/widgets/editable_text.dart | 2 +- packages/flutter/test/services/text_input_test.dart | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/flutter/lib/src/services/text_input.dart b/packages/flutter/lib/src/services/text_input.dart index 85a324410791..52cc6a5238eb 100644 --- a/packages/flutter/lib/src/services/text_input.dart +++ b/packages/flutter/lib/src/services/text_input.dart @@ -1086,11 +1086,7 @@ mixin TextSelectionDelegate { /// * [EditableText], a [TextInputClient] implementation. /// * [DeltaTextInputClient], a [TextInputClient] extension that receives /// granular information from the platform's text input. -abstract class TextInputClient { - /// Abstract const constructor. This constructor enables subclasses to provide - /// const constructors so that they can be used in const expressions. - const TextInputClient(); - +mixin TextInputClient { /// The current state of the [TextEditingValue] held by this client. TextEditingValue? get currentTextEditingValue; @@ -1225,7 +1221,7 @@ class SelectionRect { /// * [TextInputConfiguration], to opt-in to receive [TextEditingDelta]'s from /// the platforms [TextInput] you must set [TextInputConfiguration.enableDeltaModel] /// to true. -abstract class DeltaTextInputClient extends TextInputClient { +mixin DeltaTextInputClient implements TextInputClient { /// Requests that this client update its editing state by applying the deltas /// received from the engine. /// diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart index 640a7c1573a4..2d201a3bf503 100644 --- a/packages/flutter/lib/src/widgets/editable_text.dart +++ b/packages/flutter/lib/src/widgets/editable_text.dart @@ -1676,7 +1676,7 @@ class EditableText extends StatefulWidget { } /// State for a [EditableText]. -class EditableTextState extends State with AutomaticKeepAliveClientMixin, WidgetsBindingObserver, TickerProviderStateMixin, TextSelectionDelegate implements TextInputClient, AutofillClient { +class EditableTextState extends State with AutomaticKeepAliveClientMixin, WidgetsBindingObserver, TickerProviderStateMixin, TextSelectionDelegate, TextInputClient implements AutofillClient { Timer? _cursorTimer; AnimationController get _cursorBlinkOpacityController { return _backingCursorBlinkOpacityController ??= AnimationController( diff --git a/packages/flutter/test/services/text_input_test.dart b/packages/flutter/test/services/text_input_test.dart index 3e53b67ec608..426ca8166d42 100644 --- a/packages/flutter/test/services/text_input_test.dart +++ b/packages/flutter/test/services/text_input_test.dart @@ -701,7 +701,7 @@ void main() { }); } -class FakeTextInputClient implements TextInputClient { +class FakeTextInputClient with TextInputClient { FakeTextInputClient(this.currentTextEditingValue); String latestMethodCall = '';