While RefreshIndicator was previously working fine on both, mobile and web, it doesn't refresh a screen on Flutter Web anymore. It's not possible to overscroll anymore on any of my screens, even if it's a long list, where it is easily possible on the mobile version.
I noticed the problem after updating from flutter 3.3.x to 3.7.9
Here is another simplified example. On phone it works well to reload the random generated numbers, on web nothing happens:
import 'package:flutter/material.dart';
import 'dart:math';
void main() => runApp(const MyHomePage());
class MyHomePage extends StatefulWidget {
const MyHomePage({
Key? key,
}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String title = 'Hello';
var rng = Random();
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(
title: Text(title),
),
body: RefreshIndicator(
onRefresh: () async => setState(() {
title = 'Hey';
}),
child: ListView.builder(
physics: const AlwaysScrollableScrollPhysics(),
itemBuilder: (_, i) => Container(
padding: const EdgeInsets.all(10),
color: Colors.lightBlue,
width: double.infinity,
height: 50,
child: Text(
rng.nextInt(100).toString(),
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
color: Colors.white,
),
),
),
itemCount: 200,
),
),
),
);
}
}
I tried to google for many hours, but didn't find any helpful information. Any ideas? Thank you
EDIT: Version by Niladri Raychaudhuri. Still the same problem


UPDATE 2
Added
PointerDeviceKind.trackpadto set of PointerDeviceKindUPDATE:
This is a known issue or maybe intended for Flutter Web and has been reported in Flutter Github
Reported Issue
You need a custom scroll behaviour to override behavior methods and getters like dragDevices.
Follow the steps:
1. Add plugin
custom_refresh_indicator: ^2.0.1.The solution should work with the native refreshIndicator as well.
2. Write your custom scroll behaviour
3.Define your scroll controller
4. Wrap your listView with a ScrollConfiguration widget and add your custom scroll behaviour to it
5. Finally wrap it with CustomRefreshIndicator or native RefreshIndicator
Final Note: I have used CustomRefreshIndicator here, you could use native RefreshIndicator
Full Code