resolve static method

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

Resolves margin 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.ml ?? style.mx ?? style.m, context, spacing),
      right: _resolveValue(style.mr ?? style.mx ?? style.m, context, spacing),
      top: _resolveValue(style.mt ?? style.my ?? style.m, context, spacing),
      bottom: _resolveValue(
        style.mb ?? style.my ?? style.m,
        context,
        spacing,
      ),
    );
  } catch (e) {
    throw ArgumentError('Failed to resolve margin: $e');
  }
}