This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
extension QuickPadding on Widget { | |
Widget padding( | |
{double? all, | |
double top = 0, | |
double bottom = 0, | |
double left = 0, | |
double right = 0}) { | |
EdgeInsets insets = (all != null) | |
? EdgeInsets.all(all) | |
: EdgeInsets.only(bottom: bottom, top: top, left: left, right: right); | |
return Padding( | |
padding: insets, | |
child: this, | |
); | |
} | |
} | |
extension QuickSizedBox on Widget { | |
Widget sizedBox({double? width, double? height}) { | |
return SizedBox( | |
width: width, | |
height: height, | |
child: this, | |
); | |
} | |
Widget boxExpand() { | |
return SizedBox.expand( | |
child: this, | |
); | |
} | |
} | |
extension QuickColumn on List<Widget> { | |
Widget column( | |
{CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center, | |
MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center}) { | |
return Column( | |
crossAxisAlignment: crossAxisAlignment, | |
mainAxisAlignment: mainAxisAlignment, | |
children: this, | |
); | |
} | |
} | |
extension QuickContainer on Widget { | |
Widget container({Decoration? decoration}) { | |
return Container( | |
decoration: decoration, | |
child: this, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment