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
ff136cba
Unverified
Commit
ff136cba
authored
May 09, 2022
by
Bruno Leroux
Committed by
GitHub
May 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Tooltip obscured by keyboard (#103339)
parent
0ff0affb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
tooltip.dart
packages/flutter/lib/src/material/tooltip.dart
+1
-0
tooltip_test.dart
packages/flutter/test/material/tooltip_test.dart
+55
-0
No files found.
packages/flutter/lib/src/material/tooltip.dart
View file @
ff136cba
...
...
@@ -841,6 +841,7 @@ class _TooltipOverlay extends StatelessWidget {
);
}
return
Positioned
.
fill
(
bottom:
MediaQuery
.
maybeOf
(
context
)?.
viewInsets
.
bottom
??
0.0
,
child:
CustomSingleChildLayout
(
delegate:
_TooltipPositionDelegate
(
target:
target
,
...
...
packages/flutter/test/material/tooltip_test.dart
View file @
ff136cba
...
...
@@ -489,6 +489,61 @@ void main() {
expect
(
tip
.
localToGlobal
(
tip
.
size
.
bottomRight
(
Offset
.
zero
)).
dy
,
equals
(
324.0
));
});
testWidgets
(
'Tooltip should be fully visible when MediaQuery.viewInsets > 0'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/23666
Widget
materialAppWithViewInsets
(
double
viewInsetsHeight
)
{
final
Widget
scaffold
=
Scaffold
(
body:
const
TextField
(),
floatingActionButton:
FloatingActionButton
(
tooltip:
tooltipText
,
onPressed:
()
{
/* do nothing */
},
child:
const
Icon
(
Icons
.
add
),
),
);
return
MediaQuery
.
fromWindow
(
child:
MediaQuery
(
data:
MediaQueryData
(
viewInsets:
EdgeInsets
.
only
(
bottom:
viewInsetsHeight
),
),
child:
MaterialApp
(
useInheritedMediaQuery:
true
,
home:
scaffold
,
),
),
);
}
// Start with MediaQuery.viewInsets.bottom = 0
await
tester
.
pumpWidget
(
materialAppWithViewInsets
(
0
));
// Show FAB tooltip
final
Finder
fabFinder
=
find
.
byType
(
FloatingActionButton
);
await
tester
.
longPress
(
fabFinder
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
expect
(
find
.
byType
(
Tooltip
),
findsOneWidget
);
// FAB tooltip should be above FAB
RenderBox
tip
=
tester
.
renderObject
(
_findTooltipContainer
(
tooltipText
));
Offset
fabTopRight
=
tester
.
getTopRight
(
fabFinder
);
Offset
tooltipTopRight
=
tip
.
localToGlobal
(
tip
.
size
.
topRight
(
Offset
.
zero
));
expect
(
tooltipTopRight
.
dy
<
fabTopRight
.
dy
,
true
);
// Simulate Keyboard opening (MediaQuery.viewInsets.bottom = 300))
await
tester
.
pumpWidget
(
materialAppWithViewInsets
(
300
));
await
tester
.
pumpAndSettle
();
// Show FAB tooltip
await
tester
.
longPress
(
fabFinder
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
expect
(
find
.
byType
(
Tooltip
),
findsOneWidget
);
// FAB tooltip should still be above FAB
tip
=
tester
.
renderObject
(
_findTooltipContainer
(
tooltipText
));
fabTopRight
=
tester
.
getTopRight
(
fabFinder
);
tooltipTopRight
=
tip
.
localToGlobal
(
tip
.
size
.
topRight
(
Offset
.
zero
));
expect
(
tooltipTopRight
.
dy
<
fabTopRight
.
dy
,
true
);
});
testWidgets
(
'Custom tooltip margin'
,
(
WidgetTester
tester
)
async
{
const
double
customMarginValue
=
10.0
;
final
GlobalKey
<
TooltipState
>
tooltipKey
=
GlobalKey
<
TooltipState
>();
...
...
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