Skip to content

RichText not following correct colors #43

Closed Answered by rydmike
DanMossa asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @DanMossa I reviewed your case. In your example you are using the RichText widget. It is a lower level widget that does not use any text theme, it must always be explicitly styled as explained here in Flutter docs: https://api.flutter.dev/flutter/widgets/RichText-class.html

If you want to use rich text that by default depends on the surrounding theme and its text theme, you should use Text.rich instead.

Here is an example based on your example without setting any theme color on the first number text:

class DemoRichText extends StatelessWidget {
  const DemoRichText({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return RichText(
      text: const T…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by rydmike
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question This issue is a usage question and will be moved to the Discussions section. works as expected Reported issue is not a bug, everything works as expected and designed
2 participants
Converted from issue

This discussion was converted from issue #25 on April 06, 2022 01:18.