apply static method
Applies position properties to a widget
Implementation
static Widget apply(BuildContext context, FlyStyle style, Widget child) {
final top = resolvePosition(context, style, 'top');
final right = resolvePosition(context, style, 'right');
final bottom = resolvePosition(context, style, 'bottom');
final left = resolvePosition(context, style, 'left');
final inset = resolveInset(context, style);
final insetX = resolveInsetX(context, style);
final insetY = resolveInsetY(context, style);
// If inset is specified, apply to all sides
if (inset != null) {
return Positioned(
top: inset,
right: inset,
bottom: inset,
left: inset,
child: child,
);
}
// If insetX is specified, apply to left and right
if (insetX != null) {
return Positioned(
left: insetX,
right: insetX,
top: top,
bottom: bottom,
child: child,
);
}
// If insetY is specified, apply to top and bottom
if (insetY != null) {
return Positioned(
top: insetY,
bottom: insetY,
left: left,
right: right,
child: child,
);
}
// Apply individual position values
if (top != null || right != null || bottom != null || left != null) {
return Positioned(
top: top,
right: right,
bottom: bottom,
left: left,
child: child,
);
}
// No position properties, return child as-is
return child;
}