TwRow
TwRow provides you a really useful wrapper around the Row Widget to create Row for your app's UI and manage it with ease by using easy to use methods provided by the TwRow Widget.
| Tw Widget | Flutter Widget |
|---|---|
| TwRow | Row |
TIP
You have 2 options to create a Row Widget in your app while using TailwindCLI for UI design.
TwRowWidget- You can directly use this Widget to get a
Rowand start styling it by built in methods & extensions for all posible styles.
- You can directly use this Widget to get a
.isRowextension method- Or you can use this extension method on
RowWidget that will convert it toTwRowand provides you the extensions for all posible styling and return NativeRowwidget at the end.
- Or you can use this extension method on
No matter what you use for creating Row you will get the flutter's Row Widget at the end.
Usage
TwRow: Widget.isRow: Extension
TwRow and .isRow are just wrappers around the Row Widget itself to help you style it with ease using extension methods.
TwRow is a wrapper widget around the Row widget which allows you to create Row widget with ease.
| Tw Widget | Flutter Widget |
|---|---|
| TwRow() | Row |
.isRow is a helpful extension which creates a Row widget.
| Tw Widget | Flutter Widget |
|---|---|
| .isRow | Row |
TwRow widget
Widget build(BuildContext contexr){
return TwRow(<Widget>[
TwText("Left Text").render(),
TwText("Right Text").render(),
]).justifyBetween.render();
}2
3
4
5
6
Provided code will give you a Row with
mainAxisAlignmentasMainAxisAlignment.spaceBetween.
.isRow extension
Widget build(BuildContext contexr){
return Row(
children: [
TwText("Left Text").render(),
TwText("Right Text").render(),
],
).isRow // It's Magic: By using this
.justifyBetween.render(); // You will be able to do this
}2
3
4
5
6
7
8
9
Provided code will give you a Row with
mainAxisAlignmentasMainAxisAlignment.spaceBetween.
TwRow Constructor
TwRow(List<Widget> _children)TwRow properties
List<Widget>_children: Children to be rendered inside this Row Widget.
Api References
TwRow centralized all the properties of Row widget into easy to use methods.
mainAxisAlignment (Aligns horizontally)
| Method/Extension | Replaces | Applies |
|---|---|---|
| .justifyCenter | mainAxisAlignment | MainAxisAlignment.center |
| .justifyStart | mainAxisAlignment | MainAxisAlignment.start |
| .justifyEnd | mainAxisAlignment | MainAxisAlignment.end |
| .justifyBetween | mainAxisAlignment | MainAxisAlignment.spaceBetween |
| .justifyAround | mainAxisAlignment | MainAxisAlignment.spaceAround |
| .justifyEvenly | mainAxisAlignment | MainAxisAlignment.spaceEvenly |
crossAxisAlignment (Aligns vertically)
| Method/Extension | Replaces | Applies |
|---|---|---|
| .alignCenter | crossAxisAlignment | CrossAxisAlignment.center |
| .alignStart | crossAxisAlignment | CrossAxisAlignment.start |
| .alignEnd | crossAxisAlignment | CrossAxisAlignment.end |
| .alignBetween | crossAxisAlignment | CrossAxisAlignment.spaceBetween |
| .alignAround | crossAxisAlignment | CrossAxisAlignment.spaceAround |
| .alignEvenly | crossAxisAlignment | CrossAxisAlignment.spaceEvenly |
mainAxisSize
| Method/Extension | Replaces | Applies |
|---|---|---|
| .max | mainAxisSize | MainAxisSize.max |
| .min | mainAxisSize | MainAxisSize.min |
