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
@@ -87,7 +87,7 @@ class MyApp extends StatelessWidget {
/// A list of messages sent in the current channel.
///
/// This is implemented using [MessageListView], a widget that provides query
/// This is implemented using [StreamMessageListView], a widget that provides query
/// functionalities fetching the messages from the api and showing them in a
/// listView.
class ChannelPage extends StatelessWidget {
@@ -98,13 +98,13 @@ class ChannelPage extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
appBar: const ChannelHeader(),
appBar: const StreamChannelHeader(),
body: Column(
children: const <Widget>[
Expanded(
child: MessageListView(),
child: StreamMessageListView(),
),
MessageInput(attachmentLimit: 3),
StreamMessageInput(attachmentLimit: 3),
],
),
);
@@ -125,15 +125,15 @@ class ChannelPage extends StatelessWidget {
Widget build(BuildContext context) => Navigator(
onGenerateRoute: (settings) => MaterialPageRoute(
builder: (context) => Scaffold(
appBar: const ChannelHeader(
appBar: const StreamChannelHeader(
showBackButton: false,
),
body: Column(
children: const <Widget>[
Expanded(
child: MessageListView(),
child: StreamMessageListView(),
),
MessageInput(),
StreamMessageInput(),
],
),
),
@@ -27,7 +27,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
/// - We make [StreamChat] the root Widget of our application
///
/// - We create a single [ChannelPage] widget under [StreamChat] with three
/// widgets: [ChannelHeader], [MessageListView] and [MessageInput]
/// widgets: [StreamChannelHeader], [StreamMessageListView] and [StreamMessageInput]
///
/// If you now run the simulator you will see a single channel UI.
void main() async {
@@ -91,13 +91,13 @@ class ChannelPage extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
appBar: const ChannelHeader(),
appBar: const StreamChannelHeader(),
body: Column(
children: const <Widget>[
Expanded(
child: MessageListView(),
child: StreamMessageListView(),
),
MessageInput(),
StreamMessageInput(),
],
),
);
@@ -25,7 +25,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
/// The [ChannelListPage] widget retrieves the list of channels based on a
/// custom query and ordering. In this case we are showing the list of
/// channels in which the current user is a member and we order them based
/// on the time they had a new message. [ChannelListView] handles pagination
/// on the time they had a new message. [StreamChannelListView] handles pagination
/// and updates automatically when new channels are created or when a new
/// message is added to a channel.
void main() async {
@@ -118,13 +118,13 @@ class ChannelPage extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
appBar: const ChannelHeader(),
appBar: const StreamChannelHeader(),
body: Column(
children: const <Widget>[
Expanded(
child: MessageListView(),
child: StreamMessageListView(),
),
MessageInput(),
StreamMessageInput(),
],
),
);
@@ -15,8 +15,8 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
/// We start by changing how channel previews are shown in the channel list
/// and include the number of unread messages for each.
///
/// We're passing a custom widget to [ChannelListView.channelPreviewBuilder];
/// this will override the default [ChannelPreview] and allows you to create
/// We're passing a custom widget to [StreamChannelListView.channelPreviewBuilder];
/// this will override the default [StreamChannelPreview] and allows you to create
/// one yourself.
///
/// There are a couple interesting things we do in this widget:
@@ -134,7 +134,7 @@ class _ChannelListPageState extends State<ChannelListPage> {
channel: channel,
),
title: StreamChannelName(
textStyle: ChannelPreviewTheme.of(context).titleStyle!.copyWith(
textStyle: StreamChannelPreviewTheme.of(context).titleStyle!.copyWith(
color: StreamChatTheme.of(context)
.colorTheme
.textHighEmphasis
@@ -162,13 +162,13 @@ class ChannelPage extends StatelessWidget {
// ignore: prefer_expression_function_bodies
Widget build(BuildContext context) {
return Scaffold(
appBar: const ChannelHeader(),
appBar: const StreamChannelHeader(),
body: Column(
children: const <Widget>[
Expanded(
child: MessageListView(),
child: StreamMessageListView(),
),
MessageInput(),
StreamMessageInput(),
],
),
);
@@ -8,8 +8,8 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
/// to create sub-conversations inside the same channel.
///
/// Using threaded conversations is very simple and mostly a matter of
/// plugging the [MessageListView] to another widget that renders the widget.
/// To make this simple, such a widget only needs to build [MessageListView]
/// plugging the [StreamMessageListView] to another widget that renders the widget.
/// To make this simple, such a widget only needs to build [StreamMessageListView]
/// with the parent attribute set to the threads root message.
///
/// Now we can open threads and create new ones as well. If you long-press a
@@ -98,17 +98,17 @@ class ChannelPage extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
appBar: const ChannelHeader(),
appBar: const StreamChannelHeader(),
body: Column(
children: <Widget>[
Expanded(
child: MessageListView(
child: StreamMessageListView(
threadBuilder: (_, parentMessage) => ThreadPage(
parent: parentMessage,
),
),
),
const MessageInput(),
const StreamMessageInput(),
],
),
);
@@ -126,17 +126,17 @@ class ThreadPage extends StatelessWidget {
// ignore: prefer_expression_function_bodies
Widget build(BuildContext context) {
return Scaffold(
appBar: ThreadHeader(
appBar: StreamThreadHeader(
parent: parent!,
),
body: Column(
children: <Widget>[
Expanded(
child: MessageListView(
child: StreamMessageListView(
parentMessage: parent,
),
),
MessageInput(
StreamMessageInput(
messageInputController: MessageInputController(
message: Message(parentId: parent!.id),
),
@@ -8,7 +8,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
/// the SDK supports easily.
///
/// Replacing the built-in message component with your own is done by passing
/// it as a builder function to the [MessageListView] widget.
/// it as a builder function to the [StreamMessageListView] widget.
///
/// The message builder function will get the usual [BuildContext] argument
/// as well as the [Message] object and its position inside the list.
@@ -106,15 +106,15 @@ class ChannelPage extends StatelessWidget {
// ignore: prefer_expression_function_bodies
Widget build(BuildContext context) {
return Scaffold(
appBar: const ChannelHeader(),
appBar: const StreamChannelHeader(),
body: Column(
children: <Widget>[
Expanded(
child: MessageListView(
child: StreamMessageListView(
messageBuilder: _messageBuilder,
),
),
const MessageInput(),
const StreamMessageInput(),
],
),
);
@@ -124,7 +124,7 @@ class ChannelPage extends StatelessWidget {
BuildContext context,
MessageDetails details,
List<Message> messages,
MessageWidget _,
StreamMessageWidget _,
) {
final message = details.message;
final isCurrentUser =
@@ -58,24 +58,24 @@ class MyApp extends StatelessWidget {
final defaultTheme = StreamChatThemeData.fromTheme(themeData);
final colorTheme = defaultTheme.colorTheme;
final customTheme = defaultTheme.merge(StreamChatThemeData(
channelPreviewTheme: ChannelPreviewThemeData(
avatarTheme: AvatarThemeData(
channelPreviewTheme: StreamChannelPreviewThemeData(
avatarTheme: StreamAvatarThemeData(
borderRadius: BorderRadius.circular(8),
),
),
messageListViewTheme: const MessageListViewThemeData(
messageListViewTheme: const StreamMessageListViewThemeData(
backgroundColor: Colors.grey,
backgroundImage: DecorationImage(
image: AssetImage('assets/background_doodle.png'),
fit: BoxFit.cover,
),
),
otherMessageTheme: MessageThemeData(
otherMessageTheme: StreamMessageThemeData(
messageBackgroundColor: colorTheme.textHighEmphasis,
messageTextStyle: TextStyle(
color: colorTheme.barsBg,
),
avatarTheme: AvatarThemeData(
avatarTheme: StreamAvatarThemeData(
borderRadius: BorderRadius.circular(8),
),
),
@@ -137,17 +137,17 @@ class ChannelPage extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
appBar: const ChannelHeader(),
appBar: const StreamChannelHeader(),
body: Column(
children: <Widget>[
Expanded(
child: MessageListView(
child: StreamMessageListView(
threadBuilder: (_, parentMessage) => ThreadPage(
parent: parentMessage,
),
),
),
const MessageInput(),
const StreamMessageInput(),
],
),
);
@@ -165,17 +165,17 @@ class ThreadPage extends StatelessWidget {
// ignore: prefer_expression_function_bodies
Widget build(BuildContext context) {
return Scaffold(
appBar: ThreadHeader(
appBar: StreamThreadHeader(
parent: parent!,
),
body: Column(
children: <Widget>[
Expanded(
child: MessageListView(
child: StreamMessageListView(
parentMessage: parent,
),
),
MessageInput(
StreamMessageInput(
messageInputController: MessageInputController(
message: Message(parentId: parent!.id),
),