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
7736b9ee
Unverified
Commit
7736b9ee
authored
Sep 10, 2021
by
BambinoUA
Committed by
GitHub
Sep 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't display empty tooltips (Tooltips with empty `message` property) (#87638)
parent
77c27059
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
tooltip.dart
packages/flutter/lib/src/material/tooltip.dart
+6
-0
tooltip_test.dart
packages/flutter/test/material/tooltip_test.dart
+26
-0
No files found.
packages/flutter/lib/src/material/tooltip.dart
View file @
7736b9ee
...
...
@@ -475,6 +475,12 @@ class _TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
@override
Widget
build
(
BuildContext
context
)
{
// If message is empty then no need to create a tooltip overlay to show
// the empty black container so just return the wrapped child as is or
// empty container if child is not specified.
if
(
widget
.
message
.
isEmpty
)
{
return
widget
.
child
??
const
SizedBox
();
}
assert
(
Overlay
.
of
(
context
,
debugRequiredFor:
widget
)
!=
null
);
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
TooltipThemeData
tooltipTheme
=
TooltipTheme
.
of
(
context
);
...
...
packages/flutter/test/material/tooltip_test.dart
View file @
7736b9ee
...
...
@@ -1497,6 +1497,32 @@ void main() {
await
testGestureLongPress
(
tester
,
tooltip
);
expect
(
find
.
text
(
tooltipText
),
findsNothing
);
});
testWidgets
(
'Tooltip should not be shown with empty message (with child)'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Tooltip
(
message:
tooltipText
,
child:
Text
(
tooltipText
),
),
),
);
expect
(
find
.
text
(
tooltipText
),
findsOneWidget
);
});
testWidgets
(
'Tooltip should not be shown with empty message (without child)'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Tooltip
(
message:
tooltipText
,
),
),
);
expect
(
find
.
text
(
tooltipText
),
findsNothing
);
if
(
tooltipText
.
isEmpty
)
{
expect
(
find
.
byType
(
SizedBox
),
findsOneWidget
);
}
});
}
Future
<
void
>
setWidgetForTooltipMode
(
WidgetTester
tester
,
TooltipTriggerMode
triggerMode
)
async
{
...
...
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