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
c12c179a
Commit
c12c179a
authored
Jun 23, 2016
by
Hans Muller
Committed by
GitHub
Jun 23, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make DataTable readable with the dark theme (#4717)
parent
e5fb2fb0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
data_table.dart
packages/flutter/lib/src/material/data_table.dart
+16
-7
theme_data.dart
packages/flutter/lib/src/material/theme_data.dart
+2
-1
No files found.
packages/flutter/lib/src/material/data_table.dart
View file @
c12c179a
...
...
@@ -351,6 +351,7 @@ class DataTable extends StatelessWidget {
static
const
double
_kHeadingFontSize
=
12.0
;
static
const
Duration
_kSortArrowAnimationDuration
=
const
Duration
(
milliseconds:
150
);
static
const
Color
_kGrey100Opacity
=
const
Color
(
0x0A000000
);
// Grey 100 as opacity instead of solid color
static
const
Color
_kGrey300Opacity
=
const
Color
(
0x1E000000
);
// Dark theme variant is just a guess.
Widget
_buildCheckbox
({
Color
color
,
...
...
@@ -381,6 +382,7 @@ class DataTable extends StatelessWidget {
}
Widget
_buildHeadingCell
({
BuildContext
context
,
EdgeInsets
padding
,
Widget
label
,
String
tooltip
,
...
...
@@ -411,8 +413,10 @@ class DataTable extends StatelessWidget {
// TODO(ianh): font family should be Roboto; see https://github.com/flutter/flutter/issues/3116
fontWeight:
FontWeight
.
w500
,
fontSize:
_kHeadingFontSize
,
color:
onSort
!=
null
&&
sorted
?
Colors
.
black87
:
Colors
.
black54
,
height:
_kHeadingRowHeight
/
_kHeadingFontSize
height:
_kHeadingRowHeight
/
_kHeadingFontSize
,
color:
(
Theme
.
of
(
context
).
brightness
==
Brightness
.
light
)
?
((
onSort
!=
null
&&
sorted
)
?
Colors
.
black87
:
Colors
.
black54
)
:
((
onSort
!=
null
&&
sorted
)
?
Colors
.
white
:
Colors
.
white70
)
),
duration:
_kSortArrowAnimationDuration
,
child:
label
...
...
@@ -445,6 +449,7 @@ class DataTable extends StatelessWidget {
VoidCallback
onTap
,
VoidCallback
onSelectChanged
})
{
final
bool
isLightTheme
=
Theme
.
of
(
context
).
brightness
==
Brightness
.
light
;
if
(
showEditIcon
)
{
final
Widget
icon
=
new
Icon
(
Icons
.
edit
,
size:
18.0
);
label
=
new
Flexible
(
child:
label
);
...
...
@@ -459,12 +464,14 @@ class DataTable extends StatelessWidget {
style:
new
TextStyle
(
// TODO(ianh): font family should be Roboto; see https://github.com/flutter/flutter/issues/3116
fontSize:
13.0
,
color:
placeholder
?
Colors
.
black38
:
Colors
.
black87
// TODO(ianh): defer to theme, since this won't work in e.g. the dark theme
color:
isLightTheme
?
(
placeholder
?
Colors
.
black38
:
Colors
.
black87
)
:
(
placeholder
?
Colors
.
white30
:
Colors
.
white70
)
),
child:
new
IconTheme
.
merge
(
context:
context
,
data:
new
IconThemeData
(
color:
Colors
.
black54
color:
isLightTheme
?
Colors
.
black54
:
Colors
.
white70
),
child:
new
DropDownButtonHideUnderline
(
child:
label
)
)
...
...
@@ -491,8 +498,9 @@ class DataTable extends StatelessWidget {
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
BoxDecoration
_kSelectedDecoration
=
new
BoxDecoration
(
backgroundColor:
_kGrey100Opacity
,
// has to be transparent so you can see the ink on the material
border:
new
Border
(
bottom:
new
BorderSide
(
color:
theme
.
dividerColor
))
border:
new
Border
(
bottom:
new
BorderSide
(
color:
theme
.
dividerColor
)),
// The backgroundColor has to be transparent so you can see the ink on the material
backgroundColor:
(
Theme
.
of
(
context
).
brightness
==
Brightness
.
light
)
?
_kGrey100Opacity
:
_kGrey300Opacity
);
final
BoxDecoration
_kUnselectedDecoration
=
new
BoxDecoration
(
border:
new
Border
(
bottom:
new
BorderSide
(
color:
theme
.
dividerColor
))
...
...
@@ -551,6 +559,7 @@ class DataTable extends StatelessWidget {
tableColumns
[
displayColumnIndex
]
=
const
IntrinsicColumnWidth
();
}
tableRows
[
0
].
children
[
displayColumnIndex
]
=
_buildHeadingCell
(
context:
context
,
padding:
padding
,
label:
column
.
label
,
tooltip:
column
.
tooltip
,
...
...
@@ -770,7 +779,7 @@ class _SortArrowState extends State<_SortArrow> {
child:
new
Icon
(
Icons
.
arrow_downward
,
size:
_kArrowIconSize
,
color:
Colors
.
black87
color:
(
Theme
.
of
(
context
).
brightness
==
Brightness
.
light
)
?
Colors
.
black87
:
Colors
.
white70
)
)
);
...
...
packages/flutter/lib/src/material/theme_data.dart
View file @
c12c179a
...
...
@@ -109,7 +109,8 @@ class ThemeData {
unselectedWidgetColor
??=
isDark
?
Colors
.
white70
:
Colors
.
black54
;
disabledColor
??=
isDark
?
Colors
.
white30
:
Colors
.
black26
;
buttonColor
??=
isDark
?
primarySwatch
[
600
]
:
Colors
.
grey
[
300
];
secondaryHeaderColor
??=
primarySwatch
[
50
];
// TODO(ianh): dark theme support (https://github.com/flutter/flutter/issues/3370)
// Spec doesn't specify a dark theme secondaryHeaderColor, this is a guess.
secondaryHeaderColor
??=
isDark
?
Colors
.
grey
[
700
]
:
primarySwatch
[
50
];
textSelectionColor
??=
isDark
?
accentColor
:
primarySwatch
[
200
];
textSelectionHandleColor
??=
isDark
?
Colors
.
tealAccent
[
400
]
:
primarySwatch
[
300
];
backgroundColor
??=
isDark
?
Colors
.
grey
[
700
]
:
primarySwatch
[
200
];
...
...
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