flutter icon indicating copy to clipboard operation
flutter copied to clipboard

iOS style loading in RefreshIndicator widget

Open OutdatedGuy opened this issue 2 years ago • 1 comments
trafficstars

Use case

Normally people use the RefreshIndicator widget in their apps when building for both android and ios. Currently, it only shows the material style CircularProgressIndicator. It would be nice to have one with the iOS/Cupertino style loading too in the RefreshIndicator widget.

Proposal

To have a constructor called adaptive to show the loading style based on the platform.

Like:

  const RefreshIndicator.adaptive({
    super.key,
    required this.child,
    this.displacement = 40.0,
    this.edgeOffset = 0.0,
    required this.onRefresh,
    this.backgroundColor,
    this.notificationPredicate = defaultScrollNotificationPredicate,
    this.semanticsLabel,
    this.semanticsValue,
    this.strokeWidth = RefreshProgressIndicator.defaultStrokeWidth,
    this.triggerMode = RefreshIndicatorTriggerMode.onEdge,
  } : _indicatorType = _ActivityIndicatorType.adaptive;

And this constructor will now use the CircularProgressIndicator.adaptive widget to show the loading.

Reference: https://github.com/flutter/flutter/blob/4dbb573ff0635f711341307d1bc49a052af3b41b/packages/flutter/lib/src/material/refresh_indicator.dart#L118-#L142

OutdatedGuy avatar Jan 27 '23 19:01 OutdatedGuy

We have CupertinoSliverRefreshControl already. But you're right that there's no adaptive switching.

moffatman avatar Jan 27 '23 19:01 moffatman

Updating the title corresponding to the proposal for a new adaptive constructor (not specific on iOS)

huycozy avatar Jan 30 '23 05:01 huycozy

Awesome ❤️, thanks for the feature @MitchellGoodwin

OutdatedGuy avatar Mar 01 '23 02:03 OutdatedGuy

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

github-actions[bot] avatar Mar 15 '23 08:03 github-actions[bot]