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
47e3f1a9
Unverified
Commit
47e3f1a9
authored
Jan 04, 2022
by
Will Lockwood
Committed by
GitHub
Jan 04, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow `Checkbox`es in `DataTable`s to inherit colors from `CheckboxTheme` (#96007)
parent
764c3c18
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
data_table.dart
packages/flutter/lib/src/material/data_table.dart
+0
-3
data_table_test.dart
packages/flutter/test/material/data_table_test.dart
+19
-8
No files found.
packages/flutter/lib/src/material/data_table.dart
View file @
47e3f1a9
...
...
@@ -701,9 +701,6 @@ class DataTable extends StatelessWidget {
),
child:
Center
(
child:
Checkbox
(
// TODO(per): Remove when Checkbox has theme, https://github.com/flutter/flutter/issues/53420.
activeColor:
themeData
.
colorScheme
.
primary
,
checkColor:
themeData
.
colorScheme
.
onPrimary
,
value:
checked
,
onChanged:
onCheckboxChanged
,
tristate:
tristate
,
...
...
packages/flutter/test/material/data_table_test.dart
View file @
47e3f1a9
...
...
@@ -1298,8 +1298,16 @@ void main() {
);
});
testWidgets
(
'DataRow renders checkbox with colors from Theme'
,
(
WidgetTester
tester
)
async
{
final
ThemeData
_themeData
=
ThemeData
.
light
();
testWidgets
(
'DataRow renders checkbox with colors from CheckboxTheme'
,
(
WidgetTester
tester
)
async
{
const
Color
fillColor
=
Color
(
0xFF00FF00
);
const
Color
checkColor
=
Color
(
0xFF0000FF
);
final
ThemeData
_themeData
=
ThemeData
(
checkboxTheme:
CheckboxThemeData
(
fillColor:
MaterialStateProperty
.
all
(
fillColor
),
checkColor:
MaterialStateProperty
.
all
(
checkColor
),
),
);
Widget
buildTable
()
{
return
MaterialApp
(
theme:
_themeData
,
...
...
@@ -1312,6 +1320,7 @@ void main() {
],
rows:
<
DataRow
>[
DataRow
(
selected:
true
,
onSelectChanged:
(
bool
?
checked
)
{},
cells:
const
<
DataCell
>[
DataCell
(
Text
(
'Content1'
)),
...
...
@@ -1323,13 +1332,15 @@ void main() {
);
}
Checkbox
lastCheckbox
()
{
return
tester
.
widgetList
<
Checkbox
>(
find
.
byType
(
Checkbox
)).
last
;
}
await
tester
.
pumpWidget
(
buildTable
());
expect
(
lastCheckbox
().
activeColor
,
_themeData
.
colorScheme
.
primary
);
expect
(
lastCheckbox
().
checkColor
,
_themeData
.
colorScheme
.
onPrimary
);
expect
(
Material
.
of
(
tester
.
element
(
find
.
byType
(
Checkbox
).
last
)),
paints
..
path
()
..
path
(
color:
fillColor
)
..
path
(
color:
checkColor
),
);
});
testWidgets
(
'DataRow renders custom colors when selected'
,
(
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