0

On iOS, tapping the status bar makes PrimaryScrollController go to the top: https://flutter.dev/docs/resources/platform-adaptations#return-to-top

On iOS, tapping the OS status bar scrolls the primary scroll controller to the top position. There is no equivalent behavior on Android.

My PrimaryScrollController is attached to a ListView with reverse:true, so tapping the status bar makes it scroll to the bottom.

Docs say PrimaryScrollView handles ScrollAction if not handled by another scroll controller. https://api.flutter.dev/flutter/widgets/PrimaryScrollController-class.html

If a ScrollAction is not handled by an otherwise focused part of the application, the ScrollAction will be evaluated using the scroll view associated with a PrimaryScrollController

How can I handle scroll actions myself so I can reverse the direction PrimaryScrollController goes when the status bar is tapped?

Braden Bagby
  • 273
  • 1
  • 8

1 Answers1

0

The easiest way to accomplish this is likely going to be reversing the items in your list instead of using the reverse: true flag of ListView.

For example:

ListView(
  children: [
    Container(),
    Container(),
  ].reversed.toList(),
),

Trying to solve this any other way would get pretty involved. Since we don't have access to the StatusBar we can't override its behavior or listen for taps on it.

Alex Hartford
  • 5,110
  • 2
  • 19
  • 36
  • That wont work for me. I need lazy loading at the top of the ListView and keeping it regular makes lazy loading happen at the bottom :( – Braden Bagby Apr 23 '21 at 14:12
  • @BradenBagby I probably won't be able to look at this more until Monday but I'll get back to you on this. I'm not as privy on the iOS side of things so if anyone else wants to chime in that'd be awesome. – Alex Hartford Apr 23 '21 at 21:15