Last updated:
0 purchases
fading scroll
fading_scroll #
Quickstart #
Add the dependency to fading_scroll to your pubspec.yaml file.
flutter pub add fading_scroll
copied to clipboard
Wrap your scrollable content in a FadingScroll widget and give the provided ScrollController to your scrollable widget.
@override
Widget build(BuildContext context) {
return FadingScroll(
builder: (context, controller) {
return ListView(
controller: controller,
children: [
// ...
],
),
},
);
}
copied to clipboard
Usage #
Customize fading size and scroll threshold #
You can customise the effect by providing custom scroll extents and fading sizes.
@override
Widget build(BuildContext context) {
return FadingScroll(
fadingSize: 100,
scrollExtent: 120,
builder: (context, controller) {
return ListView(
controller: controller,
children: [
// ...
],
),
},
);
}
copied to clipboard
Using a different controller #
You can also provide your own ScrollController to the FadingScroll. This may be useful for controller subclasses like the PageController.
class _State_ extends State<Example> {
late final pageController = PageController();
@override
void dispose() {
pageController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return FadingScroll(
controller: pageController,
builder: (context, controller) {
return PageView(
controller: pageController,
children: [
// ...
],
);
},
);
}
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.