scroll_to_index 1.0.1 copy "scroll_to_index: ^1.0.1" to clipboard
scroll_to_index: ^1.0.1 copied to clipboard

outdated

scroll to the index of any scrollable widget in Flutter

scroll-to-index #

A new Flutter package project.

Getting Started #

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  scroll_to_index: any

In your library add the following import:

import 'package:scroll_to_index/scroll_to_index.dart';

For help getting started with Flutter, view the online documentation.

Usage #

This is a widget level library, means you can use this mechanism inside any Flutter widget.

for example of Flutter ListView

ListView(
  scrollDirection: scrollDirection,
  controller: controller,
  children: randomList.map<Widget>((data) {
  	final index = data[0];
  	final height = data[1];
    return AutoScrollTag(
      key: ValueKey(index),
      controller: controller,
      index: index,
      child: Text('index: $index, height: $height'),
      highlightColor: Colors.black.withOpacity(0.1),
    );
  }).toList(),
)

you can wrap any of your row widget using with variable height

AutoScrollTag(
  key: ValueKey(index),
  controller: controller,
  index: index,
  child: child
)

with the AutoScrollController controller.

for full example, please see the example folder.

Who Uses #

  • Quire - a simple, collaborative, multi-level task management tool.
721
likes
0
pub points
99%
popularity

Publisher

verified publisherquire.io

scroll to the index of any scrollable widget in Flutter

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on scroll_to_index