diff --git a/CHANGELOG.md b/CHANGELOG.md index c0033c8..9b29a1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.4 + +- Add Room type + ## 2.0.3 - Fix null status diff --git a/README.md b/README.md index 57c54df..a637c86 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ [![Pub](https://img.shields.io/pub/v/flutter_chat_types)](https://pub.dartlang.org/packages/flutter_chat_types) [![build](https://github.com/flyerhq/flutter_chat_types/workflows/build/badge.svg)](https://github.com/flyerhq/flutter_chat_types/actions?query=workflow%3Abuild) [![CodeFactor](https://www.codefactor.io/repository/github/flyerhq/flutter_chat_types/badge)](https://www.codefactor.io/repository/github/flyerhq/flutter_chat_types) -[![pub points](https://badges.bar/sentry/pub%20points)](https://pub.dev/packages/flutter_chat_types/score) Utility library for the [flutter_chat_ui](https://github.com/flyerhq/flutter_chat_ui) and [flutter_firebase_chat_core](https://github.com/flyerhq/flutter_firebase_chat_core) libraries which contains shared type declarations. Should not be used directly. diff --git a/lib/flutter_chat_types.dart b/lib/flutter_chat_types.dart index 239a314..8a7b6d2 100644 --- a/lib/flutter_chat_types.dart +++ b/lib/flutter_chat_types.dart @@ -2,4 +2,5 @@ library flutter_chat_types; export 'src/message.dart'; export 'src/preview_data.dart'; +export 'src/room.dart'; export 'src/user.dart'; diff --git a/lib/src/room.dart b/lib/src/room.dart new file mode 100644 index 0000000..9593b0f --- /dev/null +++ b/lib/src/room.dart @@ -0,0 +1,32 @@ +import 'package:meta/meta.dart'; +import 'user.dart'; + +/// A class that represents a room where 2 or more participants can chat +@immutable +class Room { + /// Creates a [Room] + const Room({ + required this.id, + this.imageUrl, + required this.isGroup, + this.name, + required this.users, + }); + + /// Room's unique ID + final String id; + + /// Room's image. In case the room has 2 users - avatar of the second person, + /// otherwise custom image (for a group). + final String? imageUrl; + + /// Should be true if more than 2 users are in the room + final bool isGroup; + + /// Room's name. In case the room has 2 users - name of the second person, + /// otherwise custom name (for a group). + final String? name; + + /// List of users which are in the room + final List users; +} diff --git a/pubspec.yaml b/pubspec.yaml index 48ae428..6059185 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_chat_types description: > Utility library for the flutter_chat_ui and flutter_firebase_chat_core libraries which contains shared type declarations. -version: 2.0.3 +version: 2.0.4 homepage: https://github.com/flyerhq/flutter_chat_types environment: