feat: update chat example

This commit is contained in:
Freek van de Ven 2023-06-29 15:57:42 +02:00
parent 3003ed5389
commit 6f78ae6518
4 changed files with 12 additions and 8 deletions

View file

@ -1,6 +1,8 @@
# Flutter Community Chat
Flutter Community Chat is a package which gives the possibility to add a (personal or group) chat to your Flutter-application. Default this package adds support for a Firebase back-end. You can add your custom back-end (like a Websocket-API) by extending the `CommunityChatInterface` interface from the `flutter_community_chat_interface` package.
![Flutter Community Chat GIF](example.gif)
## Setup
To use this package, add flutter_community_chat as a dependency in your pubspec.yaml file:

BIN
example.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

View file

@ -43,7 +43,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
imageUrl: 'https://xsgames.co/randomusers/avatar.php?g=male',
),
text: 'Met mij gaat het goed, dankje!',
timestamp: DateTime.now(),
timestamp: DateTime.now().subtract(const Duration(days: 2)),
)
];
@ -53,21 +53,23 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
lastName: 'Sjagerars',
imageUrl: 'https://xsgames.co/randomusers/avatar.php?g=female',
),
lastUsed: DateTime.now(),
messages: messages,
);
static final groupChat = GroupChatModel(
title: 'Group chat',
imageUrl: 'https://xsgames.co/randomusers/avatar.php?g=male',
users: [pietUser, janUser],
messages: messages);
title: 'Group chat',
imageUrl: 'https://xsgames.co/randomusers/avatar.php?g=male',
users: [pietUser, janUser],
lastUsed: DateTime.now().subtract(const Duration(days: 1)),
messages: messages,
);
Stream<List<ChatModel>> get chatStream => (() {
late StreamController<List<ChatModel>> controller;
controller = StreamController<List<ChatModel>>(
onListen: () {
controller.add([
chat,
groupChat,
chat,
]);

View file

@ -218,8 +218,8 @@ packages:
dependency: transitive
description:
path: "packages/flutter_community_chat_interface"
ref: "feature/group-chats"
resolved-ref: cc5c5b6e1cd12c150a0aa7e1b363cc45267009c3
ref: "0.3.0"
resolved-ref: "3003ed53896c045574ecc64e00c113db3b850e7f"
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
source: git
version: "0.3.0"