-
Notifications
You must be signed in to change notification settings - Fork 666
Expand file tree
/
Copy pathquick_scrollbar.dart
More file actions
30 lines (27 loc) · 1.04 KB
/
quick_scrollbar.dart
File metadata and controls
30 lines (27 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import 'package:flutter/material.dart';
import 'package:flukit/flukit.dart';
class QuickScrollbarRoute extends StatelessWidget {
QuickScrollbarRoute({Key? key}) : super(key: key);
///If you are using a ListView, GridView,
/// or any other scrollable widget, you need to create a ScrollController
/// and pass it to the controller parameter of the QuickScrollbar widget:
final ScrollController _scrollController = ScrollController();
@override
Widget build(BuildContext context) {
return QuickScrollbar(
controller: _scrollController,
child: ListView.builder(
controller: _scrollController,
itemCount: 1000,
// Specifying an [itemExtent] or [prototypeItem] is more efficient
// than letting the children determine their own extent when use QuickScrollbar.
//itemExtent: 56,
prototypeItem: const ListTile(title: Text("1")),
itemBuilder: (ctx, index) => ListTile(
title: Text("$index"),
onTap: () => debugPrint('$index'),
),
),
);
}
}