sync_scroll_controller 1.0.0 copy "sync_scroll_controller: ^1.0.0" to clipboard
sync_scroll_controller: ^1.0.0 copied to clipboard

Simply Synced Scroll Controllers

SyncScrollController that keeps two ScrollControllers in sync.

Similar to LinkedScrollController but has an initial offset parameter and is actively maintained.

Features #

  • Initial Scroll Offset
  • Accepting Pull Requests

Getting started #

In the command line

flutter pub get linked_scroll_controller

Usage #

import 'package:sync_scroll_controller/sync_scroll_controller.dart';


class Example extends StatefulWidget {
  const Example({ Key? key }) : super(key: key);
  @override
  State<Example> createState() => _ExampleState();
}

class _ExampleState extends State<Example> {

  late final SyncScrollControllerGroup horizontalControllers;
  late ScrollController rowsControllerHeader;
  late ScrollController rowsControllerBody;

  @override
  void initState() {
    super.initState();
    horizontalControllers = SyncScrollControllerGroup(
      initialScrollOffset: 100,
    );
    rowsControllerHeader = horizontalControllers.addAndGet();
    rowsControllerBody = horizontalControllers.addAndGet();
  }

 @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        ListView(
          scrollDirection: Axis.horizontal,
          controller: rowsControllerHeader,
          children: const [
            Text(
              "Lorem Ipsum is simply dummy header of the printing",
            ),
            Text(
              "Lorem Ipsum is simply dummy header of the printing",
            ),
          ]
        ),
        ListView(
          controller: rowsControllerBody,
          scrollDirection: Axis.horizontal,
          children: const [
            Text(
              "Lorem Ipsum is simply dummy body text of the printing",
            ),
            Text(
              "Lorem Ipsum is simply dummy body text of the printing",
            ),
          ]
        )
      ]
    );
  }
}
6
likes
130
points
3.96k
downloads

Publisher

unverified uploader

Weekly Downloads

Simply Synced Scroll Controllers

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, intl

More

Packages that depend on sync_scroll_controller