Minimal code:
ListView.builder(
physics: BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
itemBuilder: (_, i) => ListTile(title: Text('$i')),
itemCount: 50,
)
The BouncingScrollPhysics seems to have no effect. I am testing this on macOS.
asked Jul 29, 2021 at 14:03
iDecode
29.8k26 gold badges151 silver badges254 bronze badges
1 Answer 1
You don't need to set parent argument. You can just set empty constructor and it will work:
physics: BouncingScrollPhysics(),
Instead of setting physics parameter you can also use ScrollBehavior
class CustomScrollBehavior extends ScrollBehavior {
const CustomScrollBehavior();
@override
ScrollPhysics getScrollPhysics(BuildContext context) {
return const BouncingScrollPhysics();
}
}
ScrollConfiguration(
behavior: CustomScrollBehavior(),
child: ListView.builder(
// physics: BouncingScrollPhysics(),
itemBuilder: (ctx, index) {
...
answered Jul 29, 2021 at 14:14
Nik
2,0602 gold badges16 silver badges35 bronze badges
Sign up to request clarification or add additional context in comments.
lang-dart
flutter cleanand rebuildflutter clean, full restart, nothing worked, however this code works on iOS. Maybe it's a bug on macOS.Flutter 3.0.5.