buildViewportChrome method Null safety

  1. @Deprecated('Migrate to buildOverscrollIndicator. ' 'This feature was deprecated after v2.1.0-11.0.pre.')
Widget buildViewportChrome(
  1. BuildContext context,
  2. Widget child,
  3. AxisDirection axisDirection
)
Deprecated('Migrate to buildOverscrollIndicator. ' 'This feature was deprecated after v2.1.0-11.0.pre.')">@Deprecated('Migrate to buildOverscrollIndicator. ' 'This feature was deprecated after v2.1.0-11.0.pre.')

Wraps the given widget, which scrolls in the given AxisDirection.

For example, on Android, this method wraps the given widget with a GlowingOverscrollIndicator to provide visual feedback when the user overscrolls.

This method is deprecated. Use ScrollBehavior.buildOverscrollIndicator instead.

Implementation

@Deprecated(
  'Migrate to buildOverscrollIndicator. '
  'This feature was deprecated after v2.1.0-11.0.pre.',
)
Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) {
  switch (getPlatform(context)) {
    case TargetPlatform.iOS:
    case TargetPlatform.linux:
    case TargetPlatform.macOS:
    case TargetPlatform.windows:
      return child;
    case TargetPlatform.android:
      switch (androidOverscrollIndicator) {
        case AndroidOverscrollIndicator.stretch:
          return StretchingOverscrollIndicator(
            axisDirection: axisDirection,
            child: child,
          );
        case AndroidOverscrollIndicator.glow:
          continue glow;
      }
    glow:
    case TargetPlatform.fuchsia:
    return GlowingOverscrollIndicator(
      axisDirection: axisDirection,
      color: _kDefaultGlowColor,
      child: child,
    );
  }
}