resize
1.0.0, released 5 years ago by nanthakumaran.com
A simple responsive design approach for Flutter apps supporting scaling sizing and fonts.
What it does
Provides a set of extension methods (.h, .w, .sp, .r, etc.) on numbers to build responsive layouts and scale fonts based on a design resolution. Requires wrapping your app in a Resize widget.
AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to scale dimensions and font sizes proportionally based on a target design resolution.
- You need a lightweight solution for responsive sizing using extension methods.
Skip it when
- You prefer built-in Flutter adaptive mechanisms like LayoutBuilder or MediaQuery without pixel-scaling extensions.
- You need more advanced multi-breakpoint adaptive layout structures.
Strengths
- Easy to use with numeric extensions like .h, .w, and .sp.
- Supports custom base design sizes and REM-based font sizing.
Weaknesses
- Relies on global initialization via a Resize widget in the widget tree.
- Hardcoded scaling approach may not fit every screen aspect ratio equally well.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Initialize the Resize helper widget in your main app builder before using any responsive extensions.
import 'package:flutter/material.dart';
import 'package:resize/resize.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Resize(
builder: () {
return MaterialApp(
home: Scaffold(
body: Container(
height: 100.h,
width: 100.w,
),
),
);
},
);
}
}Alternatives
Packages that do the same job and could replace resize.
- responsive_framework
Provides robust responsive scaling, breakpoints, and auto-scaling for various screen sizes.
50Compare - sizer
Alternative sizing extension package based on device width and height percentages.
63Compare - responsive_builder
Offers layout builders to target specific device types like mobile, tablet, and desktop.
50Compare
Works with
Packages commonly used together with resize: ones it builds on, ones built on it, and its own family.