Sdpify is a lightweight package that provides Scalable Density Pixels (SDP) to ensure a consistent UI across different screen sizes and densities. It dynamically converts pixel-based values (px) into scalable dp (sdp), making your app adaptive and responsive on all devices.
- Simple
.sdpextension for easy usage - Automatically updates on screen size changes & rotation
- Works seamlessly on Android, iOS, Web, Desktop
- No more hardcoded pixel values - true scalability!
Add the package to your pubspec.yaml file:
dependencies:
sdpify: ^latest_versionThen, run:
flutter pub getimport 'package:sdpify/sdpify.dart';To ensure proper scaling, wrap your MaterialApp with Sdpify:
Sdpify(
builder: (context) {
return MaterialApp(
home: HomePage(),
);
},
);double scalableSize = 16.sdp; // Scales dynamically based on screen sizeContainer(
width: 100.sdp, // Scaled width
height: 50.sdp, // Scaled height
);Text(
'Sdpify Example',
style: TextStyle(fontSize: 14.sdp),
);Converts a logical pixel value to scalable dp.
A wrapper widget that automatically adjusts scaling based on screen size and orientation.
builder: A function that returns the main app widget.
Contributions are welcome! Feel free to open an issue or submit a pull request.
Sdpify is released under the MIT License.