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
20a49edd
Commit
20a49edd
authored
Dec 03, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for letterSpacing to TextStyle
parent
5ad32f29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
13 deletions
+25
-13
text_style.dart
packages/flutter/lib/src/painting/text_style.dart
+25
-13
No files found.
packages/flutter/lib/src/painting/text_style.dart
View file @
20a49edd
...
...
@@ -30,6 +30,7 @@ class TextStyle {
this
.
fontSize
,
this
.
fontWeight
,
this
.
fontStyle
,
this
.
letterSpacing
,
this
.
textAlign
,
this
.
textBaseline
,
this
.
height
,
...
...
@@ -41,48 +42,52 @@ class TextStyle {
/// Whether null values are replaced with their value in an ancestor text style.
final
bool
inherit
;
/// The color to use when painting the text
/// The color to use when painting the text
.
final
Color
color
;
/// The name of the font to use when painting the text
/// The name of the font to use when painting the text
.
final
String
fontFamily
;
/// The size of gyphs (in logical pixels) to use when painting the text
/// The size of gyphs (in logical pixels) to use when painting the text
.
final
double
fontSize
;
/// The font weight to use when painting the text
/// The font weight to use when painting the text
.
final
FontWeight
fontWeight
;
/// The font style to use when painting the text
/// The font style to use when painting the text
.
final
FontStyle
fontStyle
;
/// The amount of space to add between each letter.
final
double
letterSpacing
;
/// How the text should be aligned (applies only to the outermost
/// StyledTextSpan, which establishes the container for the text)
/// StyledTextSpan, which establishes the container for the text)
.
final
TextAlign
textAlign
;
/// The baseline to use for aligning the text
/// The baseline to use for aligning the text
.
final
TextBaseline
textBaseline
;
/// The distance between the text baselines, as a multiple of the font size
/// The distance between the text baselines, as a multiple of the font size
.
final
double
height
;
/// A list of decorations to paint near the text
/// A list of decorations to paint near the text
.
final
List
<
TextDecoration
>
decoration
;
// TODO(ianh): Switch this to a Set<> once Dart supports constant Sets
/// The color in which to paint the text decorations
/// The color in which to paint the text decorations
.
final
Color
decorationColor
;
/// The style in which to paint the text decorations
/// The style in which to paint the text decorations
.
final
TextDecorationStyle
decorationStyle
;
/// Returns a new text style that matches this text style but with the given
/// values replaced
/// values replaced
.
TextStyle
copyWith
({
Color
color
,
String
fontFamily
,
double
fontSize
,
FontWeight
fontWeight
,
FontStyle
fontStyle
,
double
letterSpacing
,
TextAlign
textAlign
,
TextBaseline
textBaseline
,
double
height
,
...
...
@@ -97,6 +102,7 @@ class TextStyle {
fontSize:
fontSize
!=
null
?
fontSize
:
this
.
fontSize
,
fontWeight:
fontWeight
!=
null
?
fontWeight
:
this
.
fontWeight
,
fontStyle:
fontStyle
!=
null
?
fontStyle
:
this
.
fontStyle
,
letterSpacing:
letterSpacing
!=
null
?
letterSpacing
:
this
.
letterSpacing
,
textAlign:
textAlign
!=
null
?
textAlign
:
this
.
textAlign
,
textBaseline:
textBaseline
!=
null
?
textBaseline
:
this
.
textBaseline
,
height:
height
!=
null
?
height
:
this
.
height
,
...
...
@@ -119,6 +125,7 @@ class TextStyle {
fontSize:
other
.
fontSize
,
fontWeight:
other
.
fontWeight
,
fontStyle:
other
.
fontStyle
,
letterSpacing:
other
.
letterSpacing
,
textAlign:
other
.
textAlign
,
textBaseline:
other
.
textBaseline
,
height:
other
.
height
,
...
...
@@ -137,7 +144,8 @@ class TextStyle {
fontWeight:
fontWeight
,
fontStyle:
fontStyle
,
fontFamily:
fontFamily
,
fontSize:
fontSize
fontSize:
fontSize
,
letterSpacing:
letterSpacing
);
}
...
...
@@ -161,6 +169,7 @@ class TextStyle {
fontSize
==
typedOther
.
fontSize
&&
fontWeight
==
typedOther
.
fontWeight
&&
fontStyle
==
typedOther
.
fontStyle
&&
letterSpacing
==
typedOther
.
letterSpacing
&&
textAlign
==
typedOther
.
textAlign
&&
textBaseline
==
typedOther
.
textBaseline
&&
decoration
==
typedOther
.
decoration
&&
...
...
@@ -177,6 +186,7 @@ class TextStyle {
value
=
37
*
value
+
fontSize
.
hashCode
;
value
=
37
*
value
+
fontWeight
.
hashCode
;
value
=
37
*
value
+
fontStyle
.
hashCode
;
value
=
37
*
value
+
letterSpacing
.
hashCode
;
value
=
37
*
value
+
textAlign
.
hashCode
;
value
=
37
*
value
+
textBaseline
.
hashCode
;
value
=
37
*
value
+
decoration
.
hashCode
;
...
...
@@ -235,6 +245,8 @@ class TextStyle {
break
;
}
}
if
(
letterSpacing
!=
null
)
result
.
add
(
'
${prefix}
letterSpacing:
$letterSpacing
'
);
if
(
textAlign
!=
null
)
{
switch
(
textAlign
)
{
case
TextAlign
.
left
:
...
...
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