Dev-Owl / advanced_datatable

Advanced Datatable uses the Fultter PaginatedDataTable Widget and adds a few more functions to it
BSD 3-Clause "New" or "Revised" License
16 stars 16 forks source link

Can't Scroll horizontally with flutter 2.5 #12

Closed cardinalblues7 closed 3 years ago

cardinalblues7 commented 3 years ago

When the table has many columns and the width of the table is wider than the visible area, we used a SingleChildScrollView to contain it, in flutter 2.5 we can't scroll the table horizontally, sdk 2.2 has no problem at all.

yunuskaygun commented 3 years ago

could you find a solution?

Dev-Owl commented 3 years ago

I'm very limited in time right now due to my full time job. Its strange that the scroll widget is no longer working for one direction. I hope to get time to work on the package this weekend and of course will check this. Any help /check is very welcome.

Dev-Owl commented 3 years ago

@yunuskaygun @cardinalblues7 It's a change in Flutter: See the docs

A workaround to make it work (please note on web you need to drag with your mouse) for me was this:

class MyCustomScrollBehavior extends MaterialScrollBehavior {
  @override
  Set<PointerDeviceKind> get dragDevices => {
        PointerDeviceKind.touch,
        PointerDeviceKind.mouse,
      };
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      scrollBehavior: MyCustomScrollBehavior(),
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Advanced DataTable Demo'),
    );
  }
}

Source for code above