import 'package:flutter/material.dart'; extension WidgetExtension on Widget { Widget withPadding({ double all = 0, double left = 0, double top = 0, double right = 0, double bottom = 0, double horizontal = 0, double vertical = 0, }) => switch ((all, left, top, right, bottom, horizontal, vertical)) { (> 0, _, _, _, _, _, _) => Padding( padding: EdgeInsets.all(all), child: this, ), (0, 0, 0, 0, 0, >= 0, >= 0) => Padding( padding: EdgeInsets.symmetric( horizontal: horizontal, vertical: vertical, ), child: this, ), _ => Padding( padding: EdgeInsets.only( left: left, top: top, right: right, bottom: bottom, ), child: this, ), }; }