Skip to content

Commit

Permalink
refactor: fixed scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
TesteurManiak committed Dec 20, 2023
1 parent bf0cc78 commit 2d98005
Show file tree
Hide file tree
Showing 26 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/src/components/buttons/primary.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class DSFRPrimaryButton extends DSFRGroupeableButton {
final dsfrTypography = dsfrTheme.typography;
final dsfrButtonStyle = dsfrTheme.buttonStyle;

final scale = MediaQuery.textScalerOf(context).textScaleFactor;
final scale = MediaQuery.textScalerOf(context)
.scale(dsfrTypography.medium.fontSize ?? 1);
final double gap =
scale <= 1 ? 8 : lerpDouble(8, 4, math.min(scale - 1, 1))!;

Expand Down
3 changes: 2 additions & 1 deletion lib/src/components/buttons/secondary.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class DSFRSecondaryButton extends DSFRGroupeableButton {
final dsfrColors = dsfrTheme.colors;
final dsfrButtonStyle = dsfrTheme.buttonStyle;

final scale = MediaQuery.textScalerOf(context).textScaleFactor;
final scale = MediaQuery.textScalerOf(context)
.scale(dsfrTypography.medium.fontSize ?? 1);
final double gap =
scale <= 1 ? 8 : lerpDouble(8, 4, math.min(scale - 1, 1))!;

Expand Down
3 changes: 2 additions & 1 deletion lib/src/components/buttons/tertiary.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class DSFRTertiaryButton extends DSFRBaseButton {
final dsfrColors = dsfrTheme.colors;
final dsfrTypography = dsfrTheme.typography;

final scale = MediaQuery.textScalerOf(context).textScaleFactor;
final scale = MediaQuery.textScalerOf(context)
.scale(dsfrTypography.medium.fontSize ?? 1);
final double gap =
scale <= 1 ? 8 : lerpDouble(8, 4, math.min(scale - 1, 1))!;

Expand Down
3 changes: 3 additions & 0 deletions lib/src/dsfr_app.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import '../flutter_dsfr.dart';

/// An application that uses the french government design system.
Expand Down Expand Up @@ -232,6 +233,7 @@ class _DSFRAppState extends State<DSFRApp> {
if (useDarkTheme) {
colors = const DSFRColors.dark();
theme = ThemeData(
useMaterial3: false,
fontFamily: 'Marianne',
brightness: Brightness.dark,
extensions: [
Expand All @@ -241,6 +243,7 @@ class _DSFRAppState extends State<DSFRApp> {
} else {
colors = const DSFRColors.light();
theme = ThemeData(
useMaterial3: false,
fontFamily: 'Marianne',
brightness: Brightness.light,
extensions: [
Expand Down
Binary file modified test/components/alerts/goldens/ci/alert_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/alerts/goldens/ci/alert_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/badges/goldens/ci/badge_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/badges/goldens/ci/badge_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/buttons/goldens/ci/france_connect_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/buttons/goldens/ci/primary_button_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/buttons/goldens/ci/primary_button_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/buttons/goldens/ci/radio_button_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/buttons/goldens/ci/radio_button_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/buttons/goldens/ci/radio_group_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/buttons/goldens/ci/radio_rich_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/buttons/goldens/ci/secondary_button_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/buttons/goldens/ci/secondary_button_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/buttons/goldens/ci/tertiary_button_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/buttons/goldens/ci/tertiary_button_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/buttons_group/goldens/ci/buttons_group_vertical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/components/logo/goldens/ci/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/flutter_test_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Future<void> testExecutable(FutureOr<void> Function() testMain) async {
theme: ThemeData(
fontFamily: 'Marianne',
brightness: Brightness.light,
useMaterial3: false,
extensions: const [
DSFRThemeData(colors: DSFRColors.light()),
],
Expand Down
Binary file modified test/theme/goldens/ci/radius.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/theme/goldens/ci/typography.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2d98005

Please sign in to comment.