multi_directional_horizontal_list 0.0.3 multi_directional_horizontal_list: ^0.0.3 copied to clipboard
A multi directional horizontal list widget with next and previous.
multi_directional_horizontal_list #
A ListView
in which list items can be horizontally scrolled in multi direction.
Features #
- Easy creation of horizontal timeline-like interfaces.
- Back and Forth communication at ease
- Opportunity to jump or animate to an index programmatically
Getting Started #
Add the package to your pubspec.yaml:
multi_directional_horizontal_list: ^0.0.3
In your dart file, import the library:
import 'package:multi_directional_horizontal_list/multi_directional_horizontal_list.dart';
Create a MultiDirectionalHorizontalList
Widget:
final MultiDirectionalHorizontalListController controller = MultiDirectionalHorizontalListController();
MultiDirectionalHorizontalList(
controller: controller,
itemCount: 20,
onLeftLoaded: () {
print("Reached left end");
},
onRightLoaded: () {
print("Reached right end");
},
itemBuilder: (context, index) {
return SizedBox();
}
);
If you are using the MultiDirectionalHorizontalListController
you can animate or jump to an specific position in the list programmatically:
By using the index, which will scroll to the element at position [index]:
final MultiDirectionalHorizontalListController controller = MultiDirectionalHorizontalListController();
controller.animateTo(4);
controller.jumpTo(4);
If you are using the MultiDirectionalHorizontalListController
you can attach a listener and listen to scroll events like direction or position:
By using the listener, we can grab hold of position and direction:
final MultiDirectionalHorizontalListController controller = MultiDirectionalHorizontalListController();
controller()
..addListener((event) {});