build method

  1. @override
Widget build(
  1. BuildContext context,
  2. Axis axis,
  3. int index,
  4. bool resizable,
  5. bool dragging,
  6. bool highlighted,
  7. MultiSplitViewThemeData themeData,
)
override

Builds the section for the draggable divider.

This conforms to the divider builder signature of the MultiSplitView though the default implementation does not actually make use of the axis, index, resizable, nor the themeData attributes. Only the dragging and highlighted values are used for building the cell and indicator.

Implementation

@override
Widget build(
  BuildContext context,
  Axis axis,
  int index,
  bool resizable,
  bool dragging,
  bool highlighted,
  MultiSplitViewThemeData themeData,
) {
  final theme = Theme.of(context);
  final textColor =
      theme.textTheme.bodyMedium?.color ??
      (theme.brightness == Brightness.light ? Colors.black : Colors.white);

  final color = this.color ?? Colors.transparent;
  final draggingColor =
      this.draggingColor ?? textColor.withValues(alpha: 0.24);
  final draggingIndicatorColor = this.draggingIndicatorColor ?? textColor;
  final hoverColor = this.hoverColor ?? textColor.withValues(alpha: 0.12);
  final hoverIndicatorColor =
      this.hoverIndicatorColor ?? textColor.withValues(alpha: 0.87);
  final indicatorColor =
      this.indicatorColor ?? textColor.withValues(alpha: 0.54);

  return ColoredBox(
    color: dragging
        ? draggingColor
        : highlighted
        ? hoverColor
        : color,
    child: Center(
      child: AnimatedPadding(
        duration: const Duration(milliseconds: 300),
        padding: dragging
            ? draggingPadding
            : highlighted
            ? hoverPadding
            : padding,
        child: SizedBox(
          width: 2.0,
          height: double.infinity,
          child: ColoredBox(
            color: dragging
                ? draggingIndicatorColor
                : highlighted
                ? hoverIndicatorColor
                : indicatorColor,
          ),
        ),
      ),
    ),
  );
}