Closed
Description
Steps to Reproduce
Run the following code
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
late ScrollController _controller;
@override
void initState() {
_controller = ScrollController();
super.initState();
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ListView.builder(
itemCount: 500,
controller: _controller, // will not respond to PageUp, PageDown
itemBuilder: (BuildContext context, int i) => Text('Item $i'))),
);
}
}
If I run this example for a web target, pressing PageUp and PageDown on the keyboard does not have any effect. If I comment out the line
controller: _controller,
the PageUp and PageDown presses work as expected. Is this normal/expected? How do I get the default behavior if I want to have a custom scroll controller?
Sorry for cross posting, but I got no answer on SO and this potentially is a bug
https://stackoverflow.com/questions/69791696/flutters-listview-builder-with-custom-controller-will-not-respond-to-pageup-pag
Thanks for your help,
Tony
Metadata
Metadata
Assignees
Labels
issue is assigned to a domain expert for further triageFocus traversal, gaining or losing focusViewports, list views, slivers, etc.Found to occur in 2.5Found to occur in 2.6flutter/packages/flutter repository. See also f: labels.The issue has been confirmed reproducible and is ready to work onWeb applications specifically