MyContainer constructor

const MyContainer({
  1. Key? key,
  2. Widget? child,
  3. EdgeInsetsGeometry? padding,
  4. EdgeInsetsGeometry? margin,
  5. Color? color,
  6. Decoration? decoration,
  7. Decoration? foregroundDecoration,
  8. AlignmentGeometry? alignment,
  9. double? width,
  10. double? height,
  11. BoxConstraints? constraints,
  12. Matrix4? transform,
  13. AlignmentGeometry? transformAlignment,
  14. Clip clipBehavior = Clip.none,
  15. BoxBorder? border,
  16. BorderRadiusGeometry? borderRadius,
  17. List<BoxShadow>? boxShadow,
  18. Gradient? gradient,
  19. BoxShape shape = BoxShape.rectangle,
  20. DecorationImage? image,
})

Creates a customized Container widget.

Implementation

const MyContainer({
  super.key,
  this.child,
  this.padding,
  this.margin,
  this.color,
  this.decoration,
  this.foregroundDecoration,
  this.alignment,
  this.width,
  this.height,
  this.constraints,
  this.transform,
  this.transformAlignment,
  this.clipBehavior = Clip.none,
  // Initialize common decoration properties
  this.border,
  this.borderRadius,
  this.boxShadow,
  this.gradient,
  this.shape = BoxShape.rectangle, // Default shape
  this.image,
}) : assert(shape != BoxShape.circle || borderRadius == null,
          'A borderRadius cannot be given when the shape is BoxShape.circle.');