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

Gif example
I found a better way to fix that, it's simple!
Wrap your main content that receives refresh Indicator or list View with this
On behavior u can define scroll type with bouncing work perfect for me my content will back to up when end to push down
ScrollConfiguration(
behavior: ScrollConfiguration.of(context).copyWith(
physics: const BouncingScrollPhysics(),
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
PointerDeviceKind.trackpad
},
),
On your code
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(
title: Text(title),
),
body: ScrollConfiguration(
behavior: ScrollConfiguration.of(context).copyWith(
physics: const BouncingScrollPhysics(),
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
PointerDeviceKind.trackpad
},
),
child: 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,
),
),
),
),
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With