This is a component used to display the message list. When you need to load more historical messages and obtain new messages, you may need to use it to load data off the screen.
Features
This is a component used to display the message list
Getting started
flutter pub add history_list
Usage
import 'package:history_list/history_list.dart';
Stack(
children: [
HistoryMessageList(
newBuilder: (p0, p1) {
var item = messageListp1
;
if (item'type'
== "Right") {
return newRightItem(item);
} else {
return newRightItem(item);
}
},
oldBuilder: (p0, p1) {
var item = oldMessageListp1
;
if (item'type'
== "Right") {
return rightItem(item);
} else {
return rightItem(item);
}
},
newHardle: (() {
return Future.delayed(Duration(seconds: 2), () {
addMessage();
});
}),
oldHardle: (() {
return Future.delayed(Duration(seconds: 2), () {
addOldMessage();
});
}),
oldCount: oldMessageList.length,
newCount: messageList.length,
oldloadingWidget: Padding(
padding: EdgeInsets.all(20),
child: Text('获取更多历史消息'),
),
),
],
)
Additional information
find more infomation here: https://github.com/db5433/history_list.git