Skip to content

RefreshIndicator should appear from the top of the dragged widget where the [GlowingOverscrollIndicator] appears position. #71819

Description

@xu-baolin

Steps to Reproduce

  1. Run the sample code.
  2. Pull out the RefreshIndicator by dragging it down slowly.
  3. Observe where the indicator animation begins to appear.

The animated [RefreshIndicator] should appear from the top of the dragged widget
where the [GlowingOverscrollIndicator] (if have) appears position.

Expected behavior

20201207_114217

Actual behavior

20201207_114118

Sample Code

import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(home: BugReport(),));
}

class BugReport extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    double leadingPaintOffset = MediaQuery.of(context).padding.top + AppBar().preferredSize.height;
    return RefreshIndicator(
      onRefresh: () {
        return Future.delayed(const Duration(seconds: 3), () => print('onRefresh finished.'));
      },
      child: NotificationListener<OverscrollIndicatorNotification>(
        onNotification: (notification) {
          if (notification.leading) {
            notification.paintOffset = leadingPaintOffset;
          }
          return false;
        },
        child: CustomScrollView(
          slivers: [
            SliverAppBar(title: Text('Custom PaintOffset')),
            SliverToBoxAdapter(
              child: Container(
                color: Colors.amberAccent,
                height: 100,
                child: Center(child: Text('I love Flutter!', style: TextStyle(fontSize: 18.0),)),
              ),
            ),
            SliverFillRemaining(child: FlutterLogo()),
          ],
        ),
      ),
    );
  }
}

Activity

  1. changed the title [-]RefreshIndicator should appear from the top of the dragged widget where the [GlowingOverscrollIndicator] appear position.[/-] [+]RefreshIndicator should appear from the top of the dragged widget where the [GlowingOverscrollIndicator] appears position.[/+] on Dec 7, 2020
  2. pedromassangocode commented on Dec 7, 2020

    @pedromassangocode
    flutter doctor -v
    [✓] Flutter (Channel master, 1.25.0-5.0.pre.91, on Mac OS X 10.15.7 19H2 darwin-x64, locale en)
        • Flutter version 1.25.0-5.0.pre.91 at /Users/pedromassango/dev/SDKs/flutter_master
        • Framework revision 7dade22f25 (16 hours ago), 2020-12-06 21:34:04 +0530
        • Engine revision 6491c7518f
        • Dart version 2.12.0 (build 2.12.0-120.0.dev)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
        • Android SDK at /Users/pedromassango/Library/Android/sdk
        • Platform android-30, build-tools 30.0.2
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 12.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 12.1, Build version 12A7403
        • CocoaPods version 1.9.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.1)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    
    [✓] IntelliJ IDEA Community Edition (version 2020.2.4)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin version 52.0.4
        • Dart plugin version 202.8070
    
    [✓] VS Code (version 1.51.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.16.0
    
    [✓] Connected device (3 available)
        • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
        • macOS (desktop)             • macos         • darwin-x64     • Mac OS X 10.15.7 19H2 darwin-x64
        • Chrome (web)                • chrome        • web-javascript • Google Chrome 86.0.4240.198
    
    • No issues found!
    Process finished with exit code 0
    
  3. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    f: scrollingViewports, list views, slivers, etc.
    p: material_uimaterial_ui package in flutter/packages
    on Dec 7, 2020
  4. radomir9720 commented on Dec 25, 2020

    @radomir9720

    Workaround:

    import 'package:flutter/material.dart';
    
    void main() {
      runApp(MaterialApp(home: BugReport(),));
    }
    
    class BugReport extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return NestedScrollView(
          headerSliverBuilder: (context, innerBoxIsScrolled) => [
            SliverAppBar(title: Text('Custom PaintOffset')),
          ],
          body: RefreshIndicator(
            onRefresh: () {
              return Future.delayed(
                  const Duration(seconds: 3), () => print('onRefresh finished.'));
            },
            child: CustomScrollView(
              slivers: [
                SliverToBoxAdapter(
                  child: Container(
                    color: Colors.amberAccent,
                    height: 100,
                    child: Center(
                        child: Text(
                      'I love Flutter!',
                      style: TextStyle(fontSize: 18.0),
                    )),
                  ),
                ),
                SliverFillRemaining(child: FlutterLogo()),
              ],
            ),
          ),
        );
      }
    }
    
    2020-12-25.21.02.56.mov
  5. self-assigned this
    on Jan 4, 2021
  6. self-assigned this
    on Apr 18, 2022
  7. Piinks commented on Jun 10, 2022

    @Piinks
    Contributor

    This looks like it may be the same issue as #54272
    There is currently a proposal to resolve it with #105769

  8. added
    P1High-priority issues at the top of the work list
    on Jun 13, 2022
  9. Piinks commented on Jul 8, 2022

    @Piinks
    Contributor

    Closing this to consolidate in #107322
    In researching a solution, I found a pattern of the same issue across multiple widgets in the framework. There is a full list in that tracking issue, including refresh indicator.

    I have a proposed solution in #107182 that will fix this consistently across all affected parts of the framework. That PR will be split up into multiple PRs to address each widget that needs this fix, just finishing the many test cases now. Please continue to follow in #107322, I expect all of thees changes to be landing soon.

  10. github-actions commented on Jul 22, 2022

    @github-actions

    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.

  11. locked as resolved and limited conversation to collaborators on Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P1High-priority issues at the top of the work listf: scrollingViewports, list views, slivers, etc.found in release: 1.25Found to occur in 1.25frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packages

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions