Jonny Borges
Committed by GitHub

Update widget_extensions.dart

1 import 'package:flutter/widgets.dart'; 1 import 'package:flutter/widgets.dart';
2 2
  3 +/// add Padding Property to widget
3 extension WidgetPaddingX on Widget { 4 extension WidgetPaddingX on Widget {
4 Widget paddingAll(double padding) => 5 Widget paddingAll(double padding) =>
5 Padding(padding: EdgeInsets.all(padding), child: this); 6 Padding(padding: EdgeInsets.all(padding), child: this);
@@ -24,6 +25,7 @@ extension WidgetPaddingX on Widget { @@ -24,6 +25,7 @@ extension WidgetPaddingX on Widget {
24 Widget get paddingZero => Padding(padding: EdgeInsets.zero, child: this); 25 Widget get paddingZero => Padding(padding: EdgeInsets.zero, child: this);
25 } 26 }
26 27
  28 +/// Add margin property to widget
27 extension WidgetMarginX on Widget { 29 extension WidgetMarginX on Widget {
28 Widget marginAll(double margin) => 30 Widget marginAll(double margin) =>
29 Container(margin: EdgeInsets.all(margin), child: this); 31 Container(margin: EdgeInsets.all(margin), child: this);
@@ -40,7 +42,7 @@ extension WidgetMarginX on Widget { @@ -40,7 +42,7 @@ extension WidgetMarginX on Widget {
40 double right = 0.0, 42 double right = 0.0,
41 double bottom = 0.0, 43 double bottom = 0.0,
42 }) => 44 }) =>
43 - Container( 45 + Padding(
44 margin: EdgeInsets.only( 46 margin: EdgeInsets.only(
45 top: top, left: left, right: right, bottom: bottom), 47 top: top, left: left, right: right, bottom: bottom),
46 child: this); 48 child: this);
@@ -48,6 +50,7 @@ extension WidgetMarginX on Widget { @@ -48,6 +50,7 @@ extension WidgetMarginX on Widget {
48 Widget get marginZero => Container(margin: EdgeInsets.zero, child: this); 50 Widget get marginZero => Container(margin: EdgeInsets.zero, child: this);
49 } 51 }
50 52
  53 +/// Allows you to insert widgets inside a CustomScrollView
51 extension WidgetSliverBoxX on Widget { 54 extension WidgetSliverBoxX on Widget {
52 Widget get sliverBox => SliverToBoxAdapter(child: this); 55 Widget get sliverBox => SliverToBoxAdapter(child: this);
53 } 56 }