lorien_chat_list 0.0.1 copy "lorien_chat_list: ^0.0.1" to clipboard
lorien_chat_list: ^0.0.1 copied to clipboard

LORIEN.DEV Chat list.

lorien_chat_list #

lorien_chat_list is a package to help build chat pages like Messenger or WhatsUp. The main difference with other packages is the scrolling part - it will scroll automatically on a new message or preserve the current scroll position if the user scrolled up in the list (you can set the treshold for that).

lorien_dev_chat_list_demo_short

Getting Started #

Add the dependency in pubspec.yaml:

dependencies:
  ...
  lorien_chat_list:: ^0.0.1

Basic Usage #

Import #

import 'package:lorien_chat_list/lorien_chat_list.dart';

Controller #

final ChatListController<int> _controller = ChatListController(initialItems: List<int>.generate(10, (index) => index));

Adding an item to the bottom of the list.

_controller.addToBottom(100);

Adding a range of items to the bottom of the list.

_controller.addRangeToBottom([100, 200]);

Adding an item to the top of the list.

_controller.addToTop(-100);

Adding a range of items to the top of the list.

_controller.addRangeToTop([-100, -200]);

Clearing all items and resetting the controller to its initial state.

_controller.clearAll();

Widget #

ChatList(
  controller: _controller,
  itemBuilder: (item, properties) => Text(
    '${item.toString()} - ${properties.toString()}',
  ),
),

For a more complex usage please see the example.

Customization (optional) #

ChatList #

  • loadingMoreWidget - widget that is visible at the top of the list while loading more old items (onLoadMoreCallback)
  • onLoadMoreCallback - function called to load more old items. Triggered while reached top edge of the list. Should return bool - true if there are more old messages to load, otherwise false if everything is loaded.
  • scrollController - scroll controller
  • scrollPhysics - scroll physics
  • padding - list padding
  • spacing - vertical spacing between items
  • useJumpTo - whether to use jumpTo instead of animateTo in automatic scrolling
  • animateToDuration - animateTo duration, defaults to 300 milliseconds
  • fadeInDuration - fade in duration, defaults to 300 milliseconds
  • animateToCurve - animateTo curve, defaults to Curves.easeInOut
  • fadeInCurve - fade in curve, defaults to Curves.easeInOut
  • bottomEdgeThreshold - threshold for automatic scrolling to a new bottom items, defaults to 0

Contributing #

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Author #

License #

Beerware - if you find the package useful, you can buy me a beer or a coffee 🍺

"Buy Me A Coffee"

2
likes
0
points
17
downloads

Publisher

verified publisherlorien.dev

Weekly Downloads

LORIEN.DEV Chat list.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on lorien_chat_list