adaptive_screen_utils 1.2.0 adaptive_screen_utils: ^1.2.0 copied to clipboard
Flutter Package for creating adaptive UIs for different screen sizes.
adaptive_screen_utils #
A Flutter package to provide Adaptive Screen Utils for creating responsive UI for different screen sizes. Make your UI look great on any device.
Usage #
To use this package, add adaptive_screen_utils
as a dependency in your pubspec.yaml file.
dependencies:
adaptive_screen_utils: ^1.2.0
Example #
Import the file to your project
import 'package:adaptive_screen_utils/adaptive_screen_utils.dart';
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final desktop = expanded(context);
final tablet = medium(context);
return Scaffold(
appBar: AppBar(
title: Text('Adaptive Screen Utils'),
),
body: Builder(
builder: (context) {
if (desktop) {
return Center(
child: Text(
'Desktop',
style: Theme.of(context).textTheme.headline4,
),
);
} else if (tablet) {
return Center(
child: Text(
'Tablet',
style: Theme.of(context).textTheme.headline4,
),
);
}
return Center(
child: Text(
'Mobile',
style: Theme.of(context).textTheme.headline4,
),
);
},
),
);
}
}
Methods #
Method | Description |
---|---|
compact |
Returns true if the screen width is less than 600.0 |
medium |
Returns true if the screen width is less than 840.0 |
expanded |
Returns true if the screen width is greater than 840.0 |
Issues & Feedback #
If you wish to contribute to this repo, welcome to Pull Requests.
Star ⭐ the repo if you find it useful 🤩🤩. we are open to enhancements
, bug-fixes
& suggestions
. feel free to open an issue.
License #
MIT License