Skip to content

[flutter 3]Using a RefreshIndicator with ListView with reverse: true, doesn't show refresh indicator at the bottom #104151

@ilml1

Description

@ilml1

Since updating to flutter 3 my refresh indicator is not loading from bottom as before when ListView is set to reverse.
Tried on channel stable, and master. same behaviour. It was working as expected before

Steps to Reproduce

This can also be reproduced just going to the refreshIndicator page on flutter.dev and setting the ListView as reverse true
The code sample submitted also comes from here
https://api.flutter.dev/flutter/material/RefreshIndicator-class.html

  1. Execute flutter run on the code sample
  2. Try to overscroll the bottom, which is the beginning of the list. nothing will happen
  3. If you overscroll the top, the refreshIndicator gets triggered when it should be from the bottom

Expected results:
RefreshIndicator gets triggered from bottom

Actual results:
RefreshIndicator gets triggered on Top edge overscroll

This example was taken from the normal example on the RefreshIndicator page on flutter.dev
https://api.flutter.dev/flutter/material/RefreshIndicator-class.html

Code sample
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  static const String _title = 'RefreshIndicator Sample';

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: _title,
      home: RefreshIndicatorExample(title: _title),
    );
  }
}

class RefreshIndicatorExample extends StatefulWidget {
  const RefreshIndicatorExample({Key? key, required this.title})
      : super(key: key);

  final String title;

  @override
  State<RefreshIndicatorExample> createState() =>
      _RefreshIndicatorExampleState();
}

class _RefreshIndicatorExampleState extends State<RefreshIndicatorExample> {
  final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey =
      GlobalKey<RefreshIndicatorState>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: RefreshIndicator(
        key: _refreshIndicatorKey,
        color: Colors.white,
        backgroundColor: Colors.blue,
        strokeWidth: 4.0,
        onRefresh: () async {
          return Future<void>.delayed(const Duration(seconds: 3));
        },
        // Pull from bottom to show refresh indicator.
        child: ListView.builder(
          itemCount: 25,
          reverse: true, //Relevant
          itemBuilder: (BuildContext context, int index) {
            return ListTile(
              title: Text('Item $index'),
            );
          },
        ),
      ),
      floatingActionButton: FloatingActionButton.extended(
        onPressed: () {
          // Show refresh indicator programmatically on button tap.
          _refreshIndicatorKey.currentState?.show();
        },
        icon: const Icon(Icons.refresh),
        label: const Text('Show Indicator'),
      ),
    );
  }
}


Logs
[✓] Flutter (Channel stable, 3.0.0, on Ubuntu 20.04.4 LTS 5.13.0-41-generic, locale en_CA.UTF-8)
    • Flutter version 3.0.0 at /home/-/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ee4e09cce0 (9 days ago), 2022-05-09 16:45:18 -0700
    • Engine revision d1b9a6938a
    • Dart version 2.17.0
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /home/-/Android/Sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • ANDROID_SDK_ROOT = /home/-/-/Android/sdk
    • Java binary at: /snap/android-studio/119/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[✓] Android Studio (version 2021.1)
    • Android Studio at /snap/android-studio/119/android-studio
    • Flutter plugin version 66.0.1
    • Dart plugin version 211.7811
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.66.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.40.0

[✓] VS Code
    • VS Code at /snap/code/current
    • Flutter extension version 3.40.0

[✓] Connected device (3 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 12 (API 31) (emulator)
    • Linux (desktop)              • linux         • linux-x64      • Ubuntu 20.04.4 LTS 5.13.0-41-generic
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 100.0.4896.88

[✓] HTTP Host Availability
    • All required HTTP hosts are available

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: material designflutter/packages/flutter/material repository.f: scrollingViewports, list views, slivers, etc.found in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions