Reinício do projeto: Estado atual completo das páginas
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user