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
75fec892
Commit
75fec892
authored
Nov 01, 2016
by
Chris Bracken
Committed by
GitHub
Nov 01, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Propagate theme typography to slider label (#6629)
parent
67f59100
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
slider.dart
packages/flutter/lib/src/material/slider.dart
+19
-2
No files found.
packages/flutter/lib/src/material/slider.dart
View file @
75fec892
...
...
@@ -139,11 +139,13 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin {
@override
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMaterial
(
context
));
ThemeData
theme
=
Theme
.
of
(
context
);
return
new
_SliderRenderObjectWidget
(
value:
(
config
.
value
-
config
.
min
)
/
(
config
.
max
-
config
.
min
),
divisions:
config
.
divisions
,
label:
config
.
label
,
activeColor:
config
.
activeColor
??
Theme
.
of
(
context
).
accentColor
,
activeColor:
config
.
activeColor
??
theme
.
accentColor
,
textTheme:
theme
.
primaryTextTheme
,
onChanged:
config
.
onChanged
!=
null
?
_handleChanged
:
null
,
vsync:
this
,
);
...
...
@@ -157,6 +159,7 @@ class _SliderRenderObjectWidget extends LeafRenderObjectWidget {
this
.
divisions
,
this
.
label
,
this
.
activeColor
,
this
.
textTheme
,
this
.
onChanged
,
this
.
vsync
,
})
:
super
(
key:
key
);
...
...
@@ -165,6 +168,7 @@ class _SliderRenderObjectWidget extends LeafRenderObjectWidget {
final
int
divisions
;
final
String
label
;
final
Color
activeColor
;
final
TextTheme
textTheme
;
final
ValueChanged
<
double
>
onChanged
;
final
TickerProvider
vsync
;
...
...
@@ -174,6 +178,7 @@ class _SliderRenderObjectWidget extends LeafRenderObjectWidget {
divisions:
divisions
,
label:
label
,
activeColor:
activeColor
,
textTheme:
textTheme
,
onChanged:
onChanged
,
vsync:
vsync
,
);
...
...
@@ -185,6 +190,7 @@ class _SliderRenderObjectWidget extends LeafRenderObjectWidget {
..
divisions
=
divisions
..
label
=
label
..
activeColor
=
activeColor
..
textTheme
=
textTheme
..
onChanged
=
onChanged
;
// Ticker provider cannot change since there's a 1:1 relationship between
// the _SliderRenderObjectWidget object and the _SliderState object.
...
...
@@ -229,11 +235,13 @@ class _RenderSlider extends RenderConstrainedBox implements SemanticsActionHandl
int
divisions
,
String
label
,
Color
activeColor
,
TextTheme
textTheme
,
this
.
onChanged
,
TickerProvider
vsync
,
})
:
_value
=
value
,
_divisions
=
divisions
,
_activeColor
=
activeColor
,
_textTheme
=
textTheme
,
super
(
additionalConstraints:
_getAdditionalConstraints
(
label
))
{
assert
(
value
!=
null
&&
value
>=
0.0
&&
value
<=
1.0
);
this
.
label
=
label
;
...
...
@@ -290,7 +298,7 @@ class _RenderSlider extends RenderConstrainedBox implements SemanticsActionHandl
// https://github.com/flutter/flutter/issues/5938
_labelPainter
..
text
=
new
TextSpan
(
style:
Typography
.
whit
e
.
body1
.
copyWith
(
fontSize:
10.0
),
style:
_textThem
e
.
body1
.
copyWith
(
fontSize:
10.0
),
text:
newLabel
)
..
layout
();
...
...
@@ -309,6 +317,15 @@ class _RenderSlider extends RenderConstrainedBox implements SemanticsActionHandl
markNeedsPaint
();
}
TextTheme
get
textTheme
=>
_textTheme
;
TextTheme
_textTheme
;
set
textTheme
(
TextTheme
value
)
{
if
(
value
==
_textTheme
)
return
;
_textTheme
=
value
;
markNeedsPaint
();
}
ValueChanged
<
double
>
onChanged
;
double
get
_trackLength
=>
size
.
width
-
2.0
*
_kReactionRadius
;
...
...
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