-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed send on enter param and added an example
- Loading branch information
1 parent
7979036
commit e6477f9
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import 'package:dash_chat_2/dash_chat_2.dart'; | ||
import 'package:examples/data.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class SendOnEnter extends StatefulWidget { | ||
@override | ||
_SendOnEnterState createState() => _SendOnEnterState(); | ||
} | ||
|
||
class _SendOnEnterState extends State<SendOnEnter> { | ||
List<ChatMessage> messages = basicSample; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('SendOnEnter example'), | ||
), | ||
body: DashChat( | ||
currentUser: user, | ||
onSend: (ChatMessage m) { | ||
setState(() { | ||
messages.insert(0, m); | ||
}); | ||
}, | ||
messages: messages, | ||
inputOptions: const InputOptions( | ||
sendOnEnter: true, | ||
), | ||
messageListOptions: MessageListOptions( | ||
onLoadEarlier: () async { | ||
await Future.delayed(const Duration(seconds: 3)); | ||
}, | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters