-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @DanMossa thanks for opening this issue. Regardless of if you can share any more info. I will setup a test case and try to replicate the issue as well and get back to you so we can figure out together if it is a bug or config/setup related issue. |
Beta Was this translation helpful? Give feedback.
-
Hi @DanMossa I reviewed your case. In your example you are using the If you want to use rich text that by default depends on the surrounding theme and its text theme, you should use 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 TextSpan(
text: '200.5',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
),
children: <InlineSpan>[
TextSpan(
text: ' miles',
style: TextStyle(color: Colors.grey, fontSize: 12.0))
]),
);
}
}
class DemoTextRich extends StatelessWidget {
const DemoTextRich({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Text.rich(
TextSpan(
text: '200.5',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
),
children: <InlineSpan>[
TextSpan(
text: ' miles',
style: TextStyle(color: Colors.grey, fontSize: 12.0))
],
),
);
}
} The first one The 2nd widget Here the above two widgets are inserted into a UI for demonstration. First in light mode, where the number on the Here are the same widgets in dark mode, now the Hope this helps, the behavior you are seeing is actually expected and normal behavior with the widget you used. Kind regards, Mike |
Beta Was this translation helpful? Give feedback.
-
@rydmike You are an absolute wizard. You're 100% right and using |
Beta Was this translation helpful? Give feedback.
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.htmlIf 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: