Reputation: 29
i think is a simple question but i don t kwon who solve this, Is it possible to put this
String asterisk = '*';
in red?
i try, something like that
String asterisk = '*',
style: TextStyle(
color: Colors.red,
);
but this just work in
const Text(
"Registar",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 40),
),
basically I need to put the * in front of the "text('register')" and I wanted the * to be red
String asterisk = '*', color: Colors.red;
const Text(
"Registar *",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 40),
),
Upvotes: 0
Views: 329
Reputation: 1663
You can use the RichText
widget to provide multiple styles in TextSpan
widgets:
RichText(
text: const TextSpan(
children: [
TextSpan(text: '*', style: TextStyle(color: Colors.red)),
TextSpan(
text: 'Registar',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 40,
),
),
],
),
)
Upvotes: 1