0 purchases
sync scroll controller
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
copied to clipboard
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",
),
]
)
]
);
}
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.