- Published on
How to use multiple text styles in Flutter
- Authors
- Name
- Saad Bash
User Flutter's built-in RichText
widget to display text with multiple different styles.
RichText(
text: TextSpan(
text: 'Hello ',
style: DefaultTextStyle.of(context).style,
children: const <TextSpan>[
TextSpan(text: 'Blue & Bold', style: TextStyle(fontWeight: FontWeight.bold, color: Colors.red)),
TextSpan(text: ' world!'),
],
),
)
Output:
More info: RichText Class