easy_widgets 0.0.4
easy_widgets: ^0.0.4 copied to clipboard
Simplified most used widget & Mixins and access to extenstion that makes your code cleaner and shorter.
easy_widgets 🤖 #
Simplified and quick access to most used widget with easy access to extenstions and functions/helpers which are responsive in nature.
Features | Description |
---|---|
Responsive | Every easy widgets are responsive in nature. Other nums can be responsive by using '.hWise' or '.wWise' extension. |
Simplified Widgets | Simplified widgets to configure faster and easier like EasyContainer, EasyScrollList, and more. |
Multiple push/pushNamed | Can push multiple pages at once with animation, commonly used for deep linking or app linking. |
Page transitions | Easy page transitions with multiple animations. |
Easy Mixin support | Gives you access to multiple common used functions simplified, like showing loading indicator while future, snackbars, dialog and more. |
Easy extensions | Multiple extensions to make code faster, these extensions helps in responsiveness. The extensions works on list, context, nums, Widgets and more |
Installation #
flutter pub add easy_widgets
or
dependencies:
easy_widgets: ^0.0.4
Import #
All you need is a signle import:
import 'package:easy_widget/easy_widget.dart';
Initialize(MUST!) #
For the responsive functionality, you need to initialize the easy widget first.
There are two ways to initialize the easy widget.
1. If your app is never going to change its dimensions(like in Android or Ios), then you can initialize the easy widget in the main.dart file inside build function of your app like this.
EasyWidget.initiate(context);
import 'package:easy_widget/easy_widget.dart';
/*
.
rest of the code
.
*/
@override
Widget build(BuildContext context) {
EasyWidget.initiate(context(
context,
designHeight: 720, // Put your design dimension heiight here, this is optional
designWidth: 360, // Put your design dimension width here, this is optional
); // Must initialize the easy widget here.
return YOURWIDGET(
/*
.
your code
.
*/
);
}
2. If your app is going to change its dimensions(like in web), then you should initialize the easy widget with the help of easy mixin.
Use EasyMixin with your page stateful class and it will automatically initialize the easy widget.
with EasyMixin
import 'package:easy_widget/easy_widget.dart';
/*
.
rest of the code
.
*/
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> with EasyMixin { // Must extend the State class with EasyMixin
/*
.
rest of the code
.
*/
}
However if you're willing to pass the design dimensions, you can pass them in init like this:
@override
void initState() {
setDesignDimension(360, 720);// put your design width and height here
super.initState();
}
Responsive #
Every easy widget is responsive in nature. Other nums can be responsive by using '.hWise'
or '.wWise'
extension.
For example:
Container(
height: 200.hWise, // height will be adjusted accrding to the height of the screen,
width: 200.wWise, // width will be adjusted according to the width of the screen,
);
You can use the same with Texts, Buttons, Padding, etc.
For example:
Text(
'Lorem ispum',
style: TextStyle(
fontSize: 14.hWise, // Text will be adjusted according to the height of the screen,
),
);