'Flutter Scrollbars are not fill page height
I'm building single page website and trying to add Scrollbars to whole page, but my scrollbars are not filling height
This is maximum where I can scroll to bottom.
How to fix it?
My code:
class LoginPage extends GetView<LoginPageController> {
const LoginPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MainPageLayout(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: const Text('News'),
),
body: Scrollbar(
// <-- wrap this around
interactive: true,
child: ListView(
controller: ScrollController(),
children: <Widget>[
...List.generate(
100,
(index) => Text(
"$index",
style: const TextStyle(color: Colors.white),
)).toList()
],
),
)),
);
}
}
class MainPageLayout extends StatelessWidget {
final Widget child;
const MainPageLayout({Key? key, required this.child}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Scrollbar(
isAlwaysShown: true,
trackVisibility: true,
showTrackOnHover: true,
child: Row(
children: [
Flexible(child: Container(color: Palette.background)),
Flexible(flex: 4, child: Container(child: child)),
Flexible(child: Container(color: Palette.background)),
],
),
),
);
}
}
Also I've override the scroll behavior for Material App
final adaptiveScrollingBehavior = const MaterialScrollBehavior().copyWith(
dragDevices: {
PointerDeviceKind.mouse,
PointerDeviceKind.touch,
PointerDeviceKind.stylus,
PointerDeviceKind.unknown,
},
scrollbars: false
);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

