Skip to content

NestedScrollView with UserScrollNotification direction value is not right #107101

@pba-cra

Description

@pba-cra

Steps to Reproduce

listener UserScrollNotification,and print direction.

when i fling,i get

log is:
I/flutter ( 5729): update scroll direction ScrollDirection.idle
I/flutter ( 5729): update scroll direction ScrollDirection.reverse
I/flutter ( 5729): update scroll direction ScrollDirection.idle

in this case ,when i begin drage,i get first update state is idle

or

I/flutter ( 5729): update scroll direction ScrollDirection.forward

in this case, when i drage end,i not get idle

Expected results:

when i begin drage,i can get update state is reverse or forward
when NestedScrollView scroll end,i can get update state is idle

Actual results:

I/flutter ( 5729): update scroll direction ScrollDirection.idle
I/flutter ( 5729): update scroll direction ScrollDirection.reverse
I/flutter ( 5729): update scroll direction ScrollDirection.idle

or

I/flutter ( 5729): update scroll direction ScrollDirection.forward

Code sample
NotificationListener<UserScrollNotification>(
        onNotification: (notification) {
          print(' update scroll direction ScrollDirection.${notification.direction.toString()}');
          return true;
        },
        child: NestedScrollView(
                headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
                  return <Widget>[
                    SliverAppBar(
                      title: const Text('ListView'),
                      pinned: true, 
                      forceElevated: innerBoxIsScrolled,
                    ),
                  ];
                },
                body: ListView.builder(
                  padding: const EdgeInsets.all(8),
                  physics: const ClampingScrollPhysics(), 
                  itemCount: 30,
                  itemBuilder: (BuildContext context, int index) {
                    return SizedBox(
                      height: 50,
                      child: Center(child: Text('Item $index')),
                    );
                  },
                ),
              ),
            )
        ),
Logs

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.found in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions