Skip to content

ScrollPosition.isScrollingNotifier returns false when using scroll-wheel and two-finger gesture in trackpad #75591

@jamesblasco

Description

@jamesblasco

I have only tried this on a mac device, as a mac app and a web app. When using the trackpad to scroll a view, the ScrollPosition.isScrollingNotifier
returns false.
If I scroll by clicking and dragging it, the notifier returns true.

At least on macos, the default way of scrolling into views is using the two-finger gesture. If you click and drag inside a native app, this one does not scroll, but a Flutter app does.

Steps to Reproduce

import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(home: MyListView()));
}
class MyListView extends StatefulWidget {
  @override
  _MyListViewState createState() => _MyListViewState();
}

class _MyListViewState extends State<MyListView> {
  final ScrollController controller = ScrollController();

  @override
  void initState() {
    controller.addListener(() {
      // always prints "scrolling = true"
      print('scrolling = ${controller.position.isScrollingNotifier.value}');
    });
    super.initState();
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(body: ListView.builder(
      controller: controller,
      itemCount: 20,
      itemBuilder: (BuildContext context, int index) {
        return ListTile( 
          title: Text('$index'),
        );
      },
    ),
    );
  }
}
Flutter (Channel dev, 1.26.0-12.0.pre, on macOS 11.1 20C69 darwin-x64, locale en-ES)

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.found in release: 1.26Found to occur in 1.26frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyplatform-macBuilding on or for macOS specificallyr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions