AI-generated Key Takeaways
-
TextStyleBuilder is used to create text styles.
-
It provides methods to set properties like bold, italic, underline, strikethrough, font family, font size, and foreground color.
-
The
build()method creates the final TextStyle object from the builder. -
Most methods return the TextStyleBuilder itself, allowing for method chaining.
A builder for text styles.
Methods
| Method | Return type | Brief description |
|---|---|---|
Text
|
Creates a text style from this builder. | |
Text
|
Sets whether or not the text is bold. | |
Text
|
Sets the text font family, such as "Arial". | |
Text
|
Sets the text font size in points. | |
Text
|
Sets the text font color. | |
Text
|
Sets the text font color. | |
Text
|
Sets whether or not the text is italic. | |
Text
|
Sets whether or not the text has strikethrough. | |
Text
|
Sets whether or not the text is underlined. |
Detailed documentation
build()
set
Bold(bold)
Sets whether or not the text is bold.
Parameters
| Name | Type | Description |
|---|---|---|
bold
|
Boolean
|
Whether or not the text is bold. |
Return
Text
— The builder for chaining.
set
Font
Family(fontFamily)
Sets the text font family, such as "Arial".
Parameters
| Name | Type | Description |
|---|---|---|
font
|
String
|
The desired font family. |
Return
Text
— The builder for chaining.
set
Font
Size(fontSize)
Sets the text font size in points.
Parameters
| Name | Type | Description |
|---|---|---|
font
|
Integer
|
The desired font size. |
Return
Text
— The builder for chaining.
set
Foreground
Color(cssString)
Sets the text font color.
Parameters
| Name | Type | Description |
|---|---|---|
css
|
String
|
The desired font color in CSS notation (such as '#ffffff'
or 'white'
). |
Return
Text
— The builder for chaining.
set
Foreground
Color
Object(color)
Sets the text font color.
Parameters
| Name | Type | Description |
|---|---|---|
color
|
Color
|
The desired font color. |
Return
Text
— The builder for chaining.
set
Italic(italic)
Sets whether or not the text is italic.
Parameters
| Name | Type | Description |
|---|---|---|
italic
|
Boolean
|
Whether or not the text is italic. |
Return
Text
— The builder for chaining.
set
Strikethrough(strikethrough)
Sets whether or not the text has strikethrough.
Parameters
| Name | Type | Description |
|---|---|---|
strikethrough
|
Boolean
|
Whether or not the text has strikethrough. |
Return
Text
— The builder for chaining.
set
Underline(underline)
Sets whether or not the text is underlined.
Parameters
| Name | Type | Description |
|---|---|---|
underline
|
Boolean
|
Whether or not the text is underlined. |
Return
Text
— The builder for chaining.

