apply static method

Widget apply(
  1. BuildContext context,
  2. TwStyle style,
  3. Widget child
)

Applies margin to a widget using the resolved EdgeInsets

Implementation

static Widget apply(BuildContext context, TwStyle style, Widget child) {
  final margin = resolve(context, style);

  // If no margin is set, return the child as-is
  if (margin == EdgeInsets.zero) {
    return child;
  }

  // Apply margin using Container
  return Container(
    margin: margin,
    child: child,
  );
}