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
4b678271
Unverified
Commit
4b678271
authored
May 19, 2022
by
Bruno Leroux
Committed by
GitHub
May 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Tooltip default vertical padding (#103395)
parent
384800b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
tooltip.dart
packages/flutter/lib/src/material/tooltip.dart
+4
-3
tooltip_test.dart
packages/flutter/test/material/tooltip_test.dart
+12
-10
No files found.
packages/flutter/lib/src/material/tooltip.dart
View file @
4b678271
...
@@ -134,7 +134,8 @@ class Tooltip extends StatefulWidget {
...
@@ -134,7 +134,8 @@ class Tooltip extends StatefulWidget {
/// The amount of space by which to inset the tooltip's [child].
/// The amount of space by which to inset the tooltip's [child].
///
///
/// Defaults to 16.0 logical pixels in each direction.
/// On mobile, defaults to 16.0 logical pixels horizontally and 4.0 vertically.
/// On desktop, defaults to 8.0 logical pixels horizontally and 4.0 vertically.
final
EdgeInsetsGeometry
?
padding
;
final
EdgeInsetsGeometry
?
padding
;
/// The empty space that surrounds the tooltip.
/// The empty space that surrounds the tooltip.
...
@@ -403,11 +404,11 @@ class TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
...
@@ -403,11 +404,11 @@ class TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
case
TargetPlatform
.
windows
:
return
const
EdgeInsets
.
symmetric
(
horizontal:
8.0
);
return
const
EdgeInsets
.
symmetric
(
horizontal:
8.0
,
vertical:
4.0
);
case
TargetPlatform
.
android
:
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
iOS
:
return
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
);
return
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
,
vertical:
4.0
);
}
}
}
}
...
...
packages/flutter/test/material/tooltip_test.dart
View file @
4b678271
...
@@ -801,15 +801,16 @@ void main() {
...
@@ -801,15 +801,16 @@ void main() {
tooltipKey
.
currentState
?.
ensureTooltipVisible
();
tooltipKey
.
currentState
?.
ensureTooltipVisible
();
await
tester
.
pump
(
const
Duration
(
seconds:
2
));
// faded in, show timer started (and at 0.0)
await
tester
.
pump
(
const
Duration
(
seconds:
2
));
// faded in, show timer started (and at 0.0)
final
RenderBox
tip
=
tester
.
renderObject
(
final
RenderBox
tip
=
tester
.
renderObject
(
_findTooltipContainer
(
tooltipText
));
_findTooltipContainer
(
tooltipText
),
);
expect
(
tip
.
size
.
height
,
equals
(
32.0
));
expect
(
tip
.
size
.
height
,
equals
(
32.0
));
expect
(
tip
.
size
.
width
,
equals
(
74.0
));
expect
(
tip
.
size
.
width
,
equals
(
74.0
));
expect
(
tip
,
paints
..
rrect
(
expect
(
tip
,
paints
..
rrect
(
rrect:
RRect
.
fromRectAndRadius
(
tip
.
paintBounds
,
const
Radius
.
circular
(
4.0
)),
rrect:
RRect
.
fromRectAndRadius
(
tip
.
paintBounds
,
const
Radius
.
circular
(
4.0
)),
color:
const
Color
(
0xe6616161
),
color:
const
Color
(
0xe6616161
),
));
));
final
Container
tooltipContainer
=
tester
.
firstWidget
<
Container
>(
_findTooltipContainer
(
tooltipText
));
expect
(
tooltipContainer
.
padding
,
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
,
vertical:
4.0
));
});
});
testWidgets
(
'Tooltip default size, shape, and color test for Desktop'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Tooltip default size, shape, and color test for Desktop'
,
(
WidgetTester
tester
)
async
{
...
@@ -830,14 +831,15 @@ void main() {
...
@@ -830,14 +831,15 @@ void main() {
final
RenderParagraph
tooltipRenderParagraph
=
tester
.
renderObject
<
RenderParagraph
>(
find
.
text
(
tooltipText
));
final
RenderParagraph
tooltipRenderParagraph
=
tester
.
renderObject
<
RenderParagraph
>(
find
.
text
(
tooltipText
));
expect
(
tooltipRenderParagraph
.
textSize
.
height
,
equals
(
12.0
));
expect
(
tooltipRenderParagraph
.
textSize
.
height
,
equals
(
12.0
));
final
RenderBox
tooltipContainer
=
tester
.
renderObject
(
final
RenderBox
tooltipRenderBox
=
tester
.
renderObject
(
_findTooltipContainer
(
tooltipText
));
_findTooltipContainer
(
tooltipText
),
expect
(
tooltipRenderBox
.
size
.
height
,
equals
(
24.0
));
);
expect
(
tooltipRenderBox
,
paints
..
rrect
(
expect
(
tooltipContainer
.
size
.
height
,
equals
(
24.0
));
rrect:
RRect
.
fromRectAndRadius
(
tooltipRenderBox
.
paintBounds
,
const
Radius
.
circular
(
4.0
)),
expect
(
tooltipContainer
,
paints
..
rrect
(
rrect:
RRect
.
fromRectAndRadius
(
tooltipContainer
.
paintBounds
,
const
Radius
.
circular
(
4.0
)),
color:
const
Color
(
0xe6616161
),
color:
const
Color
(
0xe6616161
),
));
));
final
Container
tooltipContainer
=
tester
.
firstWidget
<
Container
>(
_findTooltipContainer
(
tooltipText
));
expect
(
tooltipContainer
.
padding
,
const
EdgeInsets
.
symmetric
(
horizontal:
8.0
,
vertical:
4.0
));
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
macOS
,
TargetPlatform
.
linux
,
TargetPlatform
.
windows
}));
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
macOS
,
TargetPlatform
.
linux
,
TargetPlatform
.
windows
}));
testWidgets
(
'Can tooltip decoration be customized'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Can tooltip decoration be customized'
,
(
WidgetTester
tester
)
async
{
...
@@ -1437,7 +1439,7 @@ void main() {
...
@@ -1437,7 +1439,7 @@ void main() {
tip
=
tester
.
renderObject
(
tip
=
tester
.
renderObject
(
_findTooltipContainer
(
tooltipText
),
_findTooltipContainer
(
tooltipText
),
);
);
expect
(
tip
.
size
.
height
,
equals
(
56
.0
));
expect
(
tip
.
size
.
height
,
equals
(
64
.0
));
});
});
testWidgets
(
'Tooltip text displays with richMessage'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Tooltip text displays with richMessage'
,
(
WidgetTester
tester
)
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