0 purchases
device screen size
Device Screen Size #
Device Screen Size package helps you to get your screen height and width in percentage.
Installation #
Add the latest version of package to your
pubspec.yaml (and rundart pub get):
dependencies:
device_screen_size: ^0.0.1
copied to clipboard
Import the package and use it in
your Flutter App.
import 'package:device_screen_size/device_screen_size.dart';
copied to clipboard
Example #
Here is a simple example to use it in your code
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
alignment: Alignment.center,
height: DeviceScreenSize.screenHeightInPercentage(context,
percentage: 0.8),
width: DeviceScreenSize.screenWidthInPercentage(context,
percentage: 1),
child: Image.asset(
myimage,
fit: BoxFit.fill,
),
),
),
);
}
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.