Code deduplication
This commit is contained in:
parent
de41700741
commit
84a4a2c0c4
|
@ -343,17 +343,9 @@ class _ChatState extends State<_Chat> {
|
||||||
setState(() => selectedEvents.clear());
|
setState(() => selectedEvents.clear());
|
||||||
}
|
}
|
||||||
|
|
||||||
void replyAction() {
|
void replyAction({Event replyTo}) {
|
||||||
setState(() {
|
setState(() {
|
||||||
replyEvent = selectedEvents.first;
|
replyEvent = replyTo ?? selectedEvents.first;
|
||||||
selectedEvents.clear();
|
|
||||||
});
|
|
||||||
inputFocus.requestFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void replyBySwipeAction(Event replyTo) {
|
|
||||||
setState(() {
|
|
||||||
replyEvent = replyTo;
|
|
||||||
selectedEvents.clear();
|
selectedEvents.clear();
|
||||||
});
|
});
|
||||||
inputFocus.requestFocus();
|
inputFocus.requestFocus();
|
||||||
|
@ -696,8 +688,8 @@ class _ChatState extends State<_Chat> {
|
||||||
),
|
),
|
||||||
direction: SwipeDirection.startToEnd,
|
direction: SwipeDirection.startToEnd,
|
||||||
onSwiped: (direction) {
|
onSwiped: (direction) {
|
||||||
replyBySwipeAction(
|
replyAction(
|
||||||
filteredEvents[i - 1]);
|
replyTo: filteredEvents[i - 1]);
|
||||||
},
|
},
|
||||||
child: Message(filteredEvents[i - 1],
|
child: Message(filteredEvents[i - 1],
|
||||||
onAvatarTab: (Event event) {
|
onAvatarTab: (Event event) {
|
||||||
|
|
Loading…
Reference in a new issue