RichText (Flutter Widget of the Week)
Why Stack Overflow recommends it
Stack Overflow users link it when answering or asking how to style parts of a Text differently, centre mixed-style text, or make a span clickable.
Recommended by 1 people across 1 different months, 2020 to 2021.
What it is
A 74-second Flutter Widget of the Week episode from the official Flutter channel introducing the RichText widget. It shows how to combine multiple text styles, such as bold, color or different fonts, within a single line or paragraph using TextSpan.
What people said
Recommends ElsayedDev · 2020-09 · Stack Overflow · on “Change Color/Weight/Font of a Text dynamically in Rich Text”
If you need to change some part of text you can use rich text, please check this video: [this video] if you want to add condition to modefiy property follow this: 1- make you widget a StateFullWidget 2- using (condtion) ? (do this if condition true) : (do this if condition false) i.e color: _isSelected ? Colors.black : Colors.white, 3- in the event you will start to change the poperty for it i.e OnPressed() using setState((){ _isSelected = !_isSelected }) or any condition you want
Cites SPlus91 · 2020-08 · Stack Overflow · on “Flutter: how to insert a link in a RichText widget”
In this video [this video] they say you can use a Gesture recognizers in order to create a clickable link in your TextSpan, but I found no examples in the RichText official documentation and in general on internet. Can someone please explain me how to do that?
Cites Syed · 2021-12 · Stack Overflow · on “How to center two Texts in Flutter”
Use RichText : Video [this video] | Document [LINK] RichText( textAlign: TextAlign.center, text: TextSpan( text: 'Hello ', children: const <TextSpan>[ TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold)), TextSpan(text: ' world!'), ], ), )