|
|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
import 'dart:developer';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart'; // These are the Viewport values of your Figma Design.
|
|
|
|
|
import 'package:device_info_plus/device_info_plus.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:sizer/sizer.dart'; // These are the Viewport values of your Figma Design.
|
|
|
|
|
|
|
|
|
|
// These are used in the code as a reference to create your UI Responsively.
|
|
|
|
|
const num figmaDesignWidth = 375; // iPhone X / 12 base width
|
|
|
|
|
@ -18,12 +20,23 @@ extension ResponsiveExtension on num {
|
|
|
|
|
double get h => (this * _screenHeight) / figmaDesignHeight;
|
|
|
|
|
|
|
|
|
|
//radius
|
|
|
|
|
double get r => (this * _screenWidth) / figmaDesignWidth;
|
|
|
|
|
// double get r => (this * _screenWidth) / figmaDesignWidth;
|
|
|
|
|
|
|
|
|
|
double get r {
|
|
|
|
|
return isTablet ? ((this * _screenWidth) / figmaDesignWidth) * 0.7 : (this * _screenWidth) / figmaDesignWidth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Scale text size
|
|
|
|
|
// double get f {
|
|
|
|
|
// double scale = _screenWidth / figmaDesignWidth;
|
|
|
|
|
// if (scale > 1.6) scale = 1.6; // optional clamp for tablets
|
|
|
|
|
// return this * scale;
|
|
|
|
|
// }
|
|
|
|
|
double get f {
|
|
|
|
|
double scale = _screenWidth / figmaDesignWidth;
|
|
|
|
|
if (scale > 1.6) scale = 1.6; // optional clamp for tablets
|
|
|
|
|
double aspectRatio = _screenWidth / _screenHeight;
|
|
|
|
|
double scale = (_screenWidth < _screenHeight ? _screenWidth : _screenHeight) / figmaDesignWidth;
|
|
|
|
|
double clamp = (aspectRatio > 1.3 || aspectRatio < 0.77) ? 1.6 : 1.2;
|
|
|
|
|
if (scale > clamp) scale = clamp;
|
|
|
|
|
return this * scale;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -129,8 +142,9 @@ class SizeUtils {
|
|
|
|
|
deviceType = DeviceType.mobile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log("longerSide: $longerSide");
|
|
|
|
|
log("isTablet: $isTablet");
|
|
|
|
|
print("longerSide: $longerSide");
|
|
|
|
|
print("shorterSide: $shorterSide");
|
|
|
|
|
print("isTablet: $isTablet");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|