Skip to content

Sdpify - Scalable Density Pixels for Responsive UI

License

Notifications You must be signed in to change notification settings

shariarunix/Sdpify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📏 Sdpify - Scalable Density Pixels for Responsive UI

Pub Version Platform Support

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.


🚀 Features

  • Simple .sdp extension for easy usage
  • Automatically updates on screen size changes & rotation
  • Works seamlessly on Android, iOS, Web, Desktop
  • No more hardcoded pixel values - true scalability!

📦 Installation

Add the package to your pubspec.yaml file:

dependencies:
  sdpify: ^latest_version

Then, run:

flutter pub get

📌 Usage

Import the package

import 'package:sdpify/sdpify.dart';

Wrap Your App with Sdpify

To ensure proper scaling, wrap your MaterialApp with Sdpify:

Sdpify(
  builder: (context) {
    return MaterialApp(
      home: HomePage(),
    );
  },
);

Convert Pixels to SDP

double scalableSize = 16.sdp; // Scales dynamically based on screen size

Responsive Widget Sizing

Container(
  width: 100.sdp, // Scaled width
  height: 50.sdp, // Scaled height
);

Font Scaling

Text(
  'Sdpify Example',
  style: TextStyle(fontSize: 14.sdp),
);

📖 API Reference

double.sdp

int.sdp

num.sdp

Converts a logical pixel value to scalable dp.

Sdpify

A wrapper widget that automatically adjusts scaling based on screen size and orientation.

Parameters:

  • builder: A function that returns the main app widget.

🤝 Contributions

Contributions are welcome! Feel free to open an issue or submit a pull request.

📜 License

Sdpify is released under the MIT License.

About

Sdpify - Scalable Density Pixels for Responsive UI

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages