From ed4cff34f66d108aa8c3daf8a7ca351abbae1655 Mon Sep 17 00:00:00 2001 From: 230404 <230404@epvc.pt> Date: Wed, 18 Mar 2026 01:36:30 +0000 Subject: [PATCH] =?UTF-8?q?Rein=C3=ADcio=20do=20projeto:=20Estado=20atual?= =?UTF-8?q?=20completo=20das=20p=C3=A1ginas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/build.gradle.kts | 1 - lib/utils/size_extension.dart | 28 ++++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index c1984fb..a37c46e 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -9,7 +9,6 @@ android { namespace = "com.example.playmaker" compileSdk = flutter.compileSdkVersion //ndkVersion = flutter.ndkVersion - ndkVersion = "26.1.10909125" compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 diff --git a/lib/utils/size_extension.dart b/lib/utils/size_extension.dart index 793bc2c..6de9ec7 100644 --- a/lib/utils/size_extension.dart +++ b/lib/utils/size_extension.dart @@ -3,9 +3,29 @@ import 'dart:math' as math; extension SizeExtension on BuildContext { double get sf { - final double wScreen = MediaQuery.of(this).size.width; - final double hScreen = MediaQuery.of(this).size.height; - // Ajusta a escala baseada no ecrã (muda os valores 1150/720 conforme a tua calibração) - return math.min(wScreen / 1150, hScreen / 720); + final Size size = MediaQuery.of(this).size; + + // 1. Definimos os valores base do design (geralmente feitos no Figma/Adobe XD) + const double baseWidth = 375; + const double baseHeight = 812; + + // 2. Calculamos o rácio de largura e altura + double scaleW = size.width / baseWidth; + double scaleH = size.height / baseHeight; + + // 3. Usamos a média ou o menor valor para manter a proporção + // O 'min' evita que o texto estique demasiado se o ecrã for muito alto ou largo + double scale = math.min(scaleW, scaleH); + + // 4. Segurança (Clamping): Não deixa as coisas ficarem minúsculas + // nem exageradamente grandes em tablets. + return scale.clamp(0.8, 1.4); } + + // Atalhos úteis para facilitar o código + double get screenWidth => MediaQuery.of(this).size.width; + double get screenHeight => MediaQuery.of(this).size.height; + + // Verifica se é Tablet (opcional) + bool get isTablet => screenWidth > 600; } \ No newline at end of file