Skip to content

Commit

Permalink
Add missing text parameter of system message and export correctly (#27)
Browse files Browse the repository at this point in the history
* feat: export system message

* feat: add text parameter to system message
  • Loading branch information
felixgabler authored Aug 7, 2022
1 parent 464df89 commit 4ffbf13
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/flutter_chat_types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export 'src/messages/partial_custom.dart';
export 'src/messages/partial_file.dart';
export 'src/messages/partial_image.dart';
export 'src/messages/partial_text.dart';
export 'src/messages/system_message.dart';
export 'src/messages/text_message.dart';
export 'src/messages/unsupported_message.dart';
export 'src/preview_data.dart';
Expand Down
10 changes: 10 additions & 0 deletions lib/src/messages/system_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ abstract class SystemMessage extends Message {
super.roomId,
super.showStatus,
super.status,
required this.text,
MessageType? type,
super.updatedAt,
}) : super(type: type ?? MessageType.system);
Expand All @@ -36,6 +37,7 @@ abstract class SystemMessage extends Message {
String? roomId,
bool? showStatus,
Status? status,
required String text,
MessageType? type,
int? updatedAt,
}) = _SystemMessage;
Expand All @@ -44,6 +46,9 @@ abstract class SystemMessage extends Message {
factory SystemMessage.fromJson(Map<String, dynamic> json) =>
_$SystemMessageFromJson(json);

/// System message content (could be text or translation key).
final String text;

/// Equatable props.
@override
List<Object?> get props => [
Expand All @@ -55,6 +60,7 @@ abstract class SystemMessage extends Message {
repliedMessage,
roomId,
status,
text,
updatedAt,
];

Expand All @@ -69,6 +75,7 @@ abstract class SystemMessage extends Message {
String? roomId,
bool? showStatus,
Status? status,
String? text,
int? updatedAt,
});

Expand All @@ -90,6 +97,7 @@ class _SystemMessage extends SystemMessage {
super.roomId,
super.showStatus,
super.status,
required super.text,
super.type,
super.updatedAt,
}) : super._();
Expand All @@ -105,6 +113,7 @@ class _SystemMessage extends SystemMessage {
dynamic roomId,
dynamic showStatus = _Unset,
dynamic status = _Unset,
String? text,
dynamic updatedAt = _Unset,
}) =>
_SystemMessage(
Expand All @@ -122,6 +131,7 @@ class _SystemMessage extends SystemMessage {
showStatus:
showStatus == _Unset ? this.showStatus : showStatus as bool?,
status: status == _Unset ? this.status : status as Status?,
text: text ?? this.text,
updatedAt: updatedAt == _Unset ? this.updatedAt : updatedAt as int?,
);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/src/messages/system_message.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4ffbf13

Please sign in to comment.