-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose InViewNotifier to support customized widget #47 #49
base: master
Are you sure you want to change the base?
Expose InViewNotifier to support customized widget #47 #49
Conversation
Hello @dreamer2q I've used your fork of this package and it works as expected, but I still face an issue when scrolling up so fast. The error is about the
I think there's already a fix to this issue in this pull request ##45 (comment) I don't know if it was merged with the latest update or not. When I used it (before the update) it fixed the issue, but now when using your pull I faced the error again. Thank you for your effort it's much appreciated and looking forward to hearing from you. Best regards. |
The problem really doesn't require much code all you have to do is scroll up the listView fast. ScrollController? scrollController;
@override
void initState() {
super.initState();
scrollController = ScrollController();
}
void listScrollUp(){
scrollController.animateTo(
0.0,
duration: const Duration(milliseconds: 300),
curve: Curves.ease,
);
} And call the a listview would be something like @override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
floatingActionButton: FloatingActionButton(
onPressed: (){
listScrollUp();
},
),
body: InViewNotifier(
initialInViewIds: const ['0'],
isInViewPortCondition: _checkTimelineItemIsInViewport,
child: ListView.builder(
controller: scrollController,
itemCount: 500,
itemBuilder: (c, i) => Container(
height: 250,
color: i % 2 == 0 ? Colors.red : Colors.green,
),
),
)
);
}
bool _checkTimelineItemIsInViewport(
double deltaTop,
double deltaBottom,
double viewPortDimension,
) {
return deltaTop < (0.5 * viewPortDimension) &&
deltaBottom > (0.5 * viewPortDimension);
} Thank you for your response. |
@inc16sec Actually, I cannot reproduce such error using your code. Besides, your code seems missing |
My bad I forgot |
Seeing #47 that
refresh
andloading
is a common use-case, I made this pr in hope to help solve this issue.ScrollView
toWidget
to support customized widgetRefreshList
withSmartRefresh
example to demorefreshing
andloading