Unverified Commit 8a815c1d authored by chunhtai's avatar chunhtai Committed by GitHub

Remove unecessary reference to ClipboardStatusNotifier (#125255)

fixes https://github.com/flutter/flutter/issues/99360
parent baafa199
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/foundation.dart' show clampDouble; import 'package:flutter/foundation.dart' show ValueListenable, clampDouble;
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'desktop_text_selection_toolbar.dart'; import 'desktop_text_selection_toolbar.dart';
...@@ -40,7 +40,7 @@ class CupertinoDesktopTextSelectionControls extends TextSelectionControls { ...@@ -40,7 +40,7 @@ class CupertinoDesktopTextSelectionControls extends TextSelectionControls {
Offset selectionMidpoint, Offset selectionMidpoint,
List<TextSelectionPoint> endpoints, List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate, TextSelectionDelegate delegate,
ClipboardStatusNotifier? clipboardStatus, ValueListenable<ClipboardStatus>? clipboardStatus,
Offset? lastSecondaryTapDownPosition, Offset? lastSecondaryTapDownPosition,
) { ) {
return _CupertinoDesktopTextSelectionControlsToolbar( return _CupertinoDesktopTextSelectionControlsToolbar(
...@@ -107,7 +107,7 @@ class _CupertinoDesktopTextSelectionControlsToolbar extends StatefulWidget { ...@@ -107,7 +107,7 @@ class _CupertinoDesktopTextSelectionControlsToolbar extends StatefulWidget {
required this.lastSecondaryTapDownPosition, required this.lastSecondaryTapDownPosition,
}); });
final ClipboardStatusNotifier? clipboardStatus; final ValueListenable<ClipboardStatus>? clipboardStatus;
final List<TextSelectionPoint> endpoints; final List<TextSelectionPoint> endpoints;
final Rect globalEditableRegion; final Rect globalEditableRegion;
final VoidCallback? handleCopy; final VoidCallback? handleCopy;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/foundation.dart' show clampDouble; import 'package:flutter/foundation.dart' show ValueListenable, clampDouble;
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'localizations.dart'; import 'localizations.dart';
...@@ -92,7 +92,7 @@ class CupertinoTextSelectionControls extends TextSelectionControls { ...@@ -92,7 +92,7 @@ class CupertinoTextSelectionControls extends TextSelectionControls {
Offset selectionMidpoint, Offset selectionMidpoint,
List<TextSelectionPoint> endpoints, List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate, TextSelectionDelegate delegate,
ValueNotifier<ClipboardStatus>? clipboardStatus, ValueListenable<ClipboardStatus>? clipboardStatus,
Offset? lastSecondaryTapDownPosition, Offset? lastSecondaryTapDownPosition,
) { ) {
return _CupertinoTextSelectionControlsToolbar( return _CupertinoTextSelectionControlsToolbar(
...@@ -209,7 +209,7 @@ class _CupertinoTextSelectionControlsToolbar extends StatefulWidget { ...@@ -209,7 +209,7 @@ class _CupertinoTextSelectionControlsToolbar extends StatefulWidget {
required this.textLineHeight, required this.textLineHeight,
}); });
final ValueNotifier<ClipboardStatus>? clipboardStatus; final ValueListenable<ClipboardStatus>? clipboardStatus;
final List<TextSelectionPoint> endpoints; final List<TextSelectionPoint> endpoints;
final Rect globalEditableRegion; final Rect globalEditableRegion;
final VoidCallback? handleCopy; final VoidCallback? handleCopy;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/foundation.dart' show clampDouble; import 'package:flutter/foundation.dart' show ValueListenable, clampDouble;
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'debug.dart'; import 'debug.dart';
...@@ -41,7 +41,7 @@ class DesktopTextSelectionControls extends TextSelectionControls { ...@@ -41,7 +41,7 @@ class DesktopTextSelectionControls extends TextSelectionControls {
Offset selectionMidpoint, Offset selectionMidpoint,
List<TextSelectionPoint> endpoints, List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate, TextSelectionDelegate delegate,
ClipboardStatusNotifier? clipboardStatus, ValueListenable<ClipboardStatus>? clipboardStatus,
Offset? lastSecondaryTapDownPosition, Offset? lastSecondaryTapDownPosition,
) { ) {
return _DesktopTextSelectionControlsToolbar( return _DesktopTextSelectionControlsToolbar(
...@@ -123,7 +123,7 @@ class _DesktopTextSelectionControlsToolbar extends StatefulWidget { ...@@ -123,7 +123,7 @@ class _DesktopTextSelectionControlsToolbar extends StatefulWidget {
required this.lastSecondaryTapDownPosition, required this.lastSecondaryTapDownPosition,
}); });
final ClipboardStatusNotifier? clipboardStatus; final ValueListenable<ClipboardStatus>? clipboardStatus;
final List<TextSelectionPoint> endpoints; final List<TextSelectionPoint> endpoints;
final Rect globalEditableRegion; final Rect globalEditableRegion;
final VoidCallback? handleCopy; final VoidCallback? handleCopy;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'debug.dart'; import 'debug.dart';
...@@ -52,7 +53,7 @@ class MaterialTextSelectionControls extends TextSelectionControls { ...@@ -52,7 +53,7 @@ class MaterialTextSelectionControls extends TextSelectionControls {
Offset selectionMidpoint, Offset selectionMidpoint,
List<TextSelectionPoint> endpoints, List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate, TextSelectionDelegate delegate,
ClipboardStatusNotifier? clipboardStatus, ValueListenable<ClipboardStatus>? clipboardStatus,
Offset? lastSecondaryTapDownPosition, Offset? lastSecondaryTapDownPosition,
) { ) {
return _TextSelectionControlsToolbar( return _TextSelectionControlsToolbar(
...@@ -163,7 +164,7 @@ class _TextSelectionControlsToolbar extends StatefulWidget { ...@@ -163,7 +164,7 @@ class _TextSelectionControlsToolbar extends StatefulWidget {
required this.textLineHeight, required this.textLineHeight,
}); });
final ClipboardStatusNotifier? clipboardStatus; final ValueListenable<ClipboardStatus>? clipboardStatus;
final TextSelectionDelegate delegate; final TextSelectionDelegate delegate;
final List<TextSelectionPoint> endpoints; final List<TextSelectionPoint> endpoints;
final Rect globalEditableRegion; final Rect globalEditableRegion;
......
...@@ -125,9 +125,7 @@ abstract class TextSelectionControls { ...@@ -125,9 +125,7 @@ abstract class TextSelectionControls {
Offset selectionMidpoint, Offset selectionMidpoint,
List<TextSelectionPoint> endpoints, List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate, TextSelectionDelegate delegate,
// TODO(chunhtai): Change to ValueListenable<ClipboardStatus>? once ValueListenable<ClipboardStatus>? clipboardStatus,
// migration is done. https://github.com/flutter/flutter/issues/99360
ClipboardStatusNotifier? clipboardStatus,
Offset? lastSecondaryTapDownPosition, Offset? lastSecondaryTapDownPosition,
); );
...@@ -200,13 +198,11 @@ abstract class TextSelectionControls { ...@@ -200,13 +198,11 @@ abstract class TextSelectionControls {
/// ///
/// This is called by subclasses when their cut affordance is activated by /// This is called by subclasses when their cut affordance is activated by
/// the user. /// the user.
// TODO(chunhtai): remove optional parameter once migration is done.
// https://github.com/flutter/flutter/issues/99360
@Deprecated( @Deprecated(
'Use `contextMenuBuilder` instead. ' 'Use `contextMenuBuilder` instead. '
'This feature was deprecated after v3.3.0-0.5.pre.', 'This feature was deprecated after v3.3.0-0.5.pre.',
) )
void handleCut(TextSelectionDelegate delegate, [ClipboardStatusNotifier? clipboardStatus]) { void handleCut(TextSelectionDelegate delegate) {
delegate.cutSelection(SelectionChangedCause.toolbar); delegate.cutSelection(SelectionChangedCause.toolbar);
} }
...@@ -214,13 +210,11 @@ abstract class TextSelectionControls { ...@@ -214,13 +210,11 @@ abstract class TextSelectionControls {
/// ///
/// This is called by subclasses when their copy affordance is activated by /// This is called by subclasses when their copy affordance is activated by
/// the user. /// the user.
// TODO(chunhtai): remove optional parameter once migration is done.
// https://github.com/flutter/flutter/issues/99360
@Deprecated( @Deprecated(
'Use `contextMenuBuilder` instead. ' 'Use `contextMenuBuilder` instead. '
'This feature was deprecated after v3.3.0-0.5.pre.', 'This feature was deprecated after v3.3.0-0.5.pre.',
) )
void handleCopy(TextSelectionDelegate delegate, [ClipboardStatusNotifier? clipboardStatus]) { void handleCopy(TextSelectionDelegate delegate) {
delegate.copySelection(SelectionChangedCause.toolbar); delegate.copySelection(SelectionChangedCause.toolbar);
} }
...@@ -3236,10 +3230,6 @@ class ClipboardStatusNotifier extends ValueNotifier<ClipboardStatus> with Widget ...@@ -3236,10 +3230,6 @@ class ClipboardStatusNotifier extends ValueNotifier<ClipboardStatus> with Widget
}) : super(value); }) : super(value);
bool _disposed = false; bool _disposed = false;
// TODO(chunhtai): remove this getter once migration is done.
// https://github.com/flutter/flutter/issues/99360
/// True if this instance has been disposed.
bool get disposed => _disposed;
/// Check the [Clipboard] and update [value] if needed. /// Check the [Clipboard] and update [value] if needed.
Future<void> update() async { Future<void> update() async {
...@@ -3265,7 +3255,6 @@ class ClipboardStatusNotifier extends ValueNotifier<ClipboardStatus> with Widget ...@@ -3265,7 +3255,6 @@ class ClipboardStatusNotifier extends ValueNotifier<ClipboardStatus> with Widget
value = ClipboardStatus.unknown; value = ClipboardStatus.unknown;
return; return;
} }
final ClipboardStatus nextStatus = hasStrings final ClipboardStatus nextStatus = hasStrings
? ClipboardStatus.pasteable ? ClipboardStatus.pasteable
: ClipboardStatus.notPasteable; : ClipboardStatus.notPasteable;
...@@ -3349,7 +3338,7 @@ mixin TextSelectionHandleControls on TextSelectionControls { ...@@ -3349,7 +3338,7 @@ mixin TextSelectionHandleControls on TextSelectionControls {
Offset selectionMidpoint, Offset selectionMidpoint,
List<TextSelectionPoint> endpoints, List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate, TextSelectionDelegate delegate,
ValueNotifier<ClipboardStatus>? clipboardStatus, ValueListenable<ClipboardStatus>? clipboardStatus,
Offset? lastSecondaryTapDownPosition, Offset? lastSecondaryTapDownPosition,
) => const SizedBox.shrink(); ) => const SizedBox.shrink();
......
...@@ -40,7 +40,7 @@ class MockTextSelectionControls extends TextSelectionControls { ...@@ -40,7 +40,7 @@ class MockTextSelectionControls extends TextSelectionControls {
Offset position, Offset position,
List<TextSelectionPoint> endpoints, List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate, TextSelectionDelegate delegate,
ClipboardStatusNotifier? clipboardStatus, ValueListenable<ClipboardStatus>? clipboardStatus,
Offset? lastSecondaryTapDownPosition, Offset? lastSecondaryTapDownPosition,
) { ) {
throw UnimplementedError(); throw UnimplementedError();
......
...@@ -23,7 +23,7 @@ class _CustomCupertinoTextSelectionControls extends CupertinoTextSelectionContro ...@@ -23,7 +23,7 @@ class _CustomCupertinoTextSelectionControls extends CupertinoTextSelectionContro
Offset selectionMidpoint, Offset selectionMidpoint,
List<TextSelectionPoint> endpoints, List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate, TextSelectionDelegate delegate,
ValueNotifier<ClipboardStatus>? clipboardStatus, ValueListenable<ClipboardStatus>? clipboardStatus,
Offset? lastSecondaryTapDownPosition, Offset? lastSecondaryTapDownPosition,
) { ) {
final EdgeInsets mediaQueryPadding = MediaQuery.paddingOf(context); final EdgeInsets mediaQueryPadding = MediaQuery.paddingOf(context);
......
...@@ -20,7 +20,7 @@ class _CustomMaterialTextSelectionControls extends MaterialTextSelectionControls ...@@ -20,7 +20,7 @@ class _CustomMaterialTextSelectionControls extends MaterialTextSelectionControls
Offset selectionMidpoint, Offset selectionMidpoint,
List<TextSelectionPoint> endpoints, List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate, TextSelectionDelegate delegate,
ClipboardStatusNotifier? clipboardStatus, ValueListenable<ClipboardStatus>? clipboardStatus,
Offset? lastSecondaryTapDownPosition, Offset? lastSecondaryTapDownPosition,
) { ) {
final TextSelectionPoint startTextSelectionPoint = endpoints[0]; final TextSelectionPoint startTextSelectionPoint = endpoints[0];
......
...@@ -15978,7 +15978,7 @@ class MockTextSelectionControls extends Fake implements TextSelectionControls { ...@@ -15978,7 +15978,7 @@ class MockTextSelectionControls extends Fake implements TextSelectionControls {
Offset position, Offset position,
List<TextSelectionPoint> endpoints, List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate, TextSelectionDelegate delegate,
ClipboardStatusNotifier? clipboardStatus, ValueListenable<ClipboardStatus>? clipboardStatus,
Offset? lastSecondaryTapDownPosition, Offset? lastSecondaryTapDownPosition,
) { ) {
return const SizedBox(); return const SizedBox();
...@@ -16007,10 +16007,8 @@ class MockTextSelectionControls extends Fake implements TextSelectionControls { ...@@ -16007,10 +16007,8 @@ class MockTextSelectionControls extends Fake implements TextSelectionControls {
int pasteCount = 0; int pasteCount = 0;
int copyCount = 0; int copyCount = 0;
// TODO(chunhtai): remove optional parameter once migration is done.
// https://github.com/flutter/flutter/issues/99360
@override @override
void handleCopy(TextSelectionDelegate delegate, [ClipboardStatusNotifier? clipboardStatus]) { void handleCopy(TextSelectionDelegate delegate) {
copyCount += 1; copyCount += 1;
} }
...@@ -16019,10 +16017,8 @@ class MockTextSelectionControls extends Fake implements TextSelectionControls { ...@@ -16019,10 +16017,8 @@ class MockTextSelectionControls extends Fake implements TextSelectionControls {
pasteCount += 1; pasteCount += 1;
} }
// TODO(chunhtai): remove optional parameter once migration is done.
// https://github.com/flutter/flutter/issues/99360
@override @override
void handleCut(TextSelectionDelegate delegate, [ClipboardStatusNotifier? clipboardStatus]) { void handleCut(TextSelectionDelegate delegate) {
cutCount += 1; cutCount += 1;
} }
...@@ -16062,7 +16058,7 @@ class _CustomTextSelectionControls extends TextSelectionControls { ...@@ -16062,7 +16058,7 @@ class _CustomTextSelectionControls extends TextSelectionControls {
Offset position, Offset position,
List<TextSelectionPoint> endpoints, List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate, TextSelectionDelegate delegate,
ClipboardStatusNotifier? clipboardStatus, ValueListenable<ClipboardStatus>? clipboardStatus,
Offset? lastSecondaryTapDownPosition, Offset? lastSecondaryTapDownPosition,
) { ) {
final Offset selectionMidpoint = position; final Offset selectionMidpoint = position;
...@@ -16120,7 +16116,7 @@ class _CustomTextSelectionControls extends TextSelectionControls { ...@@ -16120,7 +16116,7 @@ class _CustomTextSelectionControls extends TextSelectionControls {
@override @override
void handleCut(TextSelectionDelegate delegate, [ClipboardStatusNotifier? clipboardStatus]) { void handleCut(TextSelectionDelegate delegate, [ClipboardStatusNotifier? clipboardStatus]) {
onCut?.call(); onCut?.call();
return super.handleCut(delegate, clipboardStatus); return super.handleCut(delegate);
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/foundation.dart' show defaultTargetPlatform; import 'package:flutter/foundation.dart' show ValueListenable, defaultTargetPlatform;
import 'package:flutter/gestures.dart' show PointerDeviceKind, kSecondaryButton; import 'package:flutter/gestures.dart' show PointerDeviceKind, kSecondaryButton;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -1836,7 +1836,7 @@ class TextSelectionControlsSpy extends TextSelectionControls { ...@@ -1836,7 +1836,7 @@ class TextSelectionControlsSpy extends TextSelectionControls {
Offset position, Offset position,
List<TextSelectionPoint> endpoints, List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate, TextSelectionDelegate delegate,
ClipboardStatusNotifier? clipboardStatus, ValueListenable<ClipboardStatus>? clipboardStatus,
Offset? lastSecondaryTapDownPosition, Offset? lastSecondaryTapDownPosition,
) { ) {
return Text('dummy', key: toolBarKey); return Text('dummy', key: toolBarKey);
......
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