Open FrankyLee-dev opened 6 months ago
Thank you for the report. I'm able to reproduce the issue as well.
I would like to work on this issue.
@ujjwaltwitx Thank you for your willingness to research this topic. Please inform me here if there are any developments. Thank you.
I am trying few tweaks right now. Will keep updating you on the developments
I checked the refresh_indicator.dart file and found out there was this _checkDragOffset function
void _checkDragOffset(double containerExtent) {
containerExtent = MediaQuery.of(context).size.height;
// print(containerExtent);
assert(_mode == _RefreshIndicatorMode.drag || _mode == _RefreshIndicatorMode.armed);
double newValue = _dragOffset! / (containerExtent * _kDragContainerExtentPercentage);
if (_mode == _RefreshIndicatorMode.armed) {
newValue = math.max(newValue, 1.0 / _kDragSizeFactorLimit);
}
_positionController.value = clampDouble(newValue, 0.0, 1.0); // this triggers various rebuilds
_positionController.value = newValue;
if (_mode == _RefreshIndicatorMode.drag && _valueColor.value!.alpha == _effectiveValueColor.alpha) {
_mode = _RefreshIndicatorMode.armed;
}
}
The containerExtent parameter is the primary reason of the issue. When the height of headerSliver is significantly large, the value of containerExtent is significantly low which causes the issue. I assigned screen height to the containerExtent and the refreshIndicator started working normally.
I am not sure whether this is a good solution to the problem or not so I would like to hear your valuable suggestions and feedbacks.
I checked the refresh_indicator.dart file and found out there was this _checkDragOffset function
void _checkDragOffset(double containerExtent) { containerExtent = MediaQuery.of(context).size.height; // print(containerExtent); assert(_mode == _RefreshIndicatorMode.drag || _mode == _RefreshIndicatorMode.armed); double newValue = _dragOffset! / (containerExtent * _kDragContainerExtentPercentage); if (_mode == _RefreshIndicatorMode.armed) { newValue = math.max(newValue, 1.0 / _kDragSizeFactorLimit); } _positionController.value = clampDouble(newValue, 0.0, 1.0); // this triggers various rebuilds _positionController.value = newValue; if (_mode == _RefreshIndicatorMode.drag && _valueColor.value!.alpha == _effectiveValueColor.alpha) { _mode = _RefreshIndicatorMode.armed; } }
The containerExtent parameter is the primary reason of the issue. When the height of headerSliver is significantly large, the value of containerExtent is significantly low which causes the issue. I assigned screen height to the containerExtent and the refreshIndicator started working normally.
I am not sure whether this is a good solution to the problem or not so I would like to hear your valuable suggestions and feedbacks.
This is not the final code. If community approves this as a good fix then I will do the required refactoring in the code.
Hello, thank you for your question. If I understand correctly, you're asking about setting the screen height and you're unsure about the height of the headerSliver. In an extreme case where the headerSliver exceeds the screen height by a large margin, would the issue still occur?
No there will be no issue as the drag height is determined by the height of the screen and not by the height of the headerSliver.
I have tested it, and so far I haven't encountered any issues.I will continue to monitor it to see if any other issues arise.Thank you for your research.
Thanks. Should I raise a pull request?
Yes, please raise a PR. need to close the issue?
Okay
I have raised the pr
Steps to reproduce
1.After placing RefreshIndicator inside NestedScrollView, 2.When there's a lot of content in NestedScrollView's headerSliverBuilder, 3.The dragging effect for pulling down to refresh disappears, and a slight drag immediately triggers the refresh action.
Expected results
The consistent dragging effect when content is less in headerSliverBuilder
Actual results
After nesting RefreshIndicator within NestedScrollView, when the content of NestedScrollView's headerSliverBuilder is extensive, the dragging effect of pulling down for refresh seems to disappear. A slight drag immediately triggers the refresh action.
Code sample
Code sample
```dart class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); final String title; @override StateScreenshots or Video
https://github.com/flutter/flutter/assets/17977044/44ff84d3-b465-4871-b94e-d7e96735fafb
Logs
Logs
```console ```Flutter Doctor output
Doctor output
```console [✓] Flutter (Channel stable, 3.19.5, on macOS 14.4.1 23E224 darwin-x64, locale zh-Hans-CN) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [!] Xcode - develop for iOS and macOS (Xcode 14.2) ! CocoaPods 1.10.2 out of date (1.13.0 is recommended). CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To upgrade see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods for instructions. [✓] Chrome - develop for the web [✓] Android Studio (version 2021.2) [✓] VS Code (version 1.87.2) [✓] Connected device (3 available) ```