How to add Scrollbar to Listview in Flutter?

This Article is posted by seven.srikanth at 10/1/2021 6:48:58 PM



Here is an example of how to add ScrollBar to ListView in flutter. This can be achieved through Scrollbar widget in flutter and its simple to use. 
Complete Code: 

import 'package:flutter/material.dart';
main(List<String> args) {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@ override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHome(),
);
}
}
class MyHome extends StatelessWidget {
@ override
Widget build(BuildContext context) {
return Scaffold(
body: Scrollbar(
thickness: 10,
child: ListView(
children: List.generate(
20,
(int i) => Card(
child: Center(
child: ListTile(
title: Text(
'This is item ' + i.toString(),
),
),
),
),
),
),
),
);
}
}
Thanks,
Srikanth

Tags: How to add Scrollbar








0 Comments
Login to comment.
Recent Comments












© 2018 - Fluttercentral | Email to me - seven.srikanth@gmail.com