Open Nurik7 opened 10 months ago
+1 for this. This is a small, but quite noticeable behaviour that native iOS has.
Did anyone find a solution for this?
Did anyone find a solution for this?
Not a solution, but a workaround.
Create a ScrollController
and allow scrolling beyond 0
only when there's a certain number of elements, i.e.
final ScrollController _scrollController = ScrollController();
/// These are arbitrary values
/// Edit this method according to your needs
void _fixOverscroll() {
if (_scrollController.hasClients) {
if (_itemCount <= 1) {
if (_scrollController.offset > 0) {
_scrollController.jumpTo(0);
}
} else if (_itemCount <= 2) {
if (_scrollController.offset > 60) {
_scrollController.jumpTo(60);
}
} else if (_itemCount <= 3) {
if (_scrollController.offset > 180) {
_scrollController.jumpTo(180);
}
}
}
}
@override
void initState() {
super.initState();
_scrollController.addListener(_fixOverscroll);
}
@override
void dispose() {
_scrollController.removeListener(_fixOverscroll);
_scrollController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
// stuff
}
+1 This, plus the refresh indicator, are the two things that need to be implemented.
I've made small explanation of what I have and what I'm expecting
https://github.com/kspo/super_cupertino_navigation_bar/assets/20270296/2e949c35-95c9-4b00-855d-bd5bc4d26eb7
here's the code of actual Example Widget: