Skip to content

Commit

Permalink
Make TextInputClient a mixin (#104291)
Browse files Browse the repository at this point in the history
TextInputClient and DeltaTextInputClient are now mixins, which helps with breaking changes and future deltas work
  • Loading branch information
justinmc authored Jun 28, 2022
1 parent 28311e8 commit 1fd3d6c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions packages/flutter/lib/src/services/text_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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.
///
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/widgets/editable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,7 @@ class EditableText extends StatefulWidget {
}

/// 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;
AnimationController get _cursorBlinkOpacityController {
return _backingCursorBlinkOpacityController ??= AnimationController(
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/test/services/text_input_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ void main() {
});
}

class FakeTextInputClient implements TextInputClient {
class FakeTextInputClient with TextInputClient {
FakeTextInputClient(this.currentTextEditingValue);

String latestMethodCall = '';
Expand Down

0 comments on commit 1fd3d6c

Please sign in to comment.