Scale Size

pub package

A Flutter package helps applications design differently from GUI guides, even on devices with different resolutions.


To use this plugin, add scale_size as a dependency in your pubspec.yaml file.


// Import package
import 'package:scale_size/scale_size.dart';

// Instantiate it in build function of first screen (ex: Splash screen)
class SplashScreen extends StatelessWidget {

  Widget build(BuildContext context) {
    // designWidth, designHeight is size of width, height in GUI design (ex: figma, zeplin, ...)  
    ScaleSize.init(context, designWidth: 360, designHeight: 640);
    return Scaffold(...);

// Access size with init designWidth
ScaleSize.scaleW(10); or 10.sw
// Access size with current designWidth
ScaleSize.scaleW(10, designWidth: 360);

// Access size with init designHeight
ScaleSize.scaleH(10); or
// Access size with current designHeight
ScaleSize.scaleH(10, designHeight: 640);

// Available size after init
ScaleSize.statusBarHeight; // or
ScaleSize.navigationBarHeight; // or 1.bottom
ScaleSize.screenWidth; // or 1.width
ScaleSize.screenHeight}; // or 1.height

// Re-init
ScaleSize.reInit(context, designWidth: 360, designHeight: 640, orientation: Orientation.portrait);