Skip to content

Commit

Permalink
Fix text scale settings
Browse files Browse the repository at this point in the history
  • Loading branch information
FerMod committed Feb 16, 2024
1 parent 4989bbb commit 74f2e71
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions lib/screens/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -368,47 +368,40 @@ class ThemeModeSettingScreen extends StatelessWidget {
class TextScaleSettingScreen extends StatelessWidget {
const TextScaleSettingScreen({super.key});

Widget _buildText(String value, {required TextScaler textScaler}) {
return Text(
value,
textScaler: TextScaler.linear(deviceTextScaleFactor),
);
}

Map<double, DisplayOption> _buildOptionsMap(BuildContext context) {
final localizations = AppLocalizations.of(context)!;
return {
systemTextScaleFactorOption: DisplayOption(
title: localizations.settingsSystemDefault,
titleBuilder: (context, value) => _buildText(
titleBuilder: (context, value) => Text(
value,
textScaler: TextScaler.linear(deviceTextScaleFactor),
),
),
0.8: DisplayOption(
title: localizations.settingsTextScaleSmall,
titleBuilder: (context, value) => _buildText(
titleBuilder: (context, value) => Text(
value,
textScaler: const TextScaler.linear(0.8),
),
),
1.0: DisplayOption(
title: localizations.settingsTextScaleNormal,
titleBuilder: (context, value) => _buildText(
titleBuilder: (context, value) => Text(
value,
textScaler: const TextScaler.linear(1.0),
),
),
1.5: DisplayOption(
title: localizations.settingsTextScaleLarge,
titleBuilder: (context, value) => _buildText(
titleBuilder: (context, value) => Text(
value,
textScaler: const TextScaler.linear(1.5),
),
),
1.8: DisplayOption(
title: localizations.settingsTextScaleHuge,
titleBuilder: (context, value) => _buildText(
titleBuilder: (context, value) => Text(
value,
textScaler: const TextScaler.linear(1.8),
),
Expand Down

0 comments on commit 74f2e71

Please sign in to comment.