uni_size 1.1.7 copy "uni_size: ^1.1.7" to clipboard
uni_size: ^1.1.7 copied to clipboard

A Flutter package for responsive design using .dp and .sp units that scale with device screen and text settings. Works consistently on all platforms.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:uni_size/uni_size.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return UniSizeWidget(
      designWidth: 375, // Your design width (optional, default: 375)
      designHeight: 812, // Your design height (optional, default: 812)
      builder: (context, orientation, screenType) {
        return MaterialApp(title: 'UniSize Demo', home: MyHomePage());
      },
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          'UniSize Demo',
          style: TextStyle(fontSize: 18.sp), // Use .sp for fonts
        ),
      ),
      body: Container(
        width: 200.dp, // Use .dp for sizes
        height: 100.dp, // Use .dp for sizes
        padding: EdgeInsets.all(16.dp), // Use .dp for padding
        margin: EdgeInsets.symmetric(
          horizontal: 20.dp, // Use .dp for margins
          vertical: 10.dp,
        ),
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.dp), // Use .dp for radius
        ),
        child: Text(
          'Hello UniSize!',
          style: TextStyle(
            fontSize: 16.sp, // Use .sp for font size
            height: 1.5, // Line height can remain unitless
          ),
        ),
      ),
    );
  }
}
4
likes
160
points
25
downloads

Publisher

verified publisherjagadeeschouhdary.com

Weekly Downloads

A Flutter package for responsive design using .dp and .sp units that scale with device screen and text settings. Works consistently on all platforms.

Repository (GitHub)
View/report issues

Topics

#responsive #ui #design #sizing #scaling

Documentation

Documentation
API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

flutter

More

Packages that depend on uni_size