SizeConfig class

Utility class for handling size-related configurations in a Flutter application.

Constructors

SizeConfig(BuildContext context, [bool detectScreen = true, DeviceConfig config = const DeviceConfig(), Size? _requireSize])
Creates a SizeConfig instance with the provided context, detectScreen, config, and optional _requireSize.

Properties

config → DeviceConfig
final
context → BuildContext
final
detectScreen → bool
final
deviceType → DeviceType
Returns the DeviceType based on the screen width and height.
no setter
diagonal → double
Returns the diagonal size of the screen or the specified _requireSize.
no setter
hashCode → int
The hash code for this object.
no setterinherited
height → double
Returns the height of the screen or the specified _requireSize.
no setter
isDesktop → bool
Returns true if the screen is considered a desktop device.
no setter
isLaptop → bool
Returns true if the screen is considered a laptop device.
no setter
isMobile → bool
Returns true if the screen is considered a mobile device.
no setter
isTab → bool
Returns true if the screen is considered a tablet device.
no setter
isTV → bool
Returns true if the screen width is greater than the desktop width.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
screenDiagonal → double
Returns the diagonal size of the screen.
no setter
screenHeight → double
Returns the height of the screen.
no setter
screenSize → Size
final
screenWidth → double
Returns the width of the screen.
no setter
size → Size
Returns the specified _requireSize or the screen size.
no setter
width → double
Returns the width of the screen or the specified _requireSize.
no setter

Methods

dividedSize(double totalSize, double dividedLength) → double
Calculates the size by dividing the total size by the specified divided length.
dividedSpace(double dividedLength) → double
Returns the space calculated by dividing the detected pixel size by the specified divided length.
dividedSpaceHorizontal(double dividedLength) → double
Returns the horizontal space calculated by dividing the detected pixel size by the specified divided length.
dividedSpaceVertical(double dividedLength) → double
Returns the vertical space calculated by dividing the total height by the specified divided length.
dx(double? initialSize, [bool any = true]) → double
Converts the initial pixel size to pixels based on the device type, considering the screen variant.
fontSize(double initialSize) → double
Converts the initial font size to pixels based on the device type.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
percentageFontSize(double percentage) → double
Returns the font size calculated as a percentage of the detected pixel size.
percentageHeight(double percentage) → double
Returns the height calculated as a percentage of the total height.
percentageSize(double totalSize, double percentageSize) → double
Calculates the size based on a percentage of the total size.
percentageSpace(double percentage) → double
Returns the space calculated as a percentage of the detected pixel size.
percentageSpaceHorizontal(double percentage) → double
Returns the horizontal space calculated as a percentage of the detected pixel size.
percentageSpaceVertical(double percentage) → double
Returns the vertical space calculated as a percentage of the total height.
percentageWidth(double percentage) → double
Returns the width calculated as a percentage of the total width.
pixel(double? initialSize, [bool any = true]) → double
Converts the initial pixel size to pixels based on the device type, considering the screen variant.
pixelPercentage(double percentage) → double
Converts the initial pixel size to pixels based on the device type, considering the screen variant.
px(double? initialSize, [bool any = true]) → double
Converts the initial pixel size to pixels based on the device type.
space(double? initialSize) → double
Converts the initial size to pixels based on the device type and font variant.
spacePercentage(double percentage) → double
Converts the initial size to pixels based on the device type and font variant.
squire({double percentage = 100}) → double
Returns the square of the specified percentage of the detected pixel size.
toString() → String
A string representation of this object.
inherited
value(double? initialSize, [bool any = true]) → double
Converts the initial size to pixels based on the device type and font variant.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

of(BuildContext context, {bool detectScreen = true, DeviceConfig config = const DeviceConfig(), Size? size}) → SizeConfig
Creates a SizeConfig instance with the provided parameters.