Reputation: 41
I want to change my font (amion) with Nexa font and other letters with Roboto, how do I change that using Flutter? font_Image
Upvotes: 3
Views: 2143
Reputation: 11669
You can use RichText
widget, that allows to apply textStyle
to the text spans. A sample below:
body: Center(
child: RichText(
text: TextSpan(
text: 'Say Hello to ', style: TextStyle(fontFamily: 'Roboto', color: Colors.black, fontWeight: FontWeight.normal),
children: <TextSpan>[
TextSpan(text: 'Amion', style: TextStyle(fontFamily: 'Nexa', color: Colors.black, fontStyle: FontStyle.italic)),
TextSpan(text: ' app !', style: TextStyle(fontFamily: 'Roboto', color: Colors.black, fontWeight: FontWeight.normal))
]
),
),
)
You just need to replace the fontFamily
with whatever you need. I just gave Roboto
and Nexa
as an example for your reference.
Upvotes: 6
Reputation: 438
just do it in a Row, you can change the style of the Text as you want, including the font
new Row(
children: <Widget>[
new Text(
"bla",
style: new TextStyle(
color: Colors.blue,
),
),
new Text(
"bla",
style: new TextStyle(
color: Colors.red,
),
)
],
)
Upvotes: 0