division 0.1.0+4
division: ^0.1.0+4 copied to clipboard
A common use Widget inspired by HTML/ CSS. The goal of this widget is to simplify styling and facilitate for reusability. The styling syntax is heavily inspired by CSS.
division #
A flutter widget inspired by HTML/CSS
Getting Started #
This package is all about giving a simple common use widget inspired by HTML/ CSS. The widget has 3 main parameters. Style: everything related to styling, gesture: all gesture functions and child. As simple as that!
The basic widget #
Division(style: [], gesture: [], child: Widget);
Example #
import 'package:division/division.dart'
Division(
style: [
S.height(100.0),
S.width(500.0),
S.minWidth(500.0),
S.align('center'),
S.alignChild('center'),
S.padding(vertical: 20.0, horizontal: 10.0),
S.margin(horizontal: 30.0),
S.backgroundColor(hex: '55ffff'),
S.borderRadius(all: 20.0),
S.boxShadow(hex: '55ffff', spread: -10.0, blur: 20.0, offset: [0.0, 15.0]),
],
gesture: [
G.onTap(() => print('Division widget pressed!')),
],
child: Text('Centered text inside the division widget'),
)
Having one list of all styling improves readability. But maybe more important, it makes it very easy to store the style in variables and share the same style accross many widgets.
Style Property #
The S class is responsible for everything stylingwise
-
S.height(), S.minHeight(), S.maxHeight(), S.width(), S.minWidth(), S.maxWidth()- Expects a double -
S.align()- Alignment of the Division widget. Expects a String. Valid values:'center','top','bottom','left','right','topLeft','topRight','bottomLeft'and'bottomRight' -
S.alignChild()- Alignment of the child widget. Expects a String. Valid values:'center','top','bottom','left','right','topLeft','topRight','bottomLeft'and'bottomRight' -
S.padding- You can choose how you want your padding to work. Eighter specify theallparameter with a double, thehorizontalandverticalparameter with a double ortop,bottom,leftandrightparameter with a double. -
S.margin- You can choose how you want your padding to work. Eighter specify theallparameter with a double, thehorizontalandverticalparameter with a double ortop,bottom,leftandrightparameter with a double. -
S.backgroundColor- Expects eighter thehexparameter as a 6 digit hex color,rgbaparameter in the [r,g,b,a] format or the normal flutterColorformat. -
S.borderRadius- Expects eighter theallparameter as a double ortopLeft,topRight,bottomLeftandbottomRightparameters as a double -
S.boxShadow- Expects acolorparameter in the form of eighter thehexparameter, thergbaparameter or the standartcolorparameter. Expectsspreadparameter as a double, theblurparameter as a double. Theoffsetparameter can eighter be specified as aListwith one item. That single item will apply on both the horizontal and the vertical axis. Theoffsetparameter can also be specified with aListof 2 items, which will apply on the horizontal and vertical axis.
Future features
S.animate- Animates between a old and new style property. Expects adurationparameter in milliseconds, acurveparameter and aonlyparameter witch contains a list of the style properties the animation is going to get applied to. What it might look like:S.animate(duration: 500, curve: 'ease-in', only: ['width', 'margin'])
Gesture Property #
The G class is responsible for all the gestures
G.onTap()- onTap function
Future features
- Other useful gesture functions
GestureStyle (not implemented yet) #
Style to be applied while a gesture is taking place. For example button style when button is beeing pressed.
Child Property #
Widget child