Hello. My name is Masaru Hirose.
I made a simple package.
This package creates Duration
, EdgeInsets
, and SizedBox
from int
and double
via extensions.
I’ve put together some instructions on how to use it, so if you’re interested, go ahead and give it a try!
katana_shorten
Introduction
Duration
and EdgeInsets
are classes that are often used to implement Flutter.
Surprisingly, there are many characters to describe, and even though there is auto-completion, it takes a lot of time and effort to type the characters.
Therefore, I have created a package of extensions that can shorten them.
It can be easily written as follows
Padding(
padding: 16.p, // EdgeInsets.all(16)
child: Text("text")
);
Future.delayed(100.ms); // Duration(milliseconds: 100)
Installation
Import the following packages
flutter pub add katana_shorten
How to use
Duration
The following can be substituted.
100.ms // Duration(milliseconds: 100)
100.s // Duration(seconds: 100)
100.m // Duration(minutes: 100)
100.h // Duration(hours: 100)
100.d // Duration(days: 100)
EdgeInsets(Padding / Margin)
The following can be substituted.
100.p // EdgeInsets.all(100)
100.px // EdgeInsets.symmetric(horizontal: 100)
100.py // EdgeInsets.symmetric(vertical: 100)
100.pt // EdgeInsets.only(top: 100)
100.pb // EdgeInsets.only(bottom: 100)
100.pl // EdgeInsets.only(left: 100)
100.pr // EdgeInsets.only(right: 100)
Space(SizedBox)
The following can be substituted.
100.sx // SizedBox(width: 100)
100.sy // SizedBox(height: 100)
Empty() // SizedBox.shrink()
Conclusion
I made it for my own use, but if you think it fits your implementation philosophy, by all means, use it!
Also, I releasing the source here, so issues and PullRequests are welcome!
If you have any further work requests, please contact me directly through my Twitter or website!