buildOverscrollIndicator method Null safety

  1. @override
Widget buildOverscrollIndicator(
  1. BuildContext context,
  2. Widget child,
  3. ScrollableDetails details
)
override

Applies a GlowingOverscrollIndicator to the child widget on TargetPlatform.android and TargetPlatform.fuchsia.

Implementation

@override
Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) {
  // When modifying this function, consider modifying the implementation in
  // the base class as well.
  late final AndroidOverscrollIndicator indicator;
  if (Theme.of(context).useMaterial3) {
    indicator = AndroidOverscrollIndicator.stretch;
  } else {
    indicator = _androidOverscrollIndicator
      ?? Theme.of(context).androidOverscrollIndicator
      ?? androidOverscrollIndicator;
  }
  switch (getPlatform(context)) {
    case TargetPlatform.iOS:
    case TargetPlatform.linux:
    case TargetPlatform.macOS:
    case TargetPlatform.windows:
      return child;
    case TargetPlatform.android:
      switch (indicator) {
        case AndroidOverscrollIndicator.stretch:
          return StretchingOverscrollIndicator(
            axisDirection: details.direction,
            clipBehavior: details.clipBehavior ?? Clip.hardEdge,
            child: child,
          );
        case AndroidOverscrollIndicator.glow:
          continue glow;
      }
    glow:
    case TargetPlatform.fuchsia:
      return GlowingOverscrollIndicator(
        axisDirection: details.direction,
        color: Theme.of(context).colorScheme.secondary,
        child: child,
      );
  }
}