buildWidget method

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

build your widget here

Implementation

@override
Widget buildWidget(BuildContext context) {
  Widget rtn;
  // Check for custom border styles
  if (widget._controller.type == DividerType.dotted || widget._controller.type == DividerType.dashed) {
    // Use a custom painted widget for dotted or dashed lines
    rtn = CustomPaint(
      size: Size(
        widget._controller.direction == DirectionType.vertical
            ? (widget._controller.thickness ?? 1).toDouble()
            : double.infinity,
        widget._controller.direction == DirectionType.vertical
            ? double.infinity
            : (widget._controller.thickness ?? 1).toDouble(),
      ),
      painter: DashedLinePainter(
        color: (widget._controller.color ?? const Color(0xFFD3D3D3))
            .withValues(alpha: widget._controller.opacity ?? 1.0),
        thickness: (widget._controller.thickness ?? 1).toDouble(),
        isVertical: widget._controller.direction == DirectionType.vertical,
        dashLength: widget._controller.dashLength ?? 5,
        gap: widget._controller.gap ?? 3,
        type: widget._controller.type,
        indent: (widget._controller.indent ?? 0).toDouble(),
        endIndent: (widget._controller.endIndent ?? 0).toDouble(),
      ),
    );
  } else {
    if (widget._controller.direction == DirectionType.vertical) {
      rtn = VerticalDivider(
          width: (widget._controller.thickness ?? 1).toDouble(),
          thickness: (widget._controller.thickness ?? 1).toDouble(),
          indent: (widget._controller.indent ?? 0).toDouble(),
          endIndent: (widget._controller.endIndent ?? 0).toDouble(),
          color: (widget._controller.color ?? const Color(0xFFD3D3D3))
              .withValues(alpha: widget._controller.opacity ?? 1.0));
      rtn = StudioDebugger()
          .assertHasBoundedHeight(rtn, "${EnsembleDivider.type} (vertical)");
    } else {
      rtn = Divider(
          height: (widget._controller.thickness ?? 1).toDouble(),
          thickness: (widget._controller.thickness ?? 1).toDouble(),
          indent: (widget._controller.indent ?? 0).toDouble(),
          endIndent: (widget._controller.endIndent ?? 0).toDouble(),
          color: (widget._controller.color ?? const Color(0xFFD3D3D3))
              .withValues(alpha: widget._controller.opacity ?? 1.0));
      rtn = StudioDebugger().assertHasBoundedWidth(rtn, EnsembleDivider.type);
    }
  }

  if (widget._controller.margin != null) {
    rtn = Padding(padding: widget._controller.margin!, child: rtn);
  }
  return rtn;
}