shadowPadding property
EdgeInsets
get
shadowPadding
The extra padding needed for shadows
Implementation
EdgeInsets get shadowPadding {
if (effects == null || effects!.isEmpty) return EdgeInsets.zero;
var left = 0.0;
var top = 0.0;
var right = 0.0;
var bottom = 0.0;
for (final effect in effects!) {
if (effect.type == figma.EffectType.dropShadow) {
final blurRadius = effect.radius?.toDouble() ?? 0;
final offsetX = effect.offset?.x.toDouble() ?? 0;
final offsetY = effect.offset?.y.toDouble() ?? 0;
left = math.max(left, blurRadius - math.min(offsetX, 0));
top = math.max(top, blurRadius - math.min(offsetY, 0));
right = math.max(right, blurRadius + math.max(offsetX, 0));
bottom = math.max(bottom, blurRadius + math.max(offsetY, 0));
}
}
return EdgeInsets.fromLTRB(left, top, right, bottom);
}