-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Flutter 2.8.1
iOS 15.3
iPhone 12 Mini
Problem: Doing the exact same gesture on both Flutter and the iOS Settings App, its far easier to accidentally scroll when you lift your finger up. It's actually kind of hard not to hit this behavior.
Given how important scrolling is, this seems really important to fix for users. It also looks pretty bad to developers because this is the kind of issue that React Native, and Native just gets right by design.
I think what is happening: we are detecting a 'Fling' gesture when we should not be? If you move your finger slowly this behavior does not happen, because we never confuse it for a fling perhaps. Maybe the 'Fling' logic is too simplistic and needs to take the last ~200 milliseconds of events into greater account?
inadvertant.scrolling.small.mov
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {runApp(const MyApp());}
class MyApp extends StatelessWidget {
const MyApp({Key? key}): super(key: key);
Widget buildScrollWidget() {
List<Widget> wList = [];
for (int i = 0; i < 20; i++){
wList.add(Container(height: 200, color: Colors.white));
wList.add(Container(height: 200, color: Colors.grey));
wList.add(Container(height: 200, color: Colors.blue));
wList.add(Container(height: 200, color: Colors.green));
wList.add(Container(height: 200, color: Colors.pink));
wList.add(Container(height: 200, color: Colors.purple));
wList.add(Container(height: 200, color: Colors.orange));
}
return ListView(children: wList);
}
@override
Widget build(BuildContext context) {
return CupertinoApp(
title: 'Scroll Test',
theme: const CupertinoThemeData(primaryColor: Colors.white),
home: buildScrollWidget(),
);
}
}