Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thisisyusub/responsivex
A simple Flutter package to handle responsiveness
https://github.com/thisisyusub/responsivex
dart dart-package flutter responsive
Last synced: about 2 months ago
JSON representation
A simple Flutter package to handle responsiveness
- Host: GitHub
- URL: https://github.com/thisisyusub/responsivex
- Owner: thisisyusub
- License: bsd-2-clause
- Created: 2020-08-03T16:12:31.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-04T16:46:02.000Z (over 4 years ago)
- Last Synced: 2024-08-22T23:47:37.538Z (4 months ago)
- Topics: dart, dart-package, flutter, responsive
- Language: Dart
- Homepage:
- Size: 71.3 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
![GitHub](https://img.shields.io/github/license/yusubx/ResponsiveX)
![Pub Version](https://img.shields.io/pub/v/responsive_x)# ResponsiveX
A simple Flutter package to handle responsiveness.
---
### Overview
The package consists of the followings:
- **SizeConfig** - is the simple class that makes calculation for responsiveness.
- **Extensions** - are functions to calculation dynamic `height`, `width` and `font size`.---
### Example
First of all, you should initialize `SizeConfig` class using it's `init` method and giving the your design sizes (`Height` and `Width` given by your designer as screen size):```dart
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
return OrientationBuilder(
builder: (context, orientation) {
SizeConfig(
designScreenWidth: 360,
designScreenHeight: 640,
).init(constraints, orientation);return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
},
);
},
);
}
}
```
Then you can use `extension methods` to calculate `height`, `width` and `font size` dynamically:```dart
Container(
height: 100.height,
width: 100.width,
color: Colors.pink,
),
```
You can calculate `font size` as following:
```dart
Container(
height: 100.height,
width: 100.width,
color: Colors.pink,
child: Center(
child: Text(
'ResponsiveX',
style: TextStyle(
fontSize: 14.fontSize,
color: Colors.white,
),
),
),
),
```
---## Dart Versions
- Dart 2: >= 2.7.0## Maintainers
- [Kanan Yusubov](https://github.com/yusubx)