Files
tm_app/lib/size_config.dart
T
2025-08-03 09:44:43 +03:30

32 lines
742 B
Dart

import 'package:flutter/material.dart';
class SizeConfig {
static double screenWidth = 0.0;
static double screenHeight = 0.0;
static late TextScaler textScaler;
static void init(BuildContext context) {
screenWidth = MediaQuery.sizeOf(context).width;
screenHeight = MediaQuery.sizeOf(context).height;
textScaler = MediaQuery.of(context).textScaler;
}
}
extension SizeDoubleExt on double {
double h() {
final double screenHeight = SizeConfig.screenHeight;
final double res = (this / 917.0) * screenHeight;
return res;
}
double w() {
final double screenWidth = SizeConfig.screenWidth;
final double res = (this / 412.0) * screenWidth;
return res;
}
double sp() {
return h();
}
}