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
ad4c4272
Commit
ad4c4272
authored
Aug 03, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for FontStyle.italics
parent
4270d897
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
text_style.dart
packages/flutter/lib/painting/text_style.dart
+18
-0
No files found.
packages/flutter/lib/painting/text_style.dart
View file @
ad4c4272
...
...
@@ -8,6 +8,8 @@ enum FontWeight { w100, w200, w300, w400, w500, w600, w700, w800, w900 }
const
normal
=
FontWeight
.
w400
;
const
bold
=
FontWeight
.
w700
;
enum
FontStyle
{
normal
,
italic
,
oblique
}
enum
TextAlign
{
left
,
right
,
center
}
enum
TextBaseline
{
alphabetic
,
ideographic
}
...
...
@@ -25,6 +27,7 @@ class TextStyle {
this
.
fontFamily
,
this
.
fontSize
,
this
.
fontWeight
,
this
.
fontStyle
,
this
.
textAlign
,
this
.
textBaseline
,
this
.
height
,
...
...
@@ -37,6 +40,7 @@ class TextStyle {
final
String
fontFamily
;
final
double
fontSize
;
// in pixels
final
FontWeight
fontWeight
;
final
FontStyle
fontStyle
;
final
TextAlign
textAlign
;
final
TextBaseline
textBaseline
;
final
double
height
;
// multiple of fontSize
...
...
@@ -49,6 +53,7 @@ class TextStyle {
String
fontFamily
,
double
fontSize
,
FontWeight
fontWeight
,
FontStyle
fontStyle
,
TextAlign
textAlign
,
TextBaseline
textBaseline
,
double
height
,
...
...
@@ -61,6 +66,7 @@ class TextStyle {
fontFamily:
fontFamily
!=
null
?
fontFamily
:
this
.
fontFamily
,
fontSize:
fontSize
!=
null
?
fontSize
:
this
.
fontSize
,
fontWeight:
fontWeight
!=
null
?
fontWeight
:
this
.
fontWeight
,
fontStyle:
fontStyle
!=
null
?
fontStyle
:
this
.
fontStyle
,
textAlign:
textAlign
!=
null
?
textAlign
:
this
.
textAlign
,
textBaseline:
textBaseline
!=
null
?
textBaseline
:
this
.
textBaseline
,
height:
height
!=
null
?
height
:
this
.
height
,
...
...
@@ -76,6 +82,7 @@ class TextStyle {
fontFamily:
other
.
fontFamily
,
fontSize:
other
.
fontSize
,
fontWeight:
other
.
fontWeight
,
fontStyle:
other
.
fontStyle
,
textAlign:
other
.
textAlign
,
textBaseline:
other
.
textBaseline
,
height:
other
.
height
,
...
...
@@ -140,6 +147,13 @@ class TextStyle {
FontWeight
.
w900
:
'900'
}[
fontWeight
];
}
if
(
fontStyle
!=
null
)
{
cssStyle
[
'font-style'
]
=
const
{
FontStyle
.
normal
:
'normal'
,
FontStyle
.
italic
:
'italic'
,
FontStyle
.
oblique
:
'oblique'
,
}[
fontStyle
];
}
if
(
decoration
!=
null
)
{
cssStyle
[
'text-decoration'
]
=
_decorationToCSSString
(
decoration
);
if
(
decorationColor
!=
null
)
...
...
@@ -170,6 +184,7 @@ class TextStyle {
fontFamily
==
other
.
fontFamily
&&
fontSize
==
other
.
fontSize
&&
fontWeight
==
other
.
fontWeight
&&
fontStyle
==
other
.
fontStyle
&&
textAlign
==
other
.
textAlign
&&
textBaseline
==
other
.
textBaseline
&&
decoration
==
other
.
decoration
&&
...
...
@@ -184,6 +199,7 @@ class TextStyle {
value
=
37
*
value
+
fontFamily
.
hashCode
;
value
=
37
*
value
+
fontSize
.
hashCode
;
value
=
37
*
value
+
fontWeight
.
hashCode
;
value
=
37
*
value
+
fontStyle
.
hashCode
;
value
=
37
*
value
+
textAlign
.
hashCode
;
value
=
37
*
value
+
textBaseline
.
hashCode
;
value
=
37
*
value
+
decoration
.
hashCode
;
...
...
@@ -203,6 +219,8 @@ class TextStyle {
result
.
add
(
'
${prefix}
fontSize:
$fontSize
'
);
if
(
fontWeight
!=
null
)
result
.
add
(
'
${prefix}
fontWeight:
$fontWeight
'
);
if
(
fontStyle
!=
null
)
result
.
add
(
'
${prefix}
fontStyle:
$fontStyle
'
);
if
(
textAlign
!=
null
)
result
.
add
(
'
${prefix}
textAlign:
$textAlign
'
);
if
(
textBaseline
!=
null
)
...
...
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