fixed docs

This commit is contained in:
Deven Joshi
2021-12-20 19:29:03 +05:30
parent 099e904614
commit 0c2ce9c955
5 changed files with 66 additions and 49 deletions
@@ -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');
@@ -756,7 +756,6 @@ void main() {
const messageId = 'test-message-id';
final message = Message(
id: messageId,
status: MessageSendingStatus.sending,
);
expectLater(
@@ -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<String>? 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<DefaultAttachmentTypes> allowedAttachmentTypes;
/// The list of custom attachment types that can be picked.
final List<CustomAttachmentType> 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<String>? 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<DefaultAttachmentTypes> allowedAttachmentTypes;
/// The list of custom attachment types that can be picked.
final List<CustomAttachmentType> 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;
}
@@ -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<EdgeInsetsGeometry>(
'scrollPadding', scrollPadding,
defaultValue: const EdgeInsets.all(20.0)));
defaultValue: const EdgeInsets.all(20)));
properties.add(FlagProperty('selectionEnabled',
value: selectionEnabled,
defaultValue: true,
@@ -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';