build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Describes the part of the UI represented by this widget.

Implementation

@override
Widget build(BuildContext context) {
  final stylePadding = _edgeInsetsFromStylePadding(style?.getPadding);
  final styleMargin = _edgeInsetsFromStyleMargin(style?.getMargin);
  final styleBorder = _borderFromStyle(style);
  final styleBackground = style?.getBackground;
  final styleForeground = style?.getForeground;
  final styleBorderColor = style?.getBorderForeground;

  final effectiveBorder = border ?? styleBorder;
  final effectiveBackground = background ?? styleBackground;
  final effectiveForeground = foreground ?? styleForeground;
  final effectiveBorderColor = borderColor ?? styleBorderColor;

  final decoration = (effectiveBackground != null || effectiveBorder != null)
      ? BoxDecoration(color: effectiveBackground, border: effectiveBorder)
      : null;

  Widget content = child;
  if (effectiveForeground != null) {
    content = Tint(color: effectiveForeground, child: content);
  }

  return Container(
    padding: padding ?? stylePadding,
    margin: margin ?? styleMargin,
    decoration: decoration,
    foreground: effectiveBorderColor,
    child: content,
  );
}