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
b025e38e
Unverified
Commit
b025e38e
authored
Oct 27, 2021
by
xubaolin
Committed by
GitHub
Oct 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a throw due to double precison (#92486)
parent
9afb45a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+1
-1
dropdown_test.dart
packages/flutter/test/material/dropdown_test.dart
+35
-0
No files found.
packages/flutter/lib/src/material/dropdown.dart
View file @
b025e38e
...
...
@@ -577,7 +577,7 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
scrollOffset
=
math
.
min
(
scrollOffset
,
preferredMenuHeight
-
menuHeight
);
}
assert
(
menuHeight
==
menuBottom
-
menuTop
);
assert
(
(
menuBottom
-
menuTop
-
menuHeight
).
abs
()
<
precisionErrorTolerance
);
return
_MenuLimits
(
menuTop
,
menuBottom
,
menuHeight
,
scrollOffset
);
}
}
...
...
packages/flutter/test/material/dropdown_test.dart
View file @
b025e38e
...
...
@@ -3595,4 +3595,39 @@ void main() {
}
}
});
// Regression test for https://github.com/flutter/flutter/issues/92438
testWidgets
(
'Do not throw due to the double precision'
,
(
WidgetTester
tester
)
async
{
const
String
value
=
'One'
;
const
double
itemHeight
=
77.701
;
final
List
<
DropdownMenuItem
<
String
>>
menuItems
=
<
String
>[
value
,
'Two'
,
'Free'
,
].
map
<
DropdownMenuItem
<
String
>>((
String
value
)
{
return
DropdownMenuItem
<
String
>(
value:
value
,
child:
Text
(
value
),
);
}).
toList
();
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
child:
DropdownButton
<
String
>(
value:
value
,
itemHeight:
itemHeight
,
onChanged:
(
_
)
{},
items:
menuItems
,
),
),
),
),
);
await
tester
.
tap
(
find
.
text
(
value
));
await
tester
.
pumpAndSettle
();
expect
(
tester
.
takeException
(),
null
);
});
}
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