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
04546cc6
Unverified
Commit
04546cc6
authored
Jan 26, 2019
by
Jonah Williams
Committed by
GitHub
Jan 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent _computeColumnWidths from getting stuck due to double precision (#27112)
parent
0e54e9fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
table.dart
packages/flutter/lib/src/rendering/table.dart
+4
-1
table_test.dart
packages/flutter/test/widgets/table_test.dart
+25
-0
No files found.
packages/flutter/lib/src/rendering/table.dart
View file @
04546cc6
...
...
@@ -916,7 +916,10 @@ class RenderTable extends RenderBox {
// columns shrinking them proportionally until we have no
// available columns, then do the same to the non-flexible ones.
int
availableColumns
=
columns
;
while
(
deficit
>
0.0
&&
totalFlex
>
0.0
)
{
// Handle double precision errors which causes this loop to become
// stuck in certain configurations.
const
double
minimumDeficit
=
0.00000001
;
while
(
deficit
>
minimumDeficit
&&
totalFlex
>
minimumDeficit
)
{
double
newTotalFlex
=
0.0
;
for
(
int
x
=
0
;
x
<
columns
;
x
+=
1
)
{
if
(
flexes
[
x
]
!=
null
)
{
...
...
packages/flutter/test/widgets/table_test.dart
View file @
04546cc6
...
...
@@ -297,6 +297,31 @@ void main() {
expect
(
boxG1
,
isNot
(
equals
(
boxG2
)));
});
testWidgets
(
'Really small deficit double precision error'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/27083
const
SizedBox
cell
=
SizedBox
(
width:
16
,
height:
16
);
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Table
(
children:
const
<
TableRow
>[
TableRow
(
children:
<
Widget
>[
cell
,
cell
,
cell
,
cell
,
cell
,
cell
,
],
),
TableRow
(
children:
<
Widget
>[
cell
,
cell
,
cell
,
cell
,
cell
,
cell
,
],
),
],
),
),
);
// If the above bug is present this test will never terminate.
});
testWidgets
(
'Table widget - repump test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Directionality
(
...
...
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