Add fadeDuration back to TextSelectionOverlay (#100381)

* Add fadeDuration back to TextSelectionOverlay

* fix build and add dart fix

* format

* add test
This commit is contained in:
chunhtai
2022-03-18 13:05:18 -07:00
committed by GitHub
parent 6b3c30c12e
commit c98cb4a450
9 changed files with 43 additions and 0 deletions

View File

@@ -17,6 +17,20 @@
version: 1
transforms:
# Changes made in https://github.com/flutter/flutter/pull/100381
- title: "Migrate 'TextSelectionOverlay.fadeDuration' to SelectionOverlay.fadeDuration"
date: 2022-03-18
element:
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
field: 'fadeDuration'
inClass: 'TextSelectionOverlay'
changes:
- kind: 'replacedBy'
newElement:
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
field: 'fadeDuration'
inClass: 'SelectionOverlay'
# Changes made in https://github.com/flutter/flutter/pull/96174
- title: "Migrate 'useDeleteButtonTooltip' to 'deleteButtonTooltipMessage'"
date: 2022-01-05

View File

@@ -303,6 +303,13 @@ class TextSelectionOverlay {
);
}
/// Controls the fade-in and fade-out animations for the toolbar and handles.
@Deprecated(
'Use `SelectionOverlay.fadeDuration` instead. '
'This feature was deprecated after v2.12.0-4.1.pre.'
)
static const Duration fadeDuration = SelectionOverlay.fadeDuration;
// TODO(mpcomplete): what if the renderObject is removed or replaced, or
// moves? Not sure what cases I need to handle, or how to handle them.
/// The editable line in which the selected text is being displayed.

View File

@@ -91,6 +91,10 @@ void main() {
);
}
test('TextSelectionOverlay.fadeDuration exist', () async {
expect(TextSelectionOverlay.fadeDuration, SelectionOverlay.fadeDuration);
});
testWidgets('a series of taps all call onTaps', (WidgetTester tester) async {
await pumpGestureDetector(tester);
await tester.tapAt(const Offset(200, 200));

View File

@@ -226,4 +226,7 @@ void main() {
bool nowShowing = scrollbar.isAlwaysShown;
RawScrollbar rawScrollbar = RawScrollbar(isAlwaysShown: true);
nowShowing = rawScrollbar.isAlwaysShown;
// Change made in https://github.com/flutter/flutter/pull/100381
TextSelectionOverlay.fadeDuration;
}

View File

@@ -226,4 +226,7 @@ void main() {
bool nowShowing = scrollbar.thumbVisibility;
RawScrollbar rawScrollbar = RawScrollbar(thumbVisibility: true);
nowShowing = rawScrollbar.thumbVisibility;
// Change made in https://github.com/flutter/flutter/pull/100381
SelectionOverlay.fadeDuration;
}

View File

@@ -551,4 +551,7 @@ void main() {
rawChip = RawChip(useDeleteButtonTooltip: true);
rawChip = RawChip(useDeleteButtonTooltip: false, deleteButtonTooltipMessage: 'Delete Tooltip');
rawChip.useDeleteButtonTooltip;
// Change made in https://github.com/flutter/flutter/pull/100381
TextSelectionOverlay.fadeDuration;
}

View File

@@ -524,4 +524,7 @@ void main() {
rawChip = RawChip();
rawChip = RawChip(deleteButtonTooltipMessage: 'Delete Tooltip');
rawChip.deleteButtonTooltipMessage;
// Change made in https://github.com/flutter/flutter/pull/100381
SelectionOverlay.fadeDuration;
}

View File

@@ -181,4 +181,7 @@ void main() {
// Changes made in https://github.com/flutter/flutter/pull/96957
RawScrollbar rawScrollbar = RawScrollbar(isAlwaysShown: true);
nowShowing = rawScrollbar.isAlwaysShown;
// Change made in https://github.com/flutter/flutter/pull/100381
TextSelectionOverlay.fadeDuration;
}

View File

@@ -181,4 +181,7 @@ void main() {
// Changes made in https://github.com/flutter/flutter/pull/96957
RawScrollbar rawScrollbar = RawScrollbar(thumbVisibility: true);
nowShowing = rawScrollbar.thumbVisibility;
// Change made in https://github.com/flutter/flutter/pull/100381
SelectionOverlay.fadeDuration;
}