resolve static method

EdgeInsets resolve(
  1. BuildContext context,
  2. FlyStyle style
)

Resolves padding from FlyStyle and FlyTheme into EdgeInsets

Implementation

static EdgeInsets resolve(BuildContext context, FlyStyle style) {
  try {
    final spacing = FlyTheme.of(context).spacing;

    return EdgeInsets.only(
      left: _resolveValue(style.pl ?? style.px ?? style.p, context, spacing),
      right: _resolveValue(style.pr ?? style.px ?? style.p, context, spacing),
      top: _resolveValue(style.pt ?? style.py ?? style.p, context, spacing),
      bottom: _resolveValue(
        style.pb ?? style.py ?? style.p,
        context,
        spacing,
      ),
    );
  } catch (e) {
    throw ArgumentError('Failed to resolve padding: $e');
  }
}