diff --git a/packages/stream_chat/lib/src/core/models/message.dart b/packages/stream_chat/lib/src/core/models/message.dart index a7d21c03..1004b7a0 100644 --- a/packages/stream_chat/lib/src/core/models/message.dart +++ b/packages/stream_chat/lib/src/core/models/message.dart @@ -305,7 +305,8 @@ class Message extends Equatable { quotedMessage != null && quotedMessage is! _NullConst) { throw ArgumentError( - '`quotedMessage` can only be set as Message or null'); + '`quotedMessage` can only be set as Message or null', + ); } return true; }(), 'Validate type for quotedMessage'); @@ -315,7 +316,8 @@ class Message extends Equatable { quotedMessageId != null && quotedMessageId is! _NullConst) { throw ArgumentError( - '`quotedMessage` can only be set as String or null'); + '`quotedMessage` can only be set as String or null', + ); } return true; }(), 'Validate type for quotedMessage'); diff --git a/packages/stream_chat/test/src/client/channel_test.dart b/packages/stream_chat/test/src/client/channel_test.dart index 60e8dd93..7eb68b79 100644 --- a/packages/stream_chat/test/src/client/channel_test.dart +++ b/packages/stream_chat/test/src/client/channel_test.dart @@ -756,7 +756,6 @@ void main() { const messageId = 'test-message-id'; final message = Message( id: messageId, - status: MessageSendingStatus.sending, ); expectLater( diff --git a/packages/stream_chat_flutter/lib/src/message_input/stream_attachment_picker.dart b/packages/stream_chat_flutter/lib/src/message_input/stream_attachment_picker.dart index 93c86d72..6f03c976 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/stream_attachment_picker.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/stream_attachment_picker.dart @@ -23,41 +23,8 @@ typedef CustomAttachmentIconBuilder = Widget Function( /// A widget that allows to pick an attachment. class StreamAttachmentPicker extends StatefulWidget { - /// True if the picker is open. - final bool isOpen; - - /// The picker size in height. - final double pickerSize; - - /// The [MessageInputController] linked to this picker. - final MessageInputController messageInputController; - - /// The limit of attachments that can be picked. - final int attachmentLimit; - - /// The callback for when the attachment limit is exceeded. - final AttachmentLimitExceedListener? onAttachmentLimitExceeded; - - final ValueChanged? onError; - final FilePickerCallback onFilePicked; - - /// Video quality to use when compressing the videos. - final VideoQuality compressedVideoQuality; - - /// Frame rate to use when compressing the videos. - final int compressedVideoFrameRate; - - /// Max attachment size in bytes: - /// - Defaults to 20 MB - /// - Do not set it if you're using our default CDN - final int maxAttachmentSize; - - /// The list of attachment types that can be picked. - final List allowedAttachmentTypes; - - /// The list of custom attachment types that can be picked. - final List customAttachmentTypes; - + /// Default constructor for [StreamAttachmentPicker] which creates the Stream + /// attachment picker widget. const StreamAttachmentPicker({ Key? key, required this.messageInputController, @@ -78,6 +45,46 @@ class StreamAttachmentPicker extends StatefulWidget { this.customAttachmentTypes = const [], }) : super(key: key); + /// True if the picker is open. + final bool isOpen; + + /// The picker size in height. + final double pickerSize; + + /// The [MessageInputController] linked to this picker. + final MessageInputController messageInputController; + + /// The limit of attachments that can be picked. + final int attachmentLimit; + + /// The callback for when the attachment limit is exceeded. + final AttachmentLimitExceedListener? onAttachmentLimitExceeded; + + /// Callback for when an error occurs in the attachment picker. + final ValueChanged? onError; + + /// Callback for when file is picked. + final FilePickerCallback onFilePicked; + + /// Video quality to use when compressing the videos. + final VideoQuality compressedVideoQuality; + + /// Frame rate to use when compressing the videos. + final int compressedVideoFrameRate; + + /// Max attachment size in bytes: + /// - Defaults to 20 MB + /// - Do not set it if you're using our default CDN + final int maxAttachmentSize; + + /// The list of attachment types that can be picked. + final List allowedAttachmentTypes; + + /// The list of custom attachment types that can be picked. + final List customAttachmentTypes; + + /// Used to create a new copy of [StreamAttachmentPicker] with modified + /// properties. StreamAttachmentPicker copyWith({ Key? key, MessageInputController? messageInputController, @@ -549,14 +556,22 @@ class _PickerWidgetState extends State<_PickerWidget> { } } +/// Class which holds data for a custom attachment type in the attachment picker class CustomAttachmentType { - String type; - CustomAttachmentIconBuilder iconBuilder; - WidgetBuilder pickerBuilder; - + /// Default constructor for creating a custom attachment for the attachment + /// picker. CustomAttachmentType({ required this.type, required this.iconBuilder, required this.pickerBuilder, }); + + /// Type name. + String type; + + /// Builds the icon in the attachment picker top row. + CustomAttachmentIconBuilder iconBuilder; + + /// Builds content in the attachment builder when icon is selected. + WidgetBuilder pickerBuilder; } diff --git a/packages/stream_chat_flutter/lib/src/message_input/stream_message_text_field.dart b/packages/stream_chat_flutter/lib/src/message_input/stream_message_text_field.dart index e7d765d9..af06f53b 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/stream_message_text_field.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/stream_message_text_field.dart @@ -1,4 +1,4 @@ -// ignore_for_file: prefer-trailing-comma, cascade_invocations +// ignore_for_file: prefer-trailing-comma, cascade_invocations, lines_longer_than_80_chars import 'dart:ui' as ui show BoxHeightStyle, BoxWidthStyle; @@ -44,7 +44,8 @@ class StreamMessageTextField extends StatefulWidget { /// After [maxLength] characters have been input, additional input /// is ignored, unless [maxLengthEnforcement] is set to /// [MaxLengthEnforcement.none]. - /// The text field enforces the length with a [LengthLimitingTextInputFormatter], + /// The text field enforces the length with a + /// [LengthLimitingTextInputFormatter], /// which is evaluated after the supplied [inputFormatters], if any. /// The [maxLength] value must be either null or greater than zero. /// @@ -633,7 +634,7 @@ class StreamMessageTextField extends StatefulWidget { defaultValue: null)); properties.add(DiagnosticsProperty( 'scrollPadding', scrollPadding, - defaultValue: const EdgeInsets.all(20.0))); + defaultValue: const EdgeInsets.all(20))); properties.add(FlagProperty('selectionEnabled', value: selectionEnabled, defaultValue: true, diff --git a/packages/stream_chat_flutter/lib/stream_chat_flutter.dart b/packages/stream_chat_flutter/lib/stream_chat_flutter.dart index b39a2eea..a4e9d715 100644 --- a/packages/stream_chat_flutter/lib/stream_chat_flutter.dart +++ b/packages/stream_chat_flutter/lib/stream_chat_flutter.dart @@ -23,16 +23,16 @@ export 'src/localization/stream_chat_localizations.dart'; export 'src/localization/translations.dart' show DefaultTranslations; export 'src/mention_tile.dart'; export 'src/message_action.dart'; +export 'src/message_input/countdown_button.dart'; export 'src/message_input/message_input.dart'; +export 'src/message_input/stream_attachment_picker.dart'; +export 'src/message_input/stream_message_send_button.dart'; +export 'src/message_input/stream_message_text_field.dart'; export 'src/message_list_view.dart'; export 'src/message_search_item.dart'; export 'src/message_search_list_view.dart'; export 'src/message_text.dart'; export 'src/message_widget.dart'; -export 'src/message_input/countdown_button.dart'; -export 'src/message_input/stream_attachment_picker.dart'; -export 'src/message_input/stream_message_send_button.dart'; -export 'src/message_input/stream_message_text_field.dart'; export 'src/option_list_tile.dart'; export 'src/reaction_icon.dart'; export 'src/reaction_picker.dart';