Issue
Since Flutter 2.5 got released, touch gestures are not working anymore (for example with ScrollViwes or Tabs). I didn't test in on Android / IOS, since I am not developing for these platforms at the time, but I assume it is just disabled for PC platforms by default, but I could not find any resource about this and don't know how to turn it on! (I had the same issue on two independent workstations with multiple independent projects, in debug and release)
Edit
Example:
void main() {
runApp(
MaterialApp(
home: Scaffold(
body: ListView.builder(
itemBuilder: (buildContext, index) => ListTile(
title: Text("test " + index.toString()),
),
),
),
),
);
}
Solution
This was a breaking change in Flutter 2.5, but there is a migration guide from Flutter if you still want this behavior: https://flutter.dev/docs/release/breaking-changes/default-scroll-behavior-drag#migration-guide.
You have to write your own ScrollBehavior:
class MyScrollBehavior extends MaterialScrollBehavior {
@override
Set<PointerDeviceKind> get dragDevices => {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
...
};
}
MaterialApp(
scrollBehavior: MyScrollBehavior(),
...
);
Answered By - Mäddin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.