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
7c27142e
Unverified
Commit
7c27142e
authored
Aug 05, 2019
by
Ferhat
Committed by
GitHub
Aug 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upstream web support for IterableProperty<double> (#37515)
* Upstream web support for IterableProperty<double>
parent
35b6d668
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
diagnostics.dart
packages/flutter/lib/src/foundation/diagnostics.dart
+11
-3
diagnostics_test.dart
packages/flutter/test/foundation/diagnostics_test.dart
+9
-0
No files found.
packages/flutter/lib/src/foundation/diagnostics.dart
View file @
7c27142e
...
...
@@ -2217,20 +2217,28 @@ class IterableProperty<T> extends DiagnosticsProperty<Iterable<T>> {
);
@override
String
valueToString
({
TextTreeConfiguration
parentConfiguration
})
{
String
valueToString
({
TextTreeConfiguration
parentConfiguration
})
{
if
(
value
==
null
)
return
value
.
toString
();
if
(
value
.
isEmpty
)
return
ifEmpty
??
'[]'
;
final
Iterable
<
String
>
formattedValues
=
value
.
map
((
T
v
)
{
if
(
T
==
double
&&
v
is
double
)
{
return
debugFormatDouble
(
v
);
}
else
{
return
v
.
toString
();
}
});
if
(
parentConfiguration
!=
null
&&
!
parentConfiguration
.
lineBreakProperties
)
{
// Always display the value as a single line and enclose the iterable
// value in brackets to avoid ambiguity.
return
'[
${
value
.join(', ')}
]'
;
return
'[
${
formattedValues
.join(', ')}
]'
;
}
return
value
.
join
(
_isSingleLine
(
style
)
?
', '
:
'
\n
'
);
return
formattedValues
.
join
(
_isSingleLine
(
style
)
?
', '
:
'
\n
'
);
}
/// Priority level of the diagnostic used to control which diagnostics should
...
...
packages/flutter/test/foundation/diagnostics_test.dart
View file @
7c27142e
...
...
@@ -1611,6 +1611,15 @@ void main() {
expect
(
intsProperty
.
isFiltered
(
DiagnosticLevel
.
info
),
isFalse
);
expect
(
intsProperty
.
toString
(),
equals
(
'ints: 1, 2, 3'
));
final
List
<
double
>
doubles
=
<
double
>[
1
,
2
,
3
];
final
IterableProperty
<
double
>
doublesProperty
=
IterableProperty
<
double
>(
'doubles'
,
doubles
,
);
expect
(
doublesProperty
.
value
,
equals
(
doubles
));
expect
(
doublesProperty
.
isFiltered
(
DiagnosticLevel
.
info
),
isFalse
);
expect
(
doublesProperty
.
toString
(),
equals
(
'doubles: 1.0, 2.0, 3.0'
));
final
IterableProperty
<
Object
>
emptyProperty
=
IterableProperty
<
Object
>(
'name'
,
<
Object
>[],
...
...
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