Skip to content

Commit 1fd3d6c

Browse files
authored
Make TextInputClient a mixin (#104291)
TextInputClient and DeltaTextInputClient are now mixins, which helps with breaking changes and future deltas work
1 parent 28311e8 commit 1fd3d6c

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

packages/flutter/lib/src/services/text_input.dart

+2-6
Original file line numberDiff line numberDiff line change
@@ -1086,11 +1086,7 @@ mixin TextSelectionDelegate {
10861086
/// * [EditableText], a [TextInputClient] implementation.
10871087
/// * [DeltaTextInputClient], a [TextInputClient] extension that receives
10881088
/// granular information from the platform's text input.
1089-
abstract class TextInputClient {
1090-
/// Abstract const constructor. This constructor enables subclasses to provide
1091-
/// const constructors so that they can be used in const expressions.
1092-
const TextInputClient();
1093-
1089+
mixin TextInputClient {
10941090
/// The current state of the [TextEditingValue] held by this client.
10951091
TextEditingValue? get currentTextEditingValue;
10961092

@@ -1225,7 +1221,7 @@ class SelectionRect {
12251221
/// * [TextInputConfiguration], to opt-in to receive [TextEditingDelta]'s from
12261222
/// the platforms [TextInput] you must set [TextInputConfiguration.enableDeltaModel]
12271223
/// to true.
1228-
abstract class DeltaTextInputClient extends TextInputClient {
1224+
mixin DeltaTextInputClient implements TextInputClient {
12291225
/// Requests that this client update its editing state by applying the deltas
12301226
/// received from the engine.
12311227
///

packages/flutter/lib/src/widgets/editable_text.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ class EditableText extends StatefulWidget {
16761676
}
16771677

16781678
/// State for a [EditableText].
1679-
class EditableTextState extends State<EditableText> with AutomaticKeepAliveClientMixin<EditableText>, WidgetsBindingObserver, TickerProviderStateMixin<EditableText>, TextSelectionDelegate implements TextInputClient, AutofillClient {
1679+
class EditableTextState extends State<EditableText> with AutomaticKeepAliveClientMixin<EditableText>, WidgetsBindingObserver, TickerProviderStateMixin<EditableText>, TextSelectionDelegate, TextInputClient implements AutofillClient {
16801680
Timer? _cursorTimer;
16811681
AnimationController get _cursorBlinkOpacityController {
16821682
return _backingCursorBlinkOpacityController ??= AnimationController(

packages/flutter/test/services/text_input_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ void main() {
701701
});
702702
}
703703

704-
class FakeTextInputClient implements TextInputClient {
704+
class FakeTextInputClient with TextInputClient {
705705
FakeTextInputClient(this.currentTextEditingValue);
706706

707707
String latestMethodCall = '';

0 commit comments

Comments
 (0)