Remove chip tooltip deprecations (#134486)

Part of https://github.com/flutter/flutter/issues/133171

These deprecations were introduced in https://github.com/flutter/flutter/pull/96174
The replacement is to use `deleteButtonTooltipMessage`.
This migration is supported by dart fix. âœ
This commit is contained in:
Kate Lovett 2023-09-12 13:23:52 -05:00 committed by GitHub
parent cba7daf3ce
commit 4e7a07af88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 75 deletions

View file

@ -279,16 +279,6 @@ abstract interface class DeletableChipAttributes {
/// If null, the default [MaterialLocalizations.deleteButtonTooltip] will be
/// used.
String? get deleteButtonTooltipMessage;
/// Whether to use a tooltip on the chip's delete button showing the
/// [deleteButtonTooltipMessage].
///
/// Defaults to true.
@Deprecated(
'Migrate to deleteButtonTooltipMessage. '
'This feature was deprecated after v2.10.0-0.3.pre.'
)
bool get useDeleteButtonTooltip;
}
/// An interface for Material Design chips that can have check marks.
@ -597,11 +587,6 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri
this.shadowColor,
this.surfaceTintColor,
this.iconTheme,
@Deprecated(
'Migrate to deleteButtonTooltipMessage. '
'This feature was deprecated after v2.10.0-0.3.pre.'
)
this.useDeleteButtonTooltip = true,
}) : assert(elevation == null || elevation >= 0.0);
@override
@ -648,12 +633,6 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri
final Color? surfaceTintColor;
@override
final IconThemeData? iconTheme;
@override
@Deprecated(
'Migrate to deleteButtonTooltipMessage. '
'This feature was deprecated after v2.10.0-0.3.pre.'
)
final bool useDeleteButtonTooltip;
@override
Widget build(BuildContext context) {
@ -666,7 +645,6 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri
deleteIcon: deleteIcon,
onDeleted: onDeleted,
deleteIconColor: deleteIconColor,
useDeleteButtonTooltip: useDeleteButtonTooltip,
deleteButtonTooltipMessage: deleteButtonTooltipMessage,
tapEnabled: false,
side: side,
@ -771,11 +749,6 @@ class RawChip extends StatefulWidget
this.showCheckmark,
this.checkmarkColor,
this.avatarBorder = const CircleBorder(),
@Deprecated(
'Migrate to deleteButtonTooltipMessage. '
'This feature was deprecated after v2.10.0-0.3.pre.'
)
this.useDeleteButtonTooltip = true,
}) : assert(pressElevation == null || pressElevation >= 0.0),
assert(elevation == null || elevation >= 0.0),
deleteIcon = deleteIcon ?? _kDefaultDeleteIcon;
@ -855,12 +828,6 @@ class RawChip extends StatefulWidget
final Color? checkmarkColor;
@override
final ShapeBorder avatarBorder;
@override
@Deprecated(
'Migrate to deleteButtonTooltipMessage. '
'This feature was deprecated after v2.10.0-0.3.pre.'
)
final bool useDeleteButtonTooltip;
/// If set, this indicates that the chip should be disabled if all of the
/// tap callbacks ([onSelected], [onPressed]) are null.
@ -1159,9 +1126,8 @@ class _RawChipState extends State<RawChip> with MaterialStateMixin, TickerProvid
container: true,
button: true,
child: _wrapWithTooltip(
tooltip: widget.useDeleteButtonTooltip
? widget.deleteButtonTooltipMessage ?? MaterialLocalizations.of(context).deleteButtonTooltip
: null,
tooltip: widget.deleteButtonTooltipMessage
?? MaterialLocalizations.of(context).deleteButtonTooltip,
enabled: widget.onDeleted != null,
child: InkWell(
// Radius should be slightly less than the full size of the chip.

View file

@ -123,11 +123,6 @@ class InputChip extends StatelessWidget
this.showCheckmark,
this.checkmarkColor,
this.avatarBorder = const CircleBorder(),
@Deprecated(
'Migrate to deleteButtonTooltipMessage. '
'This feature was deprecated after v2.10.0-0.3.pre.'
)
this.useDeleteButtonTooltip = true,
}) : assert(pressElevation == null || pressElevation >= 0.0),
assert(elevation == null || elevation >= 0.0);
@ -199,12 +194,6 @@ class InputChip extends StatelessWidget
final ShapeBorder avatarBorder;
@override
final IconThemeData? iconTheme;
@override
@Deprecated(
'Migrate to deleteButtonTooltipMessage. '
'This feature was deprecated after v2.10.0-0.3.pre.'
)
final bool useDeleteButtonTooltip;
@override
Widget build(BuildContext context) {
@ -223,7 +212,6 @@ class InputChip extends StatelessWidget
deleteIcon: resolvedDeleteIcon,
onDeleted: onDeleted,
deleteIconColor: deleteIconColor,
useDeleteButtonTooltip: useDeleteButtonTooltip,
deleteButtonTooltipMessage: deleteButtonTooltipMessage,
onSelected: onSelected,
onPressed: onPressed,

View file

@ -138,7 +138,6 @@ Widget chipWithOptionalDeleteButton({
Key? labelKey,
required bool deletable,
TextDirection textDirection = TextDirection.ltr,
bool useDeleteButtonTooltip = true,
String? chipTooltip,
String? deleteButtonTooltipMessage,
VoidCallback? onPressed = doNothing,
@ -154,7 +153,6 @@ Widget chipWithOptionalDeleteButton({
onPressed: onPressed,
onDeleted: deletable ? doNothing : null,
deleteIcon: Icon(Icons.close, key: deleteButtonKey),
useDeleteButtonTooltip: useDeleteButtonTooltip,
deleteButtonTooltipMessage: deleteButtonTooltipMessage,
label: Text(
deletable
@ -3204,31 +3202,6 @@ void main() {
expect(box.size, equals(const Size(128, 24.0 + 16.0)));
});
testWidgetsWithLeakTracking('Chip delete button tooltip can be disabled using useDeleteButtonTooltip', (WidgetTester tester) async {
await tester.pumpWidget(
chipWithOptionalDeleteButton(
deletable: true,
useDeleteButtonTooltip: false,
),
);
// Tap at the delete icon of the chip, which is at the right side of the
// chip
final Offset topRightOfInkwell = tester.getTopLeft(find.byType(InkWell).first);
final Offset tapLocationOfDeleteButton = topRightOfInkwell + const Offset(8, 8);
final TestGesture tapGesture = await tester.startGesture(tapLocationOfDeleteButton);
await tester.pump();
// Wait for some more time while pressing and holding the delete button
await tester.pumpAndSettle();
// There should be no delete button tooltip
expect(findTooltipContainer('Delete'), findsNothing);
await tapGesture.up();
});
testWidgetsWithLeakTracking('Chip delete button tooltip is disabled if deleteButtonTooltipMessage is empty', (WidgetTester tester) async {
final UniqueKey deleteButtonKey = UniqueKey();
await tester.pumpWidget(