refactor(ui, core): Deprecate v3

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2022-03-10 14:12:01 +05:30
committed by xsahil03x
parent 55b87295ab
commit a7e3839256
128 changed files with 3891 additions and 1362 deletions
@@ -4,6 +4,11 @@ import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/src/extension.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
/// {@macro channel_preview}
@Deprecated("Use 'StreamChannelPreview' instead")
typedef ChannelPreview = StreamChannelPreview;
/// {@template channel_preview}
/// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/packages/stream_chat_flutter/screenshots/channel_preview.png)
/// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/packages/stream_chat_flutter/screenshots/channel_preview_paint.png)
///
@@ -13,14 +18,15 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
/// image as soon as it updates.
///
/// Usually you don't use this widget as it's the default channel preview
/// used by [ChannelListView].
/// used by [StreamChannelListView].
///
/// The widget renders the ui based on the first ancestor of type
/// [StreamChatTheme].
/// Modify it to change the widget appearance.
class ChannelPreview extends StatelessWidget {
/// Constructor for creating [ChannelPreview]
const ChannelPreview({
/// {@endtemplate}
class StreamChannelPreview extends StatelessWidget {
/// Constructor for creating [StreamChannelPreview]
const StreamChannelPreview({
required this.channel,
Key? key,
this.onTap,
@@ -52,7 +58,7 @@ class ChannelPreview extends StatelessWidget {
final Widget? subtitle;
/// Widget rendering the leading element, by default
/// it shows the [ChannelAvatar]
/// it shows the [StreamChannelAvatar]
final Widget? leading;
/// Widget rendering the trailing element,
@@ -60,12 +66,12 @@ class ChannelPreview extends StatelessWidget {
final Widget? trailing;
/// Widget rendering the sending indicator,
/// by default it uses the [SendingIndicator] widget
/// by default it uses the [StreamSendingIndicator] widget
final Widget? sendingIndicator;
@override
Widget build(BuildContext context) {
final channelPreviewTheme = ChannelPreviewTheme.of(context);
final channelPreviewTheme = StreamChannelPreviewTheme.of(context);
final streamChatState = StreamChat.of(context);
return BetterStreamBuilder<bool>(
stream: channel.isMutedStream,
@@ -80,13 +86,18 @@ class ChannelPreview extends StatelessWidget {
),
onTap: () => onTap?.call(channel),
onLongPress: () => onLongPress?.call(channel),
leading: leading ?? ChannelAvatar(onTap: onImageTap),
leading: leading ??
StreamChannelAvatar(
channel: channel,
onTap: onImageTap,
),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Flexible(
child: title ??
ChannelName(
StreamChannelName(
channel: channel,
textStyle: channelPreviewTheme.titleStyle,
),
),
@@ -100,7 +111,7 @@ class ChannelPreview extends StatelessWidget {
e.user!.id == channel.client.state.currentUser?.id)) {
return const SizedBox();
}
return UnreadIndicator(
return StreamUnreadIndicator(
cid: channel.cid,
);
},
@@ -136,7 +147,7 @@ class ChannelPreview extends StatelessWidget {
)));
final isMessageRead = readList.length >=
(channel.memberCount ?? 0) - 1;
return SendingIndicator(
return StreamSendingIndicator(
message: lastMessage!,
size: channelPreviewTheme.indicatorIconSize,
isMessageRead: isMessageRead,
@@ -183,13 +194,13 @@ class ChannelPreview extends StatelessWidget {
return Text(
stringDate,
style: ChannelPreviewTheme.of(context).lastMessageAtStyle,
style: StreamChannelPreviewTheme.of(context).lastMessageAtStyle,
);
},
);
Widget _buildSubtitle(BuildContext context) {
final channelPreviewTheme = ChannelPreviewTheme.of(context);
final channelPreviewTheme = StreamChannelPreviewTheme.of(context);
if (channel.isMuted) {
return Row(
crossAxisAlignment: CrossAxisAlignment.end,
@@ -204,7 +215,7 @@ class ChannelPreview extends StatelessWidget {
],
);
}
return TypingIndicator(
return StreamTypingIndicator(
channel: channel,
alternativeWidget: _buildLastMessage(context),
style: channelPreviewTheme.subtitleStyle,
@@ -242,7 +253,7 @@ class ChannelPreview extends StatelessWidget {
text = parts.join(' ');
final channelPreviewTheme = ChannelPreviewTheme.of(context);
final channelPreviewTheme = StreamChannelPreviewTheme.of(context);
return Text.rich(
_getDisplayText(
text,