Unverified Commit 4e7a07af authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

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. âœ
parent cba7daf3
...@@ -279,16 +279,6 @@ abstract interface class DeletableChipAttributes { ...@@ -279,16 +279,6 @@ abstract interface class DeletableChipAttributes {
/// If null, the default [MaterialLocalizations.deleteButtonTooltip] will be /// If null, the default [MaterialLocalizations.deleteButtonTooltip] will be
/// used. /// used.
String? get deleteButtonTooltipMessage; 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. /// An interface for Material Design chips that can have check marks.
...@@ -597,11 +587,6 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri ...@@ -597,11 +587,6 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri
this.shadowColor, this.shadowColor,
this.surfaceTintColor, this.surfaceTintColor,
this.iconTheme, 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); }) : assert(elevation == null || elevation >= 0.0);
@override @override
...@@ -648,12 +633,6 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri ...@@ -648,12 +633,6 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri
final Color? surfaceTintColor; final Color? surfaceTintColor;
@override @override
final IconThemeData? iconTheme; final IconThemeData? iconTheme;
@override
@Deprecated(
'Migrate to deleteButtonTooltipMessage. '
'This feature was deprecated after v2.10.0-0.3.pre.'
)
final bool useDeleteButtonTooltip;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -666,7 +645,6 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri ...@@ -666,7 +645,6 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri
deleteIcon: deleteIcon, deleteIcon: deleteIcon,
onDeleted: onDeleted, onDeleted: onDeleted,
deleteIconColor: deleteIconColor, deleteIconColor: deleteIconColor,
useDeleteButtonTooltip: useDeleteButtonTooltip,
deleteButtonTooltipMessage: deleteButtonTooltipMessage, deleteButtonTooltipMessage: deleteButtonTooltipMessage,
tapEnabled: false, tapEnabled: false,
side: side, side: side,
...@@ -771,11 +749,6 @@ class RawChip extends StatefulWidget ...@@ -771,11 +749,6 @@ class RawChip extends StatefulWidget
this.showCheckmark, this.showCheckmark,
this.checkmarkColor, this.checkmarkColor,
this.avatarBorder = const CircleBorder(), 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(pressElevation == null || pressElevation >= 0.0),
assert(elevation == null || elevation >= 0.0), assert(elevation == null || elevation >= 0.0),
deleteIcon = deleteIcon ?? _kDefaultDeleteIcon; deleteIcon = deleteIcon ?? _kDefaultDeleteIcon;
...@@ -855,12 +828,6 @@ class RawChip extends StatefulWidget ...@@ -855,12 +828,6 @@ class RawChip extends StatefulWidget
final Color? checkmarkColor; final Color? checkmarkColor;
@override @override
final ShapeBorder avatarBorder; 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 /// If set, this indicates that the chip should be disabled if all of the
/// tap callbacks ([onSelected], [onPressed]) are null. /// tap callbacks ([onSelected], [onPressed]) are null.
...@@ -1159,9 +1126,8 @@ class _RawChipState extends State<RawChip> with MaterialStateMixin, TickerProvid ...@@ -1159,9 +1126,8 @@ class _RawChipState extends State<RawChip> with MaterialStateMixin, TickerProvid
container: true, container: true,
button: true, button: true,
child: _wrapWithTooltip( child: _wrapWithTooltip(
tooltip: widget.useDeleteButtonTooltip tooltip: widget.deleteButtonTooltipMessage
? widget.deleteButtonTooltipMessage ?? MaterialLocalizations.of(context).deleteButtonTooltip ?? MaterialLocalizations.of(context).deleteButtonTooltip,
: null,
enabled: widget.onDeleted != null, enabled: widget.onDeleted != null,
child: InkWell( child: InkWell(
// Radius should be slightly less than the full size of the chip. // Radius should be slightly less than the full size of the chip.
......
...@@ -123,11 +123,6 @@ class InputChip extends StatelessWidget ...@@ -123,11 +123,6 @@ class InputChip extends StatelessWidget
this.showCheckmark, this.showCheckmark,
this.checkmarkColor, this.checkmarkColor,
this.avatarBorder = const CircleBorder(), 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(pressElevation == null || pressElevation >= 0.0),
assert(elevation == null || elevation >= 0.0); assert(elevation == null || elevation >= 0.0);
...@@ -199,12 +194,6 @@ class InputChip extends StatelessWidget ...@@ -199,12 +194,6 @@ class InputChip extends StatelessWidget
final ShapeBorder avatarBorder; final ShapeBorder avatarBorder;
@override @override
final IconThemeData? iconTheme; final IconThemeData? iconTheme;
@override
@Deprecated(
'Migrate to deleteButtonTooltipMessage. '
'This feature was deprecated after v2.10.0-0.3.pre.'
)
final bool useDeleteButtonTooltip;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -223,7 +212,6 @@ class InputChip extends StatelessWidget ...@@ -223,7 +212,6 @@ class InputChip extends StatelessWidget
deleteIcon: resolvedDeleteIcon, deleteIcon: resolvedDeleteIcon,
onDeleted: onDeleted, onDeleted: onDeleted,
deleteIconColor: deleteIconColor, deleteIconColor: deleteIconColor,
useDeleteButtonTooltip: useDeleteButtonTooltip,
deleteButtonTooltipMessage: deleteButtonTooltipMessage, deleteButtonTooltipMessage: deleteButtonTooltipMessage,
onSelected: onSelected, onSelected: onSelected,
onPressed: onPressed, onPressed: onPressed,
......
...@@ -138,7 +138,6 @@ Widget chipWithOptionalDeleteButton({ ...@@ -138,7 +138,6 @@ Widget chipWithOptionalDeleteButton({
Key? labelKey, Key? labelKey,
required bool deletable, required bool deletable,
TextDirection textDirection = TextDirection.ltr, TextDirection textDirection = TextDirection.ltr,
bool useDeleteButtonTooltip = true,
String? chipTooltip, String? chipTooltip,
String? deleteButtonTooltipMessage, String? deleteButtonTooltipMessage,
VoidCallback? onPressed = doNothing, VoidCallback? onPressed = doNothing,
...@@ -154,7 +153,6 @@ Widget chipWithOptionalDeleteButton({ ...@@ -154,7 +153,6 @@ Widget chipWithOptionalDeleteButton({
onPressed: onPressed, onPressed: onPressed,
onDeleted: deletable ? doNothing : null, onDeleted: deletable ? doNothing : null,
deleteIcon: Icon(Icons.close, key: deleteButtonKey), deleteIcon: Icon(Icons.close, key: deleteButtonKey),
useDeleteButtonTooltip: useDeleteButtonTooltip,
deleteButtonTooltipMessage: deleteButtonTooltipMessage, deleteButtonTooltipMessage: deleteButtonTooltipMessage,
label: Text( label: Text(
deletable deletable
...@@ -3204,31 +3202,6 @@ void main() { ...@@ -3204,31 +3202,6 @@ void main() {
expect(box.size, equals(const Size(128, 24.0 + 16.0))); 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 { testWidgetsWithLeakTracking('Chip delete button tooltip is disabled if deleteButtonTooltipMessage is empty', (WidgetTester tester) async {
final UniqueKey deleteButtonKey = UniqueKey(); final UniqueKey deleteButtonKey = UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
......
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