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
4c254e5e
Commit
4c254e5e
authored
Sep 10, 2019
by
Slade Capasso
Committed by
Hans Muller
Sep 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates to debugFillProperties to test all properties in slider.dart and slider_test.dart (#39632)
parent
663d0b13
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
slider.dart
packages/flutter/lib/src/material/slider.dart
+8
-0
slider_test.dart
packages/flutter/test/material/slider_test.dart
+34
-0
No files found.
packages/flutter/lib/src/material/slider.dart
View file @
4c254e5e
...
...
@@ -381,8 +381,16 @@ class Slider extends StatefulWidget {
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
properties
.
add
(
DoubleProperty
(
'value'
,
value
));
properties
.
add
(
ObjectFlagProperty
<
ValueChanged
<
double
>>(
'onChanged'
,
onChanged
,
ifNull:
'disabled'
));
properties
.
add
(
ObjectFlagProperty
<
ValueChanged
<
double
>>.
has
(
'onChangeStart'
,
onChangeStart
));
properties
.
add
(
ObjectFlagProperty
<
ValueChanged
<
double
>>.
has
(
'onChangeEnd'
,
onChangeEnd
));
properties
.
add
(
DoubleProperty
(
'min'
,
min
));
properties
.
add
(
DoubleProperty
(
'max'
,
max
));
properties
.
add
(
IntProperty
(
'divisions'
,
divisions
));
properties
.
add
(
StringProperty
(
'label'
,
label
));
properties
.
add
(
ColorProperty
(
'activeColor'
,
activeColor
));
properties
.
add
(
ColorProperty
(
'inactiveColor'
,
inactiveColor
));
properties
.
add
(
ObjectFlagProperty
<
ValueChanged
<
double
>>.
has
(
'semanticFormatterCallback'
,
semanticFormatterCallback
));
}
}
...
...
packages/flutter/test/material/slider_test.dart
View file @
4c254e5e
...
...
@@ -1547,4 +1547,38 @@ void main() {
final
RenderBox
renderObject
=
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
Slider
));
expect
(
renderObject
.
size
.
height
,
200
);
});
testWidgets
(
'Slider implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
const
Slider
(
activeColor:
Colors
.
blue
,
divisions:
10
,
inactiveColor:
Colors
.
grey
,
label:
'Set a value'
,
max:
100.0
,
min:
0.0
,
onChanged:
null
,
onChangeEnd:
null
,
onChangeStart:
null
,
semanticFormatterCallback:
null
,
value:
50.0
,
).
debugFillProperties
(
builder
);
final
List
<
String
>
description
=
builder
.
properties
.
where
((
DiagnosticsNode
node
)
=>
!
node
.
isFiltered
(
DiagnosticLevel
.
info
))
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
()).
toList
();
expect
(
description
,
<
String
>[
'value: 50.0'
,
'disabled'
,
'min: 0.0'
,
'max: 100.0'
,
'divisions: 10'
,
'label: "Set a value"'
,
'activeColor: MaterialColor(primary value: Color(0xff2196f3))'
,
'inactiveColor: MaterialColor(primary value: Color(0xff9e9e9e))'
,
]);
});
}
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