From bfc3664c982761a3bf81df673751be8b90d0f364 Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Sat, 2 Nov 2024 10:38:48 +0100 Subject: [PATCH] chore: :zap: Use MediaQuery.sizeOf(context) instead of MediaQuery.of(context).size --- CHANGELOG.md | 4 ++++ lib/src/ui/util/components/app_text_field.dart | 6 +++--- .../components/in_progress/in_progress_infos_banner.dart | 8 ++++---- lib/src/ui/util/components/scale_size.dart | 2 +- lib/src/ui/util/generic/responsive.dart | 8 ++++---- pubspec.lock | 8 ++++---- pubspec.yaml | 2 +- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f2e4e8..50078da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 3.2.2 + +* Use MediaQuery.sizeOf(context) instead of MediaQuery.of(context).size + # 3.2.1 * Coin price notifier starts auto updates on creation. diff --git a/lib/src/ui/util/components/app_text_field.dart b/lib/src/ui/util/components/app_text_field.dart index aa1b86b..196dbc2 100644 --- a/lib/src/ui/util/components/app_text_field.dart +++ b/lib/src/ui/util/components/app_text_field.dart @@ -102,8 +102,8 @@ class _AppTextFieldState extends ConsumerState { Widget build(BuildContext context) { return Container( margin: EdgeInsets.only( - left: widget.leftMargin ?? MediaQuery.of(context).size.width * 0.105, - right: widget.rightMargin ?? MediaQuery.of(context).size.width * 0.105, + left: widget.leftMargin ?? MediaQuery.sizeOf(context).width * 0.105, + right: widget.rightMargin ?? MediaQuery.sizeOf(context).width * 0.105, top: widget.topMargin!, ), padding: widget.padding, @@ -167,7 +167,7 @@ class _AppTextFieldState extends ConsumerState { bottom: 1, child: SizedBox( height: 1, - width: MediaQuery.of(context).size.width, + width: MediaQuery.sizeOf(context).width, ), ), // Buttons diff --git a/lib/src/ui/util/components/in_progress/in_progress_infos_banner.dart b/lib/src/ui/util/components/in_progress/in_progress_infos_banner.dart index 920adc7..9b6229f 100755 --- a/lib/src/ui/util/components/in_progress/in_progress_infos_banner.dart +++ b/lib/src/ui/util/components/in_progress/in_progress_infos_banner.dart @@ -28,7 +28,7 @@ class InProgressInfosBanner extends StatelessWidget { return InfoBanner( failureMessage!, InfoBannerType.error, - width: MediaQuery.of(context).size.width * 0.9, + width: MediaQuery.sizeOf(context).width * 0.9, ); } @@ -36,7 +36,7 @@ class InProgressInfosBanner extends StatelessWidget { return InfoBanner( walletConfirmationTxt, InfoBannerType.request, - width: MediaQuery.of(context).size.width * 0.9, + width: MediaQuery.sizeOf(context).width * 0.9, ); } @@ -44,14 +44,14 @@ class InProgressInfosBanner extends StatelessWidget { return InfoBanner( successTxt, InfoBannerType.success, - width: MediaQuery.of(context).size.width * 0.9, + width: MediaQuery.sizeOf(context).width * 0.9, ); } return InfoBanner( inProgressTxt, InfoBannerType.request, - width: MediaQuery.of(context).size.width * 0.9, + width: MediaQuery.sizeOf(context).width * 0.9, waitAnimation: true, ); } diff --git a/lib/src/ui/util/components/scale_size.dart b/lib/src/ui/util/components/scale_size.dart index 755d6fa..e8c7f6c 100644 --- a/lib/src/ui/util/components/scale_size.dart +++ b/lib/src/ui/util/components/scale_size.dart @@ -6,7 +6,7 @@ class ScaleSize { BuildContext context, { double maxTextScaleFactor = 2, }) { - final width = MediaQuery.of(context).size.width - 40; + final width = MediaQuery.sizeOf(context).width - 40; final val = (width / 1400) * maxTextScaleFactor; return max(0.5, min(val, maxTextScaleFactor)); } diff --git a/lib/src/ui/util/generic/responsive.dart b/lib/src/ui/util/generic/responsive.dart index 44e05f6..9d404ab 100644 --- a/lib/src/ui/util/generic/responsive.dart +++ b/lib/src/ui/util/generic/responsive.dart @@ -12,14 +12,14 @@ class Responsive extends StatelessWidget { final Widget desktop; static bool isMobile(BuildContext context) => - MediaQuery.of(context).size.width < 650; + MediaQuery.sizeOf(context).width < 650; static bool isTablet(BuildContext context) => - MediaQuery.of(context).size.width < 1100 && - MediaQuery.of(context).size.width >= 650; + MediaQuery.sizeOf(context).width < 1100 && + MediaQuery.sizeOf(context).width >= 650; static bool isDesktop(BuildContext context) => - MediaQuery.of(context).size.width >= 1100; + MediaQuery.sizeOf(context).width >= 1100; static double fontSizeFromTextStyle( BuildContext context, diff --git a/pubspec.lock b/pubspec.lock index c18f433..68e58cd 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -580,18 +580,18 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.12.0" mime: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index f258f72..fe3af4c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: archethic_dapp_framework_flutter description: An internal framework for archethic flutter development homepage: https://github.com/archethic-foundation/archethic-dapp-framework-flutter -version: 3.2.1 +version: 3.2.2 environment: sdk: ">=3.3.0 <4.0.0"