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
88ded730
Unverified
Commit
88ded730
authored
Jan 05, 2022
by
Markus Aksli
Committed by
GitHub
Jan 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `DataTable` `_SortArrow` changing orientation when state is updated (#94455)
parent
0f24741a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
0 deletions
+100
-0
data_table.dart
packages/flutter/lib/src/material/data_table.dart
+1
-0
data_table_test.dart
packages/flutter/test/material/data_table_test.dart
+99
-0
No files found.
packages/flutter/lib/src/material/data_table.dart
View file @
88ded730
...
...
@@ -1139,6 +1139,7 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin {
@override
void
initState
()
{
super
.
initState
();
_up
=
widget
.
up
;
_opacityAnimation
=
CurvedAnimation
(
parent:
_opacityController
=
AnimationController
(
duration:
widget
.
duration
,
...
...
packages/flutter/test/material/data_table_test.dart
View file @
88ded730
...
...
@@ -486,6 +486,105 @@ void main() {
);
});
testWidgets
(
'DataTable sort indicator orientation does not change on state update'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/43724
Widget
buildTable
({
String
title
=
'Name1'
})
{
return
DataTable
(
sortColumnIndex:
0
,
columns:
<
DataColumn
>[
DataColumn
(
label:
Text
(
title
),
tooltip:
'Name'
,
onSort:
(
int
columnIndex
,
bool
ascending
)
{},
),
],
rows:
kDesserts
.
map
<
DataRow
>((
Dessert
dessert
)
{
return
DataRow
(
cells:
<
DataCell
>[
DataCell
(
Text
(
dessert
.
name
),
),
],
);
}).
toList
(),
);
}
// Check for ascending list
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
buildTable
()),
));
// The `tester.widget` ensures that there is exactly one upward arrow.
final
Finder
iconFinder
=
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
);
Transform
transformOfArrow
=
tester
.
widget
<
Transform
>(
iconFinder
);
expect
(
transformOfArrow
.
transform
.
getRotation
(),
equals
(
Matrix3
.
identity
()),
);
// Cause a rebuild by updating the widget
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
buildTable
(
title:
'Name2'
)),
));
await
tester
.
pumpAndSettle
();
// The `tester.widget` ensures that there is exactly one upward arrow.
transformOfArrow
=
tester
.
widget
<
Transform
>(
iconFinder
);
expect
(
transformOfArrow
.
transform
.
getRotation
(),
equals
(
Matrix3
.
identity
()),
// Should not have changed
);
});
testWidgets
(
'DataTable sort indicator orientation does not change on state update - reverse'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/43724
Widget
buildTable
({
String
title
=
'Name1'
})
{
return
DataTable
(
sortColumnIndex:
0
,
sortAscending:
false
,
columns:
<
DataColumn
>[
DataColumn
(
label:
Text
(
title
),
tooltip:
'Name'
,
onSort:
(
int
columnIndex
,
bool
ascending
)
{},
),
],
rows:
kDesserts
.
map
<
DataRow
>((
Dessert
dessert
)
{
return
DataRow
(
cells:
<
DataCell
>[
DataCell
(
Text
(
dessert
.
name
),
),
],
);
}).
toList
(),
);
}
// Check for ascending list
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
buildTable
()),
));
// The `tester.widget` ensures that there is exactly one upward arrow.
final
Finder
iconFinder
=
find
.
widgetWithIcon
(
Transform
,
Icons
.
arrow_upward
);
Transform
transformOfArrow
=
tester
.
widget
<
Transform
>(
iconFinder
);
expect
(
transformOfArrow
.
transform
.
getRotation
(),
equals
(
Matrix3
.
rotationZ
(
math
.
pi
)),
);
// Cause a rebuild by updating the widget
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
buildTable
(
title:
'Name2'
)),
));
await
tester
.
pumpAndSettle
();
// The `tester.widget` ensures that there is exactly one upward arrow.
transformOfArrow
=
tester
.
widget
<
Transform
>(
iconFinder
);
expect
(
transformOfArrow
.
transform
.
getRotation
(),
equals
(
Matrix3
.
rotationZ
(
math
.
pi
)),
// Should not have changed
);
});
testWidgets
(
'DataTable row onSelectChanged test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
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