@@ -106,6 +106,7 @@ class MaterialBanner extends StatefulWidget {
106106    this .shadowColor,
107107    this .dividerColor,
108108    this .padding,
109+     this .margin,
109110    this .leadingPadding,
110111    this .forceActionsBelow =  false ,
111112    this .overflowAlignment =  OverflowBarAlignment .end,
@@ -185,6 +186,12 @@ class MaterialBanner extends StatefulWidget {
185186  /// `EdgeInsetsDirectional.only(start: 16.0, top: 2.0)` . 
186187   final  EdgeInsetsGeometry ?  padding;
187188
189+   /// Empty space to surround the [MaterialBanner] . 
190+   /// 
191+   /// If the [margin]  is null then this defaults to 
192+   /// 0 if the banner's [elevation]  is 0, 10 otherwise. 
193+    final  EdgeInsetsGeometry ?  margin;
194+ 
188195  /// The amount of space by which to inset the [leading]  widget. 
189196  /// 
190197  /// This defaults to `EdgeInsetsDirectional.only(end: 16.0)` . 
@@ -237,6 +244,7 @@ class MaterialBanner extends StatefulWidget {
237244      leading:  leading,
238245      backgroundColor:  backgroundColor,
239246      padding:  padding,
247+       margin:  margin,
240248      leadingPadding:  leadingPadding,
241249      forceActionsBelow:  forceActionsBelow,
242250      overflowAlignment:  overflowAlignment,
@@ -318,6 +326,7 @@ class _MaterialBannerState extends State<MaterialBanner> {
318326    );
319327
320328    final  double  elevation =  widget.elevation ??  bannerTheme.elevation ??  0.0 ;
329+     final  EdgeInsetsGeometry  margin =  widget.margin ??  EdgeInsets .only (bottom:  elevation >  0  ?  10.0  :  0.0 );
321330    final  Color  backgroundColor =  widget.backgroundColor
322331        ??  bannerTheme.backgroundColor
323332        ??  defaults.backgroundColor! ;
@@ -334,7 +343,7 @@ class _MaterialBannerState extends State<MaterialBanner> {
334343        ??  defaults.contentTextStyle;
335344
336345    Widget  materialBanner =  Container (
337-       margin:  EdgeInsets . only (bottom :  elevation  >   0   ?   10.0   :   0.0 ) ,
346+       margin:  margin ,
338347      child:  Material (
339348        elevation:  elevation,
340349        color:  backgroundColor,
0 commit comments