refactor(ui, core): Deprecate v3
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
|
||||
/// {@macro attachment_title}
|
||||
@Deprecated("Use 'StreamAttachmentTitle' instead")
|
||||
typedef AttachmentTitle = StreamAttachmentTitle;
|
||||
|
||||
/// {@template attachment_title}
|
||||
/// Title for attachments
|
||||
class AttachmentTitle extends StatelessWidget {
|
||||
/// {@endtemplate}
|
||||
class StreamAttachmentTitle extends StatelessWidget {
|
||||
/// Supply attachment and theme for constructing title
|
||||
const AttachmentTitle({
|
||||
const StreamAttachmentTitle({
|
||||
Key? key,
|
||||
required this.attachment,
|
||||
required this.messageTheme,
|
||||
}) : super(key: key);
|
||||
|
||||
/// Theme to apply to text
|
||||
final MessageThemeData messageTheme;
|
||||
final StreamMessageThemeData messageTheme;
|
||||
|
||||
/// Attachment data to display
|
||||
final Attachment attachment;
|
||||
|
||||
+11
-5
@@ -9,10 +9,16 @@ typedef InProgressBuilder = Widget Function(BuildContext, int, int);
|
||||
/// Widget to build on failure
|
||||
typedef FailedBuilder = Widget Function(BuildContext, String);
|
||||
|
||||
/// {@macro attachment_upload_state_builder}
|
||||
@Deprecated("Use 'StreamAttachmentsUploadStateBuilder' instead")
|
||||
typedef AttachmentUploadStateBuilder = StreamAttachmentUploadStateBuilder;
|
||||
|
||||
/// {@template attachment_upload_state_builder}
|
||||
/// Widget to display attachment upload state
|
||||
class AttachmentUploadStateBuilder extends StatelessWidget {
|
||||
/// Constructor for creating an [AttachmentUploadStateBuilder] widget
|
||||
const AttachmentUploadStateBuilder({
|
||||
/// {@endtemplate}
|
||||
class StreamAttachmentUploadStateBuilder extends StatelessWidget {
|
||||
/// Constructor for creating an [StreamAttachmentUploadStateBuilder] widget
|
||||
const StreamAttachmentUploadStateBuilder({
|
||||
Key? key,
|
||||
required this.message,
|
||||
required this.attachment,
|
||||
@@ -137,7 +143,7 @@ class _PreparingState extends StatelessWidget {
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: UploadProgressIndicator(
|
||||
child: StreamUploadProgressIndicator(
|
||||
uploaded: 0,
|
||||
total: double.maxFinite.toInt(),
|
||||
),
|
||||
@@ -177,7 +183,7 @@ class _InProgressState extends StatelessWidget {
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: UploadProgressIndicator(
|
||||
child: StreamUploadProgressIndicator(
|
||||
uploaded: sent,
|
||||
total: total,
|
||||
),
|
||||
|
||||
@@ -28,10 +28,16 @@ extension AttachmentSourceX on AttachmentSource {
|
||||
}
|
||||
}
|
||||
|
||||
/// {@macro attachment_widget}
|
||||
@Deprecated("Use 'StreamAttachmentWidget' instead")
|
||||
typedef AttachmentWidget = StreamAttachmentWidget;
|
||||
|
||||
/// {@template attachment_widget}
|
||||
/// Abstract class for deriving attachment types
|
||||
abstract class AttachmentWidget extends StatelessWidget {
|
||||
/// {@endtemplate}
|
||||
abstract class StreamAttachmentWidget extends StatelessWidget {
|
||||
/// Constructor for creating attachment widget
|
||||
const AttachmentWidget({
|
||||
const StreamAttachmentWidget({
|
||||
Key? key,
|
||||
required this.message,
|
||||
required this.attachment,
|
||||
|
||||
@@ -10,10 +10,16 @@ import 'package:stream_chat_flutter/src/utils.dart';
|
||||
import 'package:stream_chat_flutter/src/video_thumbnail_image.dart';
|
||||
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
||||
|
||||
/// {@macro file_attachment}
|
||||
@Deprecated("Use 'StreamFileAttachment' instead")
|
||||
typedef FileAttachment = StreamFileAttachment;
|
||||
|
||||
/// {@template file_attachment}
|
||||
/// Widget for displaying file attachments
|
||||
class FileAttachment extends AttachmentWidget {
|
||||
/// {@endtemplate}
|
||||
class StreamFileAttachment extends StreamAttachmentWidget {
|
||||
/// Constructor for creating a widget when attachment is of type 'file'
|
||||
const FileAttachment({
|
||||
const StreamFileAttachment({
|
||||
Key? key,
|
||||
required Message message,
|
||||
required Attachment attachment,
|
||||
@@ -157,7 +163,7 @@ class FileAttachment extends AttachmentWidget {
|
||||
type: MaterialType.transparency,
|
||||
shape: _getDefaultShape(context),
|
||||
child: source.when(
|
||||
local: () => VideoThumbnailImage(
|
||||
local: () => StreamVideoThumbnailImage(
|
||||
fit: BoxFit.cover,
|
||||
video: attachment.file!.path!,
|
||||
placeholderBuilder: (_) => const Center(
|
||||
@@ -168,7 +174,7 @@ class FileAttachment extends AttachmentWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
network: () => VideoThumbnailImage(
|
||||
network: () => StreamVideoThumbnailImage(
|
||||
fit: BoxFit.cover,
|
||||
video: attachment.assetUrl!,
|
||||
placeholderBuilder: (_) => const Center(
|
||||
@@ -278,7 +284,7 @@ class FileAttachment extends AttachmentWidget {
|
||||
);
|
||||
return attachment.uploadState.when(
|
||||
preparing: () => Text(fileSize(size), style: textStyle),
|
||||
inProgress: (sent, total) => UploadProgressIndicator(
|
||||
inProgress: (sent, total) => StreamUploadProgressIndicator(
|
||||
uploaded: sent,
|
||||
total: total,
|
||||
showBackground: false,
|
||||
|
||||
@@ -5,10 +5,16 @@ import 'package:stream_chat_flutter/src/attachment/attachment_widget.dart';
|
||||
import 'package:stream_chat_flutter/src/extension.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
|
||||
/// {@macro giphy_attachment}
|
||||
@Deprecated("Use 'StreamGiphyAttachment' instead")
|
||||
typedef GiphyAttachment = StreamGiphyAttachment;
|
||||
|
||||
/// {@template giphy_attachment}
|
||||
/// Widget for showing a GIF attachment
|
||||
class GiphyAttachment extends AttachmentWidget {
|
||||
/// Constructor for creating a [GiphyAttachment] widget
|
||||
const GiphyAttachment({
|
||||
/// {@endtemplate}
|
||||
class StreamGiphyAttachment extends StreamAttachmentWidget {
|
||||
/// Constructor for creating a [StreamGiphyAttachment] widget
|
||||
const StreamGiphyAttachment({
|
||||
Key? key,
|
||||
required Message message,
|
||||
required Attachment attachment,
|
||||
@@ -228,7 +234,7 @@ class GiphyAttachment extends AttachmentWidget {
|
||||
alignment: Alignment.centerRight,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: VisibleFootnote(),
|
||||
child: StreamVisibleFootnote(),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -243,7 +249,7 @@ class GiphyAttachment extends AttachmentWidget {
|
||||
final channel = StreamChannel.of(context).channel;
|
||||
return StreamChannel(
|
||||
channel: channel,
|
||||
child: FullScreenMedia(
|
||||
child: StreamFullScreenMedia(
|
||||
mediaAttachments: message.attachments,
|
||||
startIndex: message.attachments.indexOf(attachment),
|
||||
userName: message.user?.name,
|
||||
|
||||
@@ -5,10 +5,16 @@ import 'package:stream_chat_flutter/src/attachment/attachment_title.dart';
|
||||
import 'package:stream_chat_flutter/src/attachment/attachment_widget.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
|
||||
/// {@macro image_attachment}
|
||||
@Deprecated("use 'StreamImageAttachment' instead")
|
||||
typedef ImageAttachment = StreamImageAttachment;
|
||||
|
||||
/// {@template image_attachment}
|
||||
/// Widget for showing an image attachment
|
||||
class ImageAttachment extends AttachmentWidget {
|
||||
/// Constructor for creating a [ImageAttachment] widget
|
||||
const ImageAttachment({
|
||||
/// {@endtemplate}
|
||||
class StreamImageAttachment extends StreamAttachmentWidget {
|
||||
/// Constructor for creating a [StreamImageAttachment] widget
|
||||
const StreamImageAttachment({
|
||||
Key? key,
|
||||
required Message message,
|
||||
required Attachment attachment,
|
||||
@@ -25,8 +31,8 @@ class ImageAttachment extends AttachmentWidget {
|
||||
size: size,
|
||||
);
|
||||
|
||||
/// [MessageThemeData] for showing image title
|
||||
final MessageThemeData messageTheme;
|
||||
/// [StreamMessageThemeData] for showing image title
|
||||
final StreamMessageThemeData messageTheme;
|
||||
|
||||
/// Flag for showing title
|
||||
final bool showTitle;
|
||||
@@ -137,7 +143,7 @@ class ImageAttachment extends AttachmentWidget {
|
||||
StreamChannel.of(context).channel;
|
||||
return StreamChannel(
|
||||
channel: channel,
|
||||
child: FullScreenMedia(
|
||||
child: StreamFullScreenMedia(
|
||||
mediaAttachments: message.attachments,
|
||||
startIndex:
|
||||
message.attachments.indexOf(attachment),
|
||||
@@ -155,7 +161,7 @@ class ImageAttachment extends AttachmentWidget {
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: AttachmentUploadStateBuilder(
|
||||
child: StreamAttachmentUploadStateBuilder(
|
||||
message: message,
|
||||
attachment: attachment,
|
||||
),
|
||||
@@ -166,7 +172,7 @@ class ImageAttachment extends AttachmentWidget {
|
||||
if (showTitle && attachment.title != null)
|
||||
Material(
|
||||
color: messageTheme.messageBackgroundColor,
|
||||
child: AttachmentTitle(
|
||||
child: StreamAttachmentTitle(
|
||||
messageTheme: messageTheme,
|
||||
attachment: attachment,
|
||||
),
|
||||
|
||||
@@ -2,10 +2,16 @@ import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
|
||||
/// {@macro url_attachment}
|
||||
@Deprecated("Use 'StreamUrlAttachment' instead")
|
||||
typedef UrlAttachment = StreamUrlAttachment;
|
||||
|
||||
/// {@template url_attachment}
|
||||
/// Widget to display URL attachment
|
||||
class UrlAttachment extends StatelessWidget {
|
||||
/// Constructor for creating a [UrlAttachment]
|
||||
const UrlAttachment({
|
||||
/// {@endtemplate}
|
||||
class StreamUrlAttachment extends StatelessWidget {
|
||||
/// Constructor for creating a [StreamUrlAttachment]
|
||||
const StreamUrlAttachment({
|
||||
Key? key,
|
||||
required this.urlAttachment,
|
||||
required this.hostDisplayName,
|
||||
@@ -25,8 +31,8 @@ class UrlAttachment extends StatelessWidget {
|
||||
/// Padding for text
|
||||
final EdgeInsets textPadding;
|
||||
|
||||
/// [MessageThemeData] for showing image title
|
||||
final MessageThemeData messageTheme;
|
||||
/// [StreamMessageThemeData] for showing image title
|
||||
final StreamMessageThemeData messageTheme;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -4,10 +4,16 @@ import 'package:stream_chat_flutter/src/attachment/attachment_widget.dart';
|
||||
import 'package:stream_chat_flutter/src/video_thumbnail_image.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
|
||||
/// {@macro video_attachment}
|
||||
@Deprecated("Use 'StreamVideoAttachment' instead")
|
||||
typedef VideoAttachment = StreamVideoAttachment;
|
||||
|
||||
/// {@template video_attachment}
|
||||
/// Widget for showing a video attachment
|
||||
class VideoAttachment extends AttachmentWidget {
|
||||
/// Constructor for creating a [VideoAttachment] widget
|
||||
const VideoAttachment({
|
||||
/// {@endtemplate}
|
||||
class StreamVideoAttachment extends StreamAttachmentWidget {
|
||||
/// Constructor for creating a [StreamVideoAttachment] widget
|
||||
const StreamVideoAttachment({
|
||||
Key? key,
|
||||
required Message message,
|
||||
required Attachment attachment,
|
||||
@@ -23,8 +29,8 @@ class VideoAttachment extends AttachmentWidget {
|
||||
size: size,
|
||||
);
|
||||
|
||||
/// [MessageThemeData] for showing title
|
||||
final MessageThemeData messageTheme;
|
||||
/// [StreamMessageThemeData] for showing title
|
||||
final StreamMessageThemeData messageTheme;
|
||||
|
||||
/// Callback when show message is tapped
|
||||
final ShowMessageCallback? onShowMessage;
|
||||
@@ -43,7 +49,7 @@ class VideoAttachment extends AttachmentWidget {
|
||||
}
|
||||
return _buildVideoAttachment(
|
||||
context,
|
||||
VideoThumbnailImage(
|
||||
StreamVideoThumbnailImage(
|
||||
video: attachment.file!.path!,
|
||||
height: size?.height,
|
||||
width: size?.width,
|
||||
@@ -58,7 +64,7 @@ class VideoAttachment extends AttachmentWidget {
|
||||
}
|
||||
return _buildVideoAttachment(
|
||||
context,
|
||||
VideoThumbnailImage(
|
||||
StreamVideoThumbnailImage(
|
||||
video: attachment.assetUrl!,
|
||||
height: size?.height,
|
||||
width: size?.width,
|
||||
@@ -84,7 +90,7 @@ class VideoAttachment extends AttachmentWidget {
|
||||
MaterialPageRoute(
|
||||
builder: (_) => StreamChannel(
|
||||
channel: channel,
|
||||
child: FullScreenMedia(
|
||||
child: StreamFullScreenMedia(
|
||||
mediaAttachments: message.attachments,
|
||||
startIndex:
|
||||
message.attachments.indexOf(attachment),
|
||||
@@ -111,7 +117,7 @@ class VideoAttachment extends AttachmentWidget {
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: AttachmentUploadStateBuilder(
|
||||
child: StreamAttachmentUploadStateBuilder(
|
||||
message: message,
|
||||
attachment: attachment,
|
||||
),
|
||||
@@ -123,7 +129,7 @@ class VideoAttachment extends AttachmentWidget {
|
||||
if (attachment.title != null)
|
||||
Material(
|
||||
color: messageTheme.messageBackgroundColor,
|
||||
child: AttachmentTitle(
|
||||
child: StreamAttachmentTitle(
|
||||
messageTheme: messageTheme,
|
||||
attachment: attachment,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user