apply static method

Widget apply(
  1. BuildContext context,
  2. FlyStyle flyStyle,
  3. Widget child
)

Apply utilities to any widget in the correct order

The order is important for proper layering:

  1. Padding (innermost - applied to content)
  2. Border Radius (applied to background container)
  3. Margin (outermost - wraps the decoration)

Future utilities would be added here in the correct order.

Implementation

static Widget apply(BuildContext context, FlyStyle flyStyle, Widget child) {
  Widget result = child;

  // Apply utilities in the correct order (inner to outer)
  // Core widget creation and color handling is done by individual widgets

  // 1. Padding (applied to the content)
  if (flyStyle.hasPadding) {
    result = FlyPaddingUtils.apply(context, flyStyle, result);
  }

  // 2. Border Radius (applied to the background container)
  if (flyStyle.hasBorderRadius) {
    result = FlyRoundedUtils.apply(context, flyStyle, result);
  }

  // 3. Margin (outermost - wraps the decoration)
  if (flyStyle.hasMargin) {
    result = FlyMarginUtils.apply(context, flyStyle, result);
  }

  // Future utilities would go here:
  // 4. Shadow (wraps margin)
  // 5. Border (handled by individual widgets like FlyContainer)

  return result;
}