fluttercandies / pull_to_refresh_notification Goto Github PK
View Code? Open in Web Editor NEWFlutter plugin for building pull to refresh effects with PullToRefreshNotification and PullToRefreshContainer quickly.
License: MIT License
Flutter plugin for building pull to refresh effects with PullToRefreshNotification and PullToRefreshContainer quickly.
License: MIT License
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);
有些需求只是下拉放大图片。
现在回弹需要等待该时长。
很怪
Hey,
Thanks for the awesome package.
It would be great if you could add the option to show an error without waiting for user input.
Only show error and dismiss after a certain duration delay.
Thanks
代码如下,打印一直没有输出。
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()), ) ], ), ), );
3.0.1
dart, Android, iOS
iPhone13
[✓] 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!
嵌套nested_scrollview刷新过程中,下啦往上滚动,会触发bug
══╡ 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)
No response
No response
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'))
));
class PullToRefreshScrollNotificationInfo {
//...
final Widget refreshWiget;
}
pull_to_refresh_header使用这个会出现上面的问题,不知什么意思,希望可以解答一下谢谢了
The argument type 'Widget Function(PullToRefreshScrollNotificationInfo)' can't be assigned to the parameter type 'Widget
有强迫症,能不让它报错吗
════════ 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(
dependency_overrides:
pull_to_refresh_notification:
git:
url: https://github.com/mdddj/pull_to_refresh_notification
如题
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'.
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.
3.0.1
dart
oppo android12
[✓] 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
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!
No response
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,
),..]});
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.
'package:flutter/src/material/progress_indicator.dart': Failed assertion: line 561 pos 12: 'size.width == size.height': is not true.
假设触发offset是80,我下拉到90,然后手指不松开再往上划到60再松手(实际上现在下拉后无法再往上划,不跟随手势),期望这个时候不刷新,根据手指松开的地方来判断是否刷新。
老哥, 请教一下, 为什么我FlexibleSpaceBar内的Background图片只能是BoxFit.fill效果, 下拉SliverList的时候, 图片会向下拉伸, 做不到像你那样的扩充效果呢
当我正在下拉过程中,nestedScrollview的header中有一个自动滚动的banner,如果这时候banner发生了滚动,正在下拉的动作会被取消
Please support null-safety.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.