ModalComponent constructor

ModalComponent({
  1. required PositionComponent scrollContent,
  2. required Vector2 size,
  3. required Vector2 position,
  4. String? title,
  5. EdgeInsets padding = const EdgeInsets.all(8),
  6. double? contentHeight,
  7. bool autoContentHeight = true,
  8. TextStyle? titleStyle,
  9. double titleSpacing = 2,
  10. Paint? paint,
  11. PositionComponent? closeButton,
  12. VoidCallback? onAfterLoad,
  13. PositionComponent? footer,
  14. PositionComponent? background,
  15. double defaultFooterHeight = 32,
  16. double scrollDamping = 500.0,
})

Creates a ModalComponent with the given parameters.

scrollContent is required and specifies the content to display inside the modal. size specifies the size of the modal. position specifies the position of the modal. title is optional and specifies the title of the modal. padding specifies the padding around the content (default is 8). contentHeight optionally specifies the height of the content. autoContentHeight determines if the content height should be automatically calculated (default is true). titleStyle specifies the text style for the title. titleSpacing specifies the spacing between the title and the content (default is 2). paint optionally specifies the paint for the background. background allows passing a custom component to use as the modal background instead of a default rectangle. closeButton optionally provides a component to render in the top-right corner. onAfterLoad optionally specifies a callback after the modal has loaded. footer optionally specifies a footer component to display at the bottom. defaultFooterHeight specifies the default height of the footer (default is 32). scrollDamping specifies the damping factor for scroll velocity (default is 500.0).

Implementation

ModalComponent({
  required PositionComponent scrollContent,
  required Vector2 size,
  required Vector2 position,
  String? title,
  EdgeInsets padding = const EdgeInsets.all(8),
  double? contentHeight,
  bool autoContentHeight = true,
  TextStyle? titleStyle,
  double titleSpacing = 2,
  Paint? paint,
  PositionComponent? closeButton,
  this.onAfterLoad,
  PositionComponent? footer,
  PositionComponent? background,
  this.defaultFooterHeight = 32,
  double scrollDamping = 500.0,
}) : _scrollContent = scrollContent,
     _title = title,
     _padding = padding,
     _contentHeight = contentHeight,
     _autoContentHeight = autoContentHeight,
     _titleStyle = titleStyle,
     _titleSpacing = titleSpacing,
     _closeButton = closeButton,
     _footer = footer,
     _background = background,
     _scrollDamping = scrollDamping,
     super(size: size, position: position);