buildCustomBorder static method

Widget buildCustomBorder(
  1. BuildContext context,
  2. Widget child,
  3. FlyStyle flyStyle,
  4. AlignmentGeometry? alignment,
  5. EdgeInsetsGeometry? padding,
  6. EdgeInsetsGeometry? margin,
  7. Decoration? foregroundDecoration,
  8. double? width,
  9. double? height,
  10. BoxConstraints? constraints,
  11. Matrix4? transform,
  12. AlignmentGeometry? transformAlignment,
  13. Clip clipBehavior,
)

Build widget with custom borders (dashed/dotted)

Implementation

static Widget buildCustomBorder(
  BuildContext context,
  Widget child,
  FlyStyle flyStyle,
  AlignmentGeometry? alignment,
  EdgeInsetsGeometry? padding,
  EdgeInsetsGeometry? margin,
  Decoration? foregroundDecoration,
  double? width,
  double? height,
  BoxConstraints? constraints,
  Matrix4? transform,
  AlignmentGeometry? transformAlignment,
  Clip clipBehavior,
) {
  // Resolve background color and border radius
  final backgroundColor = BoxProperty.resolveBackgroundColor(
    context,
    flyStyle,
  );
  final borderRadius = BoxProperty.resolveBorderRadius(context, flyStyle);

  // Start with the child
  Widget container = child;

  // Apply padding if needed
  if (padding != null) {
    container = Padding(padding: padding, child: container);
  }

  // Apply custom border to padded content
  container = FlyBorderUtils.createBorderWidget(context, flyStyle, container);

  // Apply background color for custom borders
  if (backgroundColor != null) {
    container = _createBackgroundContainer(
      backgroundColor,
      borderRadius,
      container,
    );
  }

  // Apply size constraints if needed
  if (width != null || height != null) {
    container = SizedBox(width: width, height: height, child: container);
  }

  // Apply margin if needed
  if (margin != null) {
    container = Container(margin: margin, child: container);
  }

  // Apply intrinsic width constraints if needed
  return FlySizeUtils.apply(context, flyStyle, container);
}