Code Monkey home page Code Monkey logo

pull_to_refresh_notification's Issues

滚动条 jumpTo到顶部 会触发刷新

headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
          return [
            SliverAppBar(
              // forceElevated: innerBoxIsScrolled,
              title: Text(widget.title),
              actions: widget.actions,
              flexibleSpace: widget.flexibleSpace,
              expandedHeight: widget.expandedHeight,
            ),
            PullToRefreshContainer((info) => PullToRefreshHeader(info: info)),
            SliverTabBar(
              child: TabBar(
                controller: tabController,
                isScrollable: widget.isScrollable,
                onTap: (int index) => tabBarOnTap(context, index),
                tabs: [
                  for (final tab in widget.tabs) Tab(child: Text(tab.name)),
                ],
              ),
              pinned: true,
            ),
          ];
        }
PrimaryScrollController.of(context)!.jumpTo(widget.expandedHeight ?? 0);

希望可以开放部分参数

希望可以开放此参数

// When the scroll ends, the duration of the refresh indicator's animation
// to the RefreshIndicator's displacement.
const Duration _kIndicatorSnapDuration = Duration(milliseconds: 150);

有些需求只是下拉放大图片。

现在回弹需要等待该时长。

很怪

为什么我设置的滑动监听,没有反应?

代码如下,打印一直没有输出。

Scaffold( appBar: new MyAppBar( child: Container( color: Colors.white30, child: Text("Title"), ), ), body: PullToRefreshNotification( onRefresh: _onRefresh, maxDragOffset: 250.0, notificationPredicate: (info) { print("---1----->${info?.metrics?.pixels}"); return true; }, child: CustomScrollView( controller: _scrollControler, slivers: <Widget>[ PullToRefreshContainer((info) { var offset = info?.dragOffset ?? 0.0; return SliverToBoxAdapter( child: Stack( children: <Widget>[ new Container( height: 240 + offset, width: double.infinity, child: Image.asset( "images/img_mine_top_bg.jpg", fit: BoxFit.cover, ), ), ], ), ); }), SliverList( delegate: SliverChildListDelegate(_listItem()), ) ], ), ), );

嵌套nested_scrollview刷新过程中,下啦往上滚动,会触发bug

Version

3.0.1

Platforms

dart, Android, iOS

Device Model

iPhone13

flutter info

[✓] Flutter (Channel stable, 3.10.4, on macOS 12.6.3 21G419 darwin-x64, locale zh-Hans-CN)
    • Flutter version 3.10.4 on channel stable at /Users/ljz/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 682aa387cf (2 weeks ago), 2023-06-05 18:04:56 -0500
    • Engine revision 2a3401c9bb
    • Dart version 3.0.3
    • DevTools version 2.23.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/ljz/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • ANDROID_HOME = /Users/ljz/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • 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 11.0.13+0-b1751.21-8125866)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 69.0.2
    • Dart plugin version 212.5632

[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.1)
    • IntelliJ at /Users/ljz/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • 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

[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.1)
    • IntelliJ at /Users/ljz/Library/Application
      Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/193.5662.53/IntelliJ IDEA.app
    • Flutter plugin version 45.1.2
    • Dart plugin version 193.7547

