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
67e35d61
Unverified
Commit
67e35d61
authored
Sep 16, 2019
by
Gary Qian
Committed by
GitHub
Sep 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Specify ifTrue and ifFalse for strut FlagProperty (#40609)
parent
b9a34dec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
1 deletion
+65
-1
strut_style.dart
packages/flutter/lib/src/painting/strut_style.dart
+1
-1
strut_style_test.dart
packages/flutter/test/painting/strut_style_test.dart
+64
-0
No files found.
packages/flutter/lib/src/painting/strut_style.dart
View file @
67e35d61
...
...
@@ -597,7 +597,7 @@ class StrutStyle extends Diagnosticable {
));
styles
.
add
(
EnumProperty
<
FontStyle
>(
'
${prefix}
style'
,
fontStyle
,
defaultValue:
null
));
styles
.
add
(
DoubleProperty
(
'
${prefix}
height'
,
height
,
unit:
'x'
,
defaultValue:
null
));
styles
.
add
(
FlagProperty
(
'
${prefix}
forceStrutHeight'
,
value:
forceStrutHeight
,
defaultValue:
null
));
styles
.
add
(
FlagProperty
(
'
${prefix}
forceStrutHeight'
,
value:
forceStrutHeight
,
defaultValue:
null
,
ifTrue:
'
$prefix
<strut height forced>'
,
ifFalse:
'
$prefix
<strut height normal>'
));
final
bool
styleSpecified
=
styles
.
any
((
DiagnosticsNode
n
)
=>
!
n
.
isFiltered
(
DiagnosticLevel
.
info
));
styles
.
forEach
(
properties
.
add
);
...
...
packages/flutter/test/painting/strut_style_test.dart
0 → 100644
View file @
67e35d61
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/painting.dart'
;
import
'../flutter_test_alternative.dart'
;
void
main
(
)
{
test
(
'StrutStyle diagnostics test'
,
()
{
const
StrutStyle
s0
=
StrutStyle
(
fontFamily:
'Serif'
,
fontSize:
14
,
);
expect
(
s0
.
toString
(),
equals
(
'StrutStyle(family: Serif, size: 14.0)'
),
);
const
StrutStyle
s1
=
StrutStyle
(
fontFamily:
'Serif'
,
fontSize:
14
,
forceStrutHeight:
true
,
);
expect
(
s1
.
fontFamily
,
'Serif'
);
expect
(
s1
.
fontSize
,
14.0
);
expect
(
s1
,
equals
(
s1
));
expect
(
s1
.
toString
(),
equals
(
'StrutStyle(family: Serif, size: 14.0, <strut height forced>)'
),
);
const
StrutStyle
s2
=
StrutStyle
(
fontFamily:
'Serif'
,
fontSize:
14
,
forceStrutHeight:
false
,
);
expect
(
s2
.
toString
(),
equals
(
'StrutStyle(family: Serif, size: 14.0, <strut height normal>)'
),
);
const
StrutStyle
s3
=
StrutStyle
();
expect
(
s3
.
toString
(),
equals
(
'StrutStyle'
),
);
const
StrutStyle
s4
=
StrutStyle
(
forceStrutHeight:
false
,
);
expect
(
s4
.
toString
(),
equals
(
'StrutStyle(<strut height normal>)'
),
);
const
StrutStyle
s5
=
StrutStyle
(
forceStrutHeight:
true
,
);
expect
(
s5
.
toString
(),
equals
(
'StrutStyle(<strut height forced>)'
),
);
});
}
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