Skip to content

Commit

Permalink
feat(app): using Text.rich instead of RichText resolved dynamic font …
Browse files Browse the repository at this point in the history
…size issue
  • Loading branch information
tamslo committed Mar 1, 2024
1 parent b3272de commit 7fadc06
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions app/lib/report/pages/report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ReportPage extends StatelessWidget {
Column(
children: [
PageDescriptionText(context.l10n.report_legend_text),
SizedBox(height: PharMeTheme.smallSpace * 0.5),
_buildWarningLevelIndicators(
getText: (warningLevel) =>
warningLevel.getLabel(context),
Expand Down Expand Up @@ -130,7 +131,7 @@ class GeneCard extends StatelessWidget {
}
}

RichText _buildWarningLevelIndicators({
Text _buildWarningLevelIndicators({
required String? Function(WarningLevel) getText,
InlineSpan? separator,
}) {
Expand All @@ -153,8 +154,8 @@ RichText _buildWarningLevelIndicators({
),
];
}
return RichText(
text: TextSpan(
return Text.rich(
TextSpan(
style: PharMeTheme.textTheme.bodyMedium,
children: content,
)
Expand All @@ -163,10 +164,7 @@ RichText _buildWarningLevelIndicators({

List<InlineSpan> _buildWarningLevelIndicator(
WarningLevel warningLevel,
{
required String text,
Widget? separator,
}
{ required String text }
) {
return [
WidgetSpan(
Expand All @@ -177,8 +175,7 @@ List<InlineSpan> _buildWarningLevelIndicator(
),
),
WidgetSpan(
child: separator ??
SizedBox(width: PharMeTheme.smallSpace * 0.4),
child: SizedBox(width: PharMeTheme.smallSpace * 0.4),
),
TextSpan(
text: text,
Expand Down

0 comments on commit 7fadc06

Please sign in to comment.