Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
4621dff8
Unverified
Commit
4621dff8
authored
Jan 28, 2022
by
Anurag Roy
Committed by
GitHub
Jan 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate `useDeleteButtonTooltip` for Chips (#96174)
parent
e854b8cc
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
229 additions
and
26 deletions
+229
-26
fix_data.yaml
packages/flutter/lib/fix_data.yaml
+108
-0
chip.dart
packages/flutter/lib/src/material/chip.dart
+47
-21
chip_test.dart
packages/flutter/test/material/chip_test.dart
+32
-5
material.dart
packages/flutter/test_fixes/material.dart
+21
-0
material.dart.expect
packages/flutter/test_fixes/material.dart.expect
+21
-0
No files found.
packages/flutter/lib/fix_data.yaml
View file @
4621dff8
...
...
@@ -14,6 +14,114 @@
version
:
1
transforms
:
# Changes made in https://github.com/flutter/flutter/pull/96174
-
title
:
"
Migrate
'useDeleteButtonTooltip'
to
'deleteButtonTooltipMessage'"
date
:
2022-01-05
element
:
uris
:
[
'
material.dart'
]
constructor
:
'
'
inClass
:
'
Chip'
changes
:
-
kind
:
'
addParameter'
index
:
9
name
:
'
deleteButtonTooltipMessage'
style
:
optional_named
argumentValue
:
expression
:
"
''"
requiredIf
:
"
useDeleteButtonTooltip
==
'false'
&&
deleteButtonTooltipMessage
==
''"
-
kind
:
'
removeParameter'
name
:
'
useDeleteButtonTooltip'
variables
:
useDeleteButtonTooltip
:
kind
:
'
fragment'
value
:
'
arguments[useDeleteButtonTooltip]'
deleteButtonTooltipMessage
:
kind
:
'
fragment'
value
:
'
arguments[deleteButtonTooltipMessage]'
# Changes made in https://github.com/flutter/flutter/pull/96174
-
title
:
"
Migrate
'useDeleteButtonTooltip'
to
'deleteButtonTooltipMessage'"
date
:
2022-01-05
element
:
uris
:
[
'
material.dart'
]
constructor
:
'
'
inClass
:
'
InputChip'
changes
:
-
kind
:
'
addParameter'
index
:
9
name
:
'
deleteButtonTooltipMessage'
style
:
optional_named
argumentValue
:
expression
:
"
''"
requiredIf
:
"
useDeleteButtonTooltip
==
'false'
&&
deleteButtonTooltipMessage
==
''"
-
kind
:
'
removeParameter'
name
:
'
useDeleteButtonTooltip'
variables
:
useDeleteButtonTooltip
:
kind
:
'
fragment'
value
:
'
arguments[useDeleteButtonTooltip]'
deleteButtonTooltipMessage
:
kind
:
'
fragment'
value
:
'
arguments[deleteButtonTooltipMessage]'
# Changes made in https://github.com/flutter/flutter/pull/96174
-
title
:
"
Migrate
'useDeleteButtonTooltip'
to
'deleteButtonTooltipMessage'"
date
:
2022-01-05
element
:
uris
:
[
'
material.dart'
]
constructor
:
'
'
inClass
:
'
RawChip'
changes
:
-
kind
:
'
addParameter'
index
:
9
name
:
'
deleteButtonTooltipMessage'
style
:
optional_named
argumentValue
:
expression
:
"
''"
requiredIf
:
"
useDeleteButtonTooltip
==
'false'
&&
deleteButtonTooltipMessage
==
''"
-
kind
:
'
removeParameter'
name
:
'
useDeleteButtonTooltip'
variables
:
useDeleteButtonTooltip
:
kind
:
'
fragment'
value
:
'
arguments[useDeleteButtonTooltip]'
deleteButtonTooltipMessage
:
kind
:
'
fragment'
value
:
'
arguments[deleteButtonTooltipMessage]'
# Changes made in https://github.com/flutter/flutter/pull/96174
-
title
:
"
Migrate
'useDeleteButtonTooltip'
to
'deleteButtonTooltipMessage'"
date
:
2022-01-05
element
:
uris
:
[
'
material.dart'
]
field
:
'
useDeleteButtonTooltip'
inClass
:
'
Chip'
changes
:
-
kind
:
'
rename'
newName
:
'
deleteButtonTooltipMessage'
# Changes made in https://github.com/flutter/flutter/pull/96174
-
title
:
"
Migrate
'useDeleteButtonTooltip'
to
'deleteButtonTooltipMessage'"
date
:
2022-01-05
element
:
uris
:
[
'
material.dart'
]
field
:
'
useDeleteButtonTooltip'
inClass
:
'
InputChip'
changes
:
-
kind
:
'
rename'
newName
:
'
deleteButtonTooltipMessage'
# Changes made in https://github.com/flutter/flutter/pull/96174
-
title
:
"
Migrate
'useDeleteButtonTooltip'
to
'deleteButtonTooltipMessage'"
date
:
2022-01-05
element
:
uris
:
[
'
material.dart'
]
field
:
'
useDeleteButtonTooltip'
inClass
:
'
RawChip'
changes
:
-
kind
:
'
rename'
newName
:
'
deleteButtonTooltipMessage'
# Changes made in https://github.com/flutter/flutter/pull/96957
-
title
:
"
Migrate
to
'thumbVisibility'"
date
:
2022-01-20
...
...
packages/flutter/lib/src/material/chip.dart
View file @
4621dff8
...
...
@@ -237,19 +237,24 @@ abstract class DeletableChipAttributes {
/// non-null.
Color
?
get
deleteIconColor
;
/// Whether to use a tooltip on the chip's delete button showing the
/// [deleteButtonTooltipMessage].
///
/// Must not be null. Defaults to true.
bool
get
useDeleteButtonTooltip
;
/// The message to be used for the chip's delete button tooltip.
///
/// This will be shown only if [useDeleteButtonTooltip] is true.
/// If provided with an empty string, the tooltip of the delete button will be
/// disabled.
///
/// If n
ot specified, the default [MaterialLocalizations.deleteButtonTooltip] will
///
be
used.
/// If n
ull, 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.
...
...
@@ -557,7 +562,6 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri
this
.
deleteIcon
,
this
.
onDeleted
,
this
.
deleteIconColor
,
this
.
useDeleteButtonTooltip
=
true
,
this
.
deleteButtonTooltipMessage
,
this
.
side
,
this
.
shape
,
...
...
@@ -570,11 +574,15 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri
this
.
materialTapTargetSize
,
this
.
elevation
,
this
.
shadowColor
,
@Deprecated
(
'Migrate to deleteButtonTooltipMessage. '
'This feature was deprecated after v2.10.0-0.3.pre.'
)
this
.
useDeleteButtonTooltip
=
true
,
})
:
assert
(
label
!=
null
),
assert
(
autofocus
!=
null
),
assert
(
clipBehavior
!=
null
),
assert
(
elevation
==
null
||
elevation
>=
0.0
),
assert
(
useDeleteButtonTooltip
!=
null
),
super
(
key:
key
);
@override
...
...
@@ -608,8 +616,6 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri
@override
final
Color
?
deleteIconColor
;
@override
final
bool
useDeleteButtonTooltip
;
@override
final
String
?
deleteButtonTooltipMessage
;
@override
final
MaterialTapTargetSize
?
materialTapTargetSize
;
...
...
@@ -617,6 +623,12 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri
final
double
?
elevation
;
@override
final
Color
?
shadowColor
;
@override
@Deprecated
(
'Migrate to deleteButtonTooltipMessage. '
'This feature was deprecated after v2.10.0-0.3.pre.'
)
final
bool
useDeleteButtonTooltip
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -721,7 +733,6 @@ class InputChip extends StatelessWidget
this
.
deleteIcon
,
this
.
onDeleted
,
this
.
deleteIconColor
,
this
.
useDeleteButtonTooltip
=
true
,
this
.
deleteButtonTooltipMessage
,
this
.
onPressed
,
this
.
pressElevation
,
...
...
@@ -743,6 +754,11 @@ 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
(
selected
!=
null
),
assert
(
isEnabled
!=
null
),
assert
(
label
!=
null
),
...
...
@@ -750,7 +766,6 @@ class InputChip extends StatelessWidget
assert
(
autofocus
!=
null
),
assert
(
pressElevation
==
null
||
pressElevation
>=
0.0
),
assert
(
elevation
==
null
||
elevation
>=
0.0
),
assert
(
useDeleteButtonTooltip
!=
null
),
super
(
key:
key
);
@override
...
...
@@ -774,8 +789,6 @@ class InputChip extends StatelessWidget
@override
final
Color
?
deleteIconColor
;
@override
final
bool
useDeleteButtonTooltip
;
@override
final
String
?
deleteButtonTooltipMessage
;
@override
final
VoidCallback
?
onPressed
;
...
...
@@ -817,6 +830,12 @@ class InputChip extends StatelessWidget
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
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -1469,7 +1488,6 @@ class RawChip extends StatefulWidget
Widget
?
deleteIcon
,
this
.
onDeleted
,
this
.
deleteIconColor
,
this
.
useDeleteButtonTooltip
=
true
,
this
.
deleteButtonTooltipMessage
,
this
.
onPressed
,
this
.
onSelected
,
...
...
@@ -1493,6 +1511,11 @@ class RawChip extends StatefulWidget
this
.
showCheckmark
=
true
,
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
(
label
!=
null
),
assert
(
isEnabled
!=
null
),
assert
(
selected
!=
null
),
...
...
@@ -1500,7 +1523,6 @@ class RawChip extends StatefulWidget
assert
(
autofocus
!=
null
),
assert
(
pressElevation
==
null
||
pressElevation
>=
0.0
),
assert
(
elevation
==
null
||
elevation
>=
0.0
),
assert
(
useDeleteButtonTooltip
!=
null
),
deleteIcon
=
deleteIcon
??
_kDefaultDeleteIcon
,
super
(
key:
key
);
...
...
@@ -1519,8 +1541,6 @@ class RawChip extends StatefulWidget
@override
final
Color
?
deleteIconColor
;
@override
final
bool
useDeleteButtonTooltip
;
@override
final
String
?
deleteButtonTooltipMessage
;
@override
final
ValueChanged
<
bool
>?
onSelected
;
...
...
@@ -1568,6 +1588,12 @@ 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.
...
...
packages/flutter/test/material/chip_test.dart
View file @
4621dff8
...
...
@@ -200,6 +200,7 @@ Widget _chipWithOptionalDeleteButton({
TextDirection
textDirection
=
TextDirection
.
ltr
,
bool
useDeleteButtonTooltip
=
true
,
String
?
chipTooltip
,
String
?
deleteButtonTooltipMessage
,
VoidCallback
?
onPressed
=
_doNothing
,
})
{
return
_wrapForChip
(
...
...
@@ -212,6 +213,7 @@ Widget _chipWithOptionalDeleteButton({
onDeleted:
deletable
?
_doNothing
:
null
,
deleteIcon:
Icon
(
Icons
.
close
,
key:
deleteButtonKey
),
useDeleteButtonTooltip:
useDeleteButtonTooltip
,
deleteButtonTooltipMessage:
deleteButtonTooltipMessage
,
label:
Text
(
deletable
?
'Chip with Delete Button'
...
...
@@ -3494,7 +3496,7 @@ void main() {
);
});
testWidgets
(
'Chip delete button tooltip can be disabled'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Chip delete button tooltip can be disabled
using useDeleteButtonTooltip
'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
_chipWithOptionalDeleteButton
(
deletable:
true
,
...
...
@@ -3519,13 +3521,38 @@ void main() {
await
tapGesture
.
up
();
});
testWidgets
(
'
useDeleteButtonTooltip only applies to tooltip
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'
Chip delete button tooltip is disabled if deleteButtonTooltipMessage is empty
'
,
(
WidgetTester
tester
)
async
{
final
UniqueKey
deleteButtonKey
=
UniqueKey
();
await
tester
.
pumpWidget
(
_chipWithOptionalDeleteButton
(
deleteButtonKey:
deleteButtonKey
,
deletable:
true
,
useDeleteButtonTooltip:
false
,
deleteButtonTooltipMessage:
''
,
),
);
// Hover over the delete icon of the chip
final
Offset
centerOfDeleteButton
=
tester
.
getCenter
(
find
.
byKey
(
deleteButtonKey
));
final
TestGesture
hoverGesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
);
await
hoverGesture
.
moveTo
(
centerOfDeleteButton
);
addTearDown
(
hoverGesture
.
removePointer
);
await
tester
.
pump
();
// Wait for some more time while hovering over the delete button
await
tester
.
pumpAndSettle
();
// There should be no delete button tooltip
expect
(
findTooltipContainer
(
''
),
findsNothing
);
});
testWidgets
(
'Disabling delete button tooltip does not disable chip tooltip'
,
(
WidgetTester
tester
)
async
{
final
UniqueKey
deleteButtonKey
=
UniqueKey
();
await
tester
.
pumpWidget
(
_chipWithOptionalDeleteButton
(
deleteButtonKey:
deleteButtonKey
,
deletable:
true
,
deleteButtonTooltipMessage:
''
,
chipTooltip:
'Chip Tooltip'
,
),
);
...
...
@@ -3543,12 +3570,12 @@ void main() {
await
tester
.
pumpAndSettle
();
// There should be no delete tooltip
expect
(
findTooltipContainer
(
'
Delete
'
),
findsNothing
);
expect
(
findTooltipContainer
(
''
),
findsNothing
);
// There should be a chip tooltip, however.
expect
(
findTooltipContainer
(
'Chip Tooltip'
),
findsOneWidget
);
});
testWidgets
(
'
Setting useDeleteButtonTooltip also allows
Chip tooltip'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'
Triggering delete button tooltip does not trigger
Chip tooltip'
,
(
WidgetTester
tester
)
async
{
final
UniqueKey
deleteButtonKey
=
UniqueKey
();
await
tester
.
pumpWidget
(
_chipWithOptionalDeleteButton
(
...
...
packages/flutter/test_fixes/material.dart
View file @
4621dff8
...
...
@@ -530,4 +530,25 @@ void main() {
scrollbarTheme
.
isAlwaysShown
;
RawScrollbar
rawScrollbar
=
RawScrollbar
(
isAlwaysShown:
true
);
nowShowing
=
rawScrollbar
.
isAlwaysShown
;
// Changes made in https://github.com/flutter/flutter/pull/96174
Chip
chip
=
Chip
();
chip
=
Chip
(
useDeleteButtonTooltip:
false
);
chip
=
Chip
(
useDeleteButtonTooltip:
true
);
chip
=
Chip
(
useDeleteButtonTooltip:
false
,
deleteButtonTooltipMessage:
'Delete Tooltip'
);
chip
.
useDeleteButtonTooltip
;
// Changes made in https://github.com/flutter/flutter/pull/96174
InputChip
inputChip
=
InputChip
();
inputChip
=
InputChip
(
useDeleteButtonTooltip:
false
);
inputChip
=
InputChip
(
useDeleteButtonTooltip:
true
);
inputChip
=
InputChip
(
useDeleteButtonTooltip:
false
,
deleteButtonTooltipMessage:
'Delete Tooltip'
);
inputChip
.
useDeleteButtonTooltip
;
// Changes made in https://github.com/flutter/flutter/pull/96174
RawChip
rawChip
=
Rawchip
();
rawChip
=
RawChip
(
useDeleteButtonTooltip:
false
);
rawChip
=
RawChip
(
useDeleteButtonTooltip:
true
);
rawChip
=
RawChip
(
useDeleteButtonTooltip:
false
,
deleteButtonTooltipMessage:
'Delete Tooltip'
);
rawChip
.
useDeleteButtonTooltip
;
}
packages/flutter/test_fixes/material.dart.expect
View file @
4621dff8
...
...
@@ -503,4 +503,25 @@ void main() {
scrollbarTheme.thumbVisibility;
RawScrollbar rawScrollbar = RawScrollbar(thumbVisibility: true);
nowShowing = rawScrollbar.thumbVisibility;
// Changes made in https://github.com/flutter/flutter/pull/96174
Chip chip = Chip();
chip = Chip(deleteButtonTooltipMessage: '');
chip = Chip();
chip = Chip(deleteButtonTooltipMessage: 'Delete Tooltip');
chip.deleteButtonTooltipMessage;
// Changes made in https://github.com/flutter/flutter/pull/96174
InputChip inputChip = InputChip();
inputChip = InputChip(deleteButtonTooltipMessage: '');
inputChip = InputChip();
inputChip = InputChip(deleteButtonTooltipMessage: 'Delete Tooltip');
inputChip.deleteButtonTooltipMessage;
// Changes made in https://github.com/flutter/flutter/pull/96174
RawChip rawChip = Rawchip();
rawChip = RawChip(deleteButtonTooltipMessage: '');
rawChip = RawChip();
rawChip = RawChip(deleteButtonTooltipMessage: 'Delete Tooltip');
rawChip.deleteButtonTooltipMessage;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment