Skip to content
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

My application is unable to perform scrolling operations using ListView on Linux tablets #147277

Closed
buhuixxx opened this issue Apr 24, 2024 · 4 comments · May be fixed by flutter/engine#52418
Closed
Labels
in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Comments

@buhuixxx
Copy link

buhuixxx commented Apr 24, 2024

Steps to reproduce

My application is unable to perform gesture-based scrolling using ListView on Linux tablets, but it can be scrolled using a mouse. Additionally, all these operations work fine on Windows tablets. I am using Flutter SDK version 3.7.1

I upgraded to the latest 3.19.6 and experienced the same problem

Expected results

listview supports gesture sliding on Linux tablets

Actual results

The listview does not support gesture swiping on Linux tablets

Code sample

class _MyHomePageState extends State<MyHomePage> {

  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: ListView(
        children:this._getdata(),
    )


      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }

  List<Widget> _getdata(){
    List<Widget> list=[];
    for(var i=0;i<20;i++){
      list.add(ListTile(
        title: Text("item $i"),
      ));
    }
    return list.toList();
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

[!] Flutter (Channel unknown, 3.7.1, on UnionTech OS Desktop 20 E 4.19.0-amd64-desktop, locale zh_CN.UTF-8)
    ! Flutter version 3.7.1 on channel unknown at /home/uos/Seewo/flutter_sdk/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at
      https://flutter.dev/docs/get-started/install.
    ! Unknown upstream repository.
      Reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    • Framework revision 7048ed95a5 (1 年 3 个月前), 2023-02-01 09:07:31 -0800
    • Engine revision 800594f1f4
    • Dart version 2.19.1
    • DevTools version 2.20.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to
      perform update checks and upgrades.

[✗] Android toolchain - develop for Android devices
    • Android SDK at /usr/lib/android-sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Linux toolchain - develop for Linux desktop
    • clang version 7.0.1-8 (tags/RELEASE_701/final)
    • cmake version 3.27.0
    • ninja version 1.8.2
    • pkg-config version 0.29

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • UnionTech OS Desktop 20 E 4.19.0-amd64-desktop

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 4 categories
@huycozy huycozy added the in triage Presently being triaged by the triage team label Apr 24, 2024
@huycozy
Copy link
Member

huycozy commented Apr 24, 2024

Hi @buhuixxx, could you try adding a custom ScrollBehavior like this to see if it works?

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 24, 2024
@buhuixxx
Copy link
Author

okey,I could do it or some other way, but I think the ListView is the most basic component and should be compatible with linux platforms

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 26, 2024
@huycozy
Copy link
Member

huycozy commented Apr 26, 2024

I could do it or some other way

Do you mean the custom ScrollBehavior works? Could you share what the "other way" is? (Unfortunately, I don't have such a Linux tablet so I can't check this)

By default, a scrollable view should accept drag gestures from a PointerDeviceKind.touch device type:

/// Device types that scrollables should accept drag gestures from by default.
const Set<PointerDeviceKind> _kTouchLikeDeviceTypes = <PointerDeviceKind>{
PointerDeviceKind.touch,
PointerDeviceKind.stylus,
PointerDeviceKind.invertedStylus,
PointerDeviceKind.trackpad,
// The VoiceAccess sends pointer events with unknown type when scrolling
// scrollables.
PointerDeviceKind.unknown,
};

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 26, 2024
Copy link

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants