forked from eatvio/eatvio_app
fix: remove sizer
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// This functions are responsible to make UI responsive across all the mobile devices.
|
||||
|
||||
MediaQueryData mediaQueryData = MediaQueryData.fromView(
|
||||
WidgetsBinding.instance.platformDispatcher.views.single,
|
||||
);
|
||||
|
||||
// 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 FIGMA_DESIGN_WIDTH = 375;
|
||||
const num FIGMA_DESIGN_HEIGHT = 812;
|
||||
const num FIGMA_DESIGN_STATUS_BAR = 0;
|
||||
|
||||
///This extension is used to set padding/margin (for the top and bottom side) & height of the screen or widget according to the Viewport height.
|
||||
extension ResponsiveExtension on num {
|
||||
///This method is used to get device viewport width.
|
||||
get _width {
|
||||
return mediaQueryData.size.width;
|
||||
}
|
||||
|
||||
///This method is used to get device viewport height.
|
||||
get _height {
|
||||
num statusBar = mediaQueryData.viewPadding.top;
|
||||
num bottomBar = mediaQueryData.viewPadding.bottom;
|
||||
num screenHeight = mediaQueryData.size.height - statusBar - bottomBar;
|
||||
return screenHeight;
|
||||
}
|
||||
|
||||
///This method is used to set padding/margin (for the left and Right side) & width of the screen or widget according to the Viewport width.
|
||||
double get h => ((this * _width) / FIGMA_DESIGN_WIDTH);
|
||||
|
||||
///This method is used to set padding/margin (for the top and bottom side) & height of the screen or widget according to the Viewport height.
|
||||
double get v => (this * _height) / (FIGMA_DESIGN_HEIGHT - FIGMA_DESIGN_STATUS_BAR);
|
||||
|
||||
///This method is used to set smallest px in image height and width
|
||||
double get adaptSize {
|
||||
var height = v;
|
||||
var width = h;
|
||||
return height < width ? height.toDoubleValue() : width.toDoubleValue();
|
||||
}
|
||||
|
||||
///This method is used to set text font size according to Viewport
|
||||
double get fSize => adaptSize;
|
||||
}
|
||||
|
||||
extension FormatExtension on double {
|
||||
/// Return a [double] value with formatted according to provided fractionDigits
|
||||
double toDoubleValue({int fractionDigits = 2}) {
|
||||
return double.parse(this.toStringAsFixed(fractionDigits));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user