[✓] VS Code (version 1.79.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.66.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 12.6.3 21G419 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 114.0.5735.133

[✓] Network resources
    • All expected network resources are available.

• No issues found!

How to reproduce?

嵌套nested_scrollview刷新过程中,下啦往上滚动,会触发bug

Logs

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
'package:extended_nested_scroll_view/src/extended_nested_scroll_view.dart': Failed assertion: line
1045 pos 16: 'extra <= 0.0': is not true.

The relevant error-causing widget was:
  ExtendedNestedScrollView
  ExtendedNestedScrollView:file:///Users/ljz/Documents/jiyun/new-app/lib/components/custom_refresh/custom_refresh.dart:86:16

When the exception was thrown, this was the stack:
#2      _NestedScrollCoordinator._getMetrics (package:extended_nested_scroll_view/src/extended_nested_scroll_view.dart:1045:16)
extended_nested_scroll_view.dart:1045
#3      _NestedScrollCoordinator.createOuterBallisticScrollActivity (package:extended_nested_scroll_view/src/extended_nested_scroll_view.dart:963:42)
extended_nested_scroll_view.dart:963
#4      _NestedOuterBallisticScrollActivity.applyNewDimensions (package:extended_nested_scroll_view/src/extended_nested_scroll_view.dart:1787:19)
extended_nested_scroll_view.dart:1787
#5      ScrollPosition.applyNewDimensions (package:flutter/src/widgets/scroll_position.dart:621:15)
scroll_position.dart:621
#6      _NestedScrollPosition.applyNewDimensions (package:extended_nested_scroll_view/src/extended_nested_scroll_view.dart:1701:11)
extended_nested_scroll_view.dart:1701
#7      _ExtendedNestedScrollPosition.applyNewDimensions (package:extended_nested_scroll_view/src/extended_nested_scroll_view_part.dart:272:11)
extended_nested_scroll_view_part.dart:272
#8      ScrollPosition.applyContentDimensions (package:flutter/src/widgets/scroll_position.dart:551:7)
scroll_position.dart:551
#9      _ExtendedNestedScrollPosition.applyContentDimensions (package:extended_nested_scroll_view/src/extended_nested_scroll_view_part.dart:284:18)
extended_nested_scroll_view_part.dart:284
#10     RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1424:20)
viewport.dart:1424
#11     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2234:7)
object.dart:2234
#12     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1016:18)
object.dart:1016
#13     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:492:19)
binding.dart:492
#14     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:905:13)
binding.dart:905
#15     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:358:5)
binding.dart:358
#16     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1284:15)
binding.dart:1284
#17     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1214:9)
binding.dart:1214
#18     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1072:5)
binding.dart:1072
#19     _invoke (dart:ui/hooks.dart:142:13)
hooks.dart:142
#20     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:359:5)
platform_dispatcher.dart:359
#21     _drawFrame (dart:ui/hooks.dart:112:31)
hooks.dart:112
(elided 2 frames from class _AssertionError)

Example code (optional)

No response

Contact

No response

如何设置下啦刷新,松手滚动到设置刷新的位置才出发刷新?

Content

PullToRefreshNotification(
        color: Colors.blue,
        onRefresh: () async {
          return Future.delayed(3000.milliseconds, () {
            return true;
          });
        },
        pullBackOnRefresh: false,
        maxDragOffset: double.infinity,
        refreshOffset: 40,
        // reachToRefreshOffset: 20,
        armedDragUpCancel: true,
        child:  ExtendedNestedScrollView(
			onlyOneScrollInBody: true,
        	controller: controller.scrollController,
			headerSliverBuilder:  (c, f) => [
				PullToRefreshContainer((info) {
                var offset = info?.dragOffset ?? 0.0;
                Widget child = Container(
                  alignment: Alignment.center,
                  height: offset,
                  // color: Colors.red,
                  width: double.infinity,
                  child: const CupertinoActivityIndicator(),
                );

                return SliverToBoxAdapter(
                  child: child,
                );
              }),
			],
			body: ListView.builder((c, i) => Text('$i'))
));

Typo refreshWiget

class PullToRefreshScrollNotificationInfo {
  //...
  final Widget refreshWiget;
}

SDK

The argument type 'Widget Function(PullToRefreshScrollNotificationInfo)' can't be assigned to the parameter type 'Widget

报错'_notificationDragOffset == null': is not true.

有强迫症,能不让它报错吗


════════ Exception caught by gesture ═══════════════════════════════════════════════════════════════
The following assertion was thrown while handling a gesture:
'package:pull_to_refresh_notification/src/pull_to_refresh_notification.dart': Failed assertion: line 287 pos 12: '_notificationDragOffset == null': is not true.

When the exception was thrown, this was the stack: 
#2      PullToRefreshNotificationState._start (package:pull_to_refresh_notification/src/pull_to_refresh_notification.dart:287:12)
#3      PullToRefreshNotificationState._innerhandleScrollNotification (package:pull_to_refresh_notification/src/pull_to_refresh_notification.dart:205:9)
#4      PullToRefreshNotificationState._handleScrollNotification (package:pull_to_refresh_notification/src/pull_to_refresh_notification.dart:189:25)
#5      NotificationListener._dispatch (package:flutter/src/widgets/notification_listener.dart:129:41)
#6      Notification.visitAncestor (package:flutter/src/widgets/notification_listener.dart:47:20)
...
Handler: "onStart"
Recognizer: VerticalDragGestureRecognizer#395e6
  start behavior: start
════════════════════════════════════════════════════════════════════════════════════════════════════

我这样用的

PullToRefreshNotification(
          maxDragOffset: 80.0,
          armedDragUpCancel: false,
          onRefresh: () async {
            return await _purchaseRepository.refresh();
          },
          child: LoadingMoreCustomScrollView(

support flutter 3.10

dependency_overrides:

pull_to_refresh_notification: 
  git: 
    url: https://github.com/mdddj/pull_to_refresh_notification

[3.13.0] 出错了 ,求更新下

Content

pub.dev/pull_to_refresh_notification-3.0.1/lib/src/pull_to_refresh_notification.dart:326:20:
Error: The method 'disallowGlow'
isn't defined for
the class 'OverscrollIndicatorNotification'.

Nested scroll

Hello! I have a vertical CustomScrollView wrapped with PullToRefreshNotification, and inside CustomScrollView there is a widget with horizontal SingleChildScrollView. Which of them PullToRefreshNotification will be listening to? Does it work correctly? Thanks.

[Bug report] auto refresh

Version

3.0.1

Platforms

dart

Device Model

oppo android12

flutter info

[✓] Flutter (Channel stable, 3.7.12, on macOS 13.3.1 22E772610a darwin-x64,
    locale zh-Hans-CN)
    • Flutter version 3.7.12 on channel stable at /Users/gyt_lzm/dev/env/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (7 weeks ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

How to reproduce?

use NestedScrollView . Automatically pull down and refresh every 15 seconds or so.

I don't do anything, it will automatically trigger a pull-down refresh at this frequency.

why?I sincerely need help, thank you!

Logs

No response

Example code (optional)

Scaffold(
        body: PullToRefreshNotification(
            key: refreshWidgetKey,//Setting or not setting this property has the same effect
            child: _buildNestedWidget(),
            onRefresh: _getAllData)
    )


 _buildNestedWidget() {
    return NestedScrollView(
      headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
        return <Widget>[
          PullToRefreshContainer(buildPulltoRefreshHeader),
          SliverAppBar(
            pinned: true,
            floating: true,
            centerTitle: false,
            ),..]});

Contact

[email protected]

Delay pull back

Hey,
Currently the refresher pulls back immediately after returning true in the onRefresh function.
It would be nice to have a little delay to the pull back, so the user would be able to see the text longer after the refresh is done.
Maybe add a delayPullBack property that accepts a duration.
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.