How do change the color of subtext value in flutter

user2570135

How do I change the color of a subtext value in flutter. I have the following code and would like "sign in" and "sign up" to be in a different color

Thanks for your help

child: Text(
 (isSignInScreenState)
   ? "don't have an account? sign up"
   : "already have an account? sign in",
  style: TextStyle(
    fontSize: 18.0,
  ),
 ),
Sayegh

Use RichText and TextSpan:

String question = isSignInScreenState ? "don't have an account? " : "already have an account? ";
String signText = isSignInScreenState ? "sign up" : "sign in";

// ...

RichText(
  text: TextSpan(
    text: question,
    style: TextStyle(fontSize: 18.0, color: Colors.black),
    children: <TextSpan>[
      TextSpan(text: signText, style: TextStyle(fontSize: 18.0, color: Colors.red)),
    ],
  ),
),

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do you change the value inside of a textfield flutter?

How do i do multiple checks on a props value in order to change the color of that value. Inside of style={ }?

How to change the chart line color to custom color code value in Flutter

How to change the text color of the button theme in Flutter

how to change color appbar of mapview flutter ?

Flutter how to get subtext aligned under title in appbar?

How do I change the check icon color in flutter filterChip

How do i change the color and text of Container at onTap event in FLUTTER

How do I change color's hue, saturation, or value in Flutter?

How to change color of border line in TextFormField with Flutter

Flutter how change dropdownlist item color

How do I change text selection handle color for iOS in Flutter?

How do I change the color of an infobox in shinydashboard based on a string, not a value?

how to change the value of a color in a qlist

MPAndroidChart - How to change color of value?

How to change color of subtext in the Text widget (Python)

How do I change the color on my noUiSliders depending on the value it currently is at?

Flutter - How to change the Color class' value that placed inside a custom widget?

How to give icon value color change in if-else condition in flutter?

How change Leading background color flutter

How to change the color of one row in DataTable in Flutter?

Flutter - How do I change a value straight after I setState

How do i change the label's color in a BottomNavigationBarItem in Flutter?

flutter: how to change tab color?

flutter problem: How to change color of ExpansionTile?

How to change datepicker color in flutter?

How can I change text color accordingly to the change in value receiving from socket in flutter

How to change Flutter theme data color?

How do I change the color of Flutter NavBar() icon?