relative_scale
2.0.0, released 6 years ago by xamantra.dev
Custom sizing system for Flutter widgets to achieve the same physical sizes across different devices.
WASM-readyCopyleft license
What it does
Provides relative sizing methods (sy and sx) based on screen height and width through a RelativeBuilder widget, ensuring widgets maintain consistent physical proportions across various screen sizes.
AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want consistent widget physical sizing across different screen dimensions
- Your application is locked to a single orientation (e.g., portrait only)
Skip it when
- Your app needs to support both portrait and landscape orientations dynamically
- You prefer standard Flutter responsive layout builders and constraints
Strengths
- Simple custom sizing API via sy and sx scaling methods
- RelativeBuilder makes it easy to use in stateless widgets
Weaknesses
- Does not support orientation changes and can break when rotated
- Requires locking device rotation for predictable behavior
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
not documented
RelativeBuilder(
builder: (context, height, width, sy, sx) {
return Scaffold(
appBar: AppBar(
title: Text(
'App Bar Title',
style: TextStyle(fontSize: sy(13)),
),
),
body: Container(
height: height,
width: width,
child: Text(
'Body Text',
style: TextStyle(fontSize: sy(11)),
),
),
);
},
)Alternatives
Packages that do the same job and could replace relative_scale.
- responsive_toolkit
Easy-to-use responsive tools and grid layouts for Flutter screens.
50Compare