Repository: flutter/flutter
File: packages/flutter/lib/src/widgets/overscroll_indicator.dart (Dart)

Code before:
        builder: (BuildContext context, Widget? child) {
          final double stretch = _stretchController.overscroll;
          final double mainAxisSize;

          switch (widget.axis) {
            case Axis.horizontal:
              mainAxisSize = MediaQuery.widthOf(context);
            case Axis.vertical:
              mainAxisSize = MediaQuery.heightOf(context);
          }

          final double viewportDimension =
              _lastOverscrollNotification?.metrics.viewportDimension ?? mainAxisSize;

          double overscroll = -stretch;

          // Adjust overscroll for reverse scroll directions.
          if (widget.axisDirection == AxisDirection.up ||
              widget.axisDirection == AxisDirection.left) {
            overscroll = -overscroll;
          }

          final Widget transform = StretchEffect(
            stretchStrength: overscroll,
            axis: widget.axis,
            child: widget.child != null ? widget.child! : const SizedBox.shrink(),
          );

          // Only clip if the viewport dimension is smaller than that of the
          // screen size in the main axis. If the viewport takes up the whole
          // screen, overflow from transforming the viewport is irrelevant.
          return ClipRect(
            clipBehavior: stretch != 0.0 && viewportDimension != mainAxisSize
                ? widget.clipBehavior
                : Clip.none,
            child: transform,
          );
        },
      ),
    );
  }
}

class _StretchController extends Listenable {
  _StretchController({required this.vsync});

  final TickerProvider vsync;
  AnimationController? _controller;

  /// Manages and notifies changes to the current [overscroll] value.
  final ValueNotifier<double> _overscrollNotifier = ValueNotifier<double>(0.0);

Review comment (suggestion):
```suggestion
            child: widget.child ?? const SizedBox.shrink(),
```

Code after:
        builder: (BuildContext context, Widget? child) {
          final double stretch = _stretchController.overscroll;
          final double mainAxisSize;

          switch (widget.axis) {
            case Axis.horizontal:
              mainAxisSize = MediaQuery.widthOf(context);
            case Axis.vertical:
              mainAxisSize = MediaQuery.heightOf(context);
          }

          final double viewportDimension =
              _lastOverscrollNotification?.metrics.viewportDimension ?? mainAxisSize;

          double overscroll = -stretch;

          // Adjust overscroll for reverse scroll directions.
          if (widget.axisDirection == AxisDirection.up ||
              widget.axisDirection == AxisDirection.left) {
            overscroll = -overscroll;
          }

          final Widget transform = StretchEffect(
            stretchStrength: overscroll,
            axis: widget.axis,
            child: widget.child ?? const SizedBox.shrink(),
          );

          // Only clip if the viewport dimension is smaller than that of the
          // screen size in the main axis. If the viewport takes up the whole
          // screen, overflow from transforming the viewport is irrelevant.
          return ClipRect(
            clipBehavior: stretch != 0.0 && viewportDimension != mainAxisSize
                ? widget.clipBehavior
                : Clip.none,
            child: transform,
          );
        },
      ),
    );
  }
}

class _StretchController extends Listenable {
  _StretchController({required this.vsync});

  final TickerProvider vsync;
  AnimationController? _controller;

  /// Manages and notifies changes to the current [overscroll] value.
  final ValueNotifier<double> _overscrollNotifier = ValueNotifier<double>(0.0);