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) {
  // Use a shared controller so the scrollbar and scroll view stay in sync.
  final ctrl = controller ?? WidgetScrollController();

  Widget inner = SingleChildScrollView(
    controller: ctrl,
    padding: padding,
    child: child,
  );

  if (showScrollbar) {
    inner = Scrollbar(controller: ctrl, child: inner);
  }

  if (width != null || height != null) {
    inner = Container(width: width, height: height, child: inner);
  }

  return inner;
}