I'm trying to place a draggable scrollbar on my flutter Form
, so the web users can click and drag to the screen bottom. The flutter Scrollbar
class is fine for touchscreen devices, for mouses is not!
I've tried using draggable_scrollbar, however it only accepts ListView
as child.
Here is my current code structure:
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('My form'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Scrollbar(
child: SingleChildScrollView(
child: Form(...),
),
),
),
);
}
In Draggable Scrollbar you can try using ListView.builder
with only 1 item which is your form, as shown below.
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('My form'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Scrollbar(
child: SingleChildScrollView(
child: DraggableScrollbar.rrect(
controller: myScrollController,
child: ListView.builder(
controller: myScrollController,
itemCount: 1,
itemBuilder: (context, index) {
return Form();
},
),
),
),
),
),
);
}
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