Merge branch 'release/4.0' into migrate/deprecated_code_full_screen
This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
import 'package:collection/collection.dart' show IterableExtension;
|
import 'package:collection/collection.dart' show IterableExtension;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:jiffy/jiffy.dart';
|
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
|
||||||
|
|
||||||
/*Navigator.push(
|
/*Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:imessage/message_list_view.dart';
|
import 'package:imessage/message_list_view.dart';
|
||||||
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'
|
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'
|
||||||
show
|
show
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:example/search_text_field.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
|
|
||||||
import 'channel_page.dart';
|
import 'channel_page.dart';
|
||||||
import 'chat_info_screen.dart';
|
import 'chat_info_screen.dart';
|
||||||
@@ -39,6 +40,16 @@ class _ChannelList extends State<ChannelList> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
late final _channelListController = StreamChannelListController(
|
||||||
|
client: StreamChat.of(context).client,
|
||||||
|
filter: Filter.in_(
|
||||||
|
'members',
|
||||||
|
[StreamChat.of(context).currentUser!.id],
|
||||||
|
),
|
||||||
|
presence: true,
|
||||||
|
limit: 30,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -149,59 +160,141 @@ class _ChannelList extends State<ChannelList> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
: ChannelListView(
|
: SlidableAutoCloseBehavior(
|
||||||
onChannelTap: (channel, _) {
|
closeWhenOpened: true,
|
||||||
Navigator.pushNamed(
|
child: RefreshIndicator(
|
||||||
context,
|
onRefresh: _channelListController.refresh,
|
||||||
Routes.CHANNEL_PAGE,
|
child: StreamChannelListView(
|
||||||
arguments: ChannelPageArgs(
|
controller: _channelListController,
|
||||||
channel: channel,
|
itemBuilder: (context, channel, tile) {
|
||||||
),
|
final chatTheme = StreamChatTheme.of(context);
|
||||||
);
|
final backgroundColor = chatTheme.colorTheme.inputBg;
|
||||||
},
|
final canDeleteChannel = channel.ownCapabilities
|
||||||
onStartChatPressed: () {
|
.contains(PermissionType.deleteChannel);
|
||||||
Navigator.pushNamed(context, Routes.NEW_CHAT);
|
return Slidable(
|
||||||
},
|
groupTag: 'channels-actions',
|
||||||
swipeToAction: true,
|
endActionPane: ActionPane(
|
||||||
filter: Filter.in_('members', [user!.id]),
|
extentRatio: canDeleteChannel ? 0.40 : 0.20,
|
||||||
presence: true,
|
motion: const BehindMotion(),
|
||||||
limit: 30,
|
children: [
|
||||||
onViewInfoTap: (channel) {
|
CustomSlidableAction(
|
||||||
Navigator.pop(context);
|
child: Icon(Icons.more_horiz),
|
||||||
if (channel.memberCount == 2 && channel.isDistinct) {
|
backgroundColor: backgroundColor,
|
||||||
Navigator.push(
|
onPressed: (_) {
|
||||||
context,
|
showChannelInfoModalBottomSheet(
|
||||||
MaterialPageRoute(
|
context: context,
|
||||||
builder: (context) => StreamChannel(
|
channel: channel,
|
||||||
|
onViewInfoTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) {
|
||||||
|
final isOneToOne =
|
||||||
|
channel.memberCount == 2 &&
|
||||||
|
channel.isDistinct;
|
||||||
|
return StreamChannel(
|
||||||
|
channel: channel,
|
||||||
|
child: isOneToOne
|
||||||
|
? ChatInfoScreen(
|
||||||
|
messageTheme: chatTheme
|
||||||
|
.ownMessageTheme,
|
||||||
|
user: channel
|
||||||
|
.state!.members
|
||||||
|
.where((m) =>
|
||||||
|
m.userId !=
|
||||||
|
channel
|
||||||
|
.client
|
||||||
|
.state
|
||||||
|
.currentUser!
|
||||||
|
.id)
|
||||||
|
.first
|
||||||
|
.user,
|
||||||
|
)
|
||||||
|
: GroupInfoScreen(
|
||||||
|
messageTheme: chatTheme
|
||||||
|
.ownMessageTheme,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (canDeleteChannel)
|
||||||
|
CustomSlidableAction(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
child: StreamSvgIcon.delete(
|
||||||
|
color: chatTheme.colorTheme.accentError,
|
||||||
|
),
|
||||||
|
onPressed: (_) async {
|
||||||
|
final res = await showConfirmationDialog(
|
||||||
|
context,
|
||||||
|
title: 'Delete Conversation',
|
||||||
|
question:
|
||||||
|
'Are you sure you want to delete this conversation?',
|
||||||
|
okText: 'Delete',
|
||||||
|
cancelText: 'Cancel',
|
||||||
|
icon: StreamSvgIcon.delete(
|
||||||
|
color: chatTheme.colorTheme.accentError,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (res == true) {
|
||||||
|
await _channelListController
|
||||||
|
.deleteChannel(channel);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: tile,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
onChannelTap: (channel) {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context,
|
||||||
|
Routes.CHANNEL_PAGE,
|
||||||
|
arguments: ChannelPageArgs(
|
||||||
channel: channel,
|
channel: channel,
|
||||||
child: ChatInfoScreen(
|
),
|
||||||
messageTheme:
|
);
|
||||||
StreamChatTheme.of(context).ownMessageTheme,
|
},
|
||||||
user: channel.state!.members
|
emptyBuilder: (_) {
|
||||||
.where((m) =>
|
return Center(
|
||||||
m.userId !=
|
child: Padding(
|
||||||
channel.client.state.currentUser!.id)
|
padding: EdgeInsets.all(8),
|
||||||
.first
|
child: Column(
|
||||||
.user,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Expanded(child: StreamChannelListEmptyWidget()),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context,
|
||||||
|
Routes.NEW_CHAT,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Start a chat',
|
||||||
|
style: StreamChatTheme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.bodyBold
|
||||||
|
.copyWith(
|
||||||
|
color: StreamChatTheme.of(context)
|
||||||
|
.colorTheme
|
||||||
|
.accentPrimary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
} else {
|
),
|
||||||
Navigator.push(
|
),
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => StreamChannel(
|
|
||||||
channel: channel,
|
|
||||||
child: GroupInfoScreen(
|
|
||||||
messageTheme:
|
|
||||||
StreamChatTheme.of(context).ownMessageTheme,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -100,10 +100,8 @@ class _ChannelListPageState extends State<ChannelListPage> {
|
|||||||
body: IndexedStack(
|
body: IndexedStack(
|
||||||
index: _currentIndex,
|
index: _currentIndex,
|
||||||
children: [
|
children: [
|
||||||
ChannelsBloc(
|
MessageSearchBloc(
|
||||||
child: MessageSearchBloc(
|
child: ChannelList(),
|
||||||
child: ChannelList(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
UserMentionsPage(),
|
UserMentionsPage(),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:collection/collection.dart' show IterableExtension;
|
|
||||||
import 'package:example/localizations.dart';
|
import 'package:example/localizations.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -53,13 +52,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
|
|||||||
height: 8.0,
|
height: 8.0,
|
||||||
color: StreamChatTheme.of(context).colorTheme.disabled,
|
color: StreamChatTheme.of(context).colorTheme.disabled,
|
||||||
),
|
),
|
||||||
if ([
|
if (channel.ownCapabilities.contains(PermissionType.deleteChannel))
|
||||||
'admin',
|
|
||||||
'owner',
|
|
||||||
].contains(channel.state!.members
|
|
||||||
.firstWhereOrNull(
|
|
||||||
(m) => m.userId == channel.client.state.currentUser!.id)
|
|
||||||
?.role))
|
|
||||||
_buildDeleteListTile(),
|
_buildDeleteListTile(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -13,20 +13,20 @@ dependencies:
|
|||||||
stream_chat_flutter:
|
stream_chat_flutter:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/GetStream/stream-chat-flutter.git
|
url: https://github.com/GetStream/stream-chat-flutter.git
|
||||||
ref: develop
|
ref: v4
|
||||||
path: packages/stream_chat_flutter
|
path: packages/stream_chat_flutter
|
||||||
stream_chat_persistence:
|
stream_chat_persistence:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/GetStream/stream-chat-flutter.git
|
url: https://github.com/GetStream/stream-chat-flutter.git
|
||||||
ref: develop
|
ref: v4
|
||||||
path: packages/stream_chat_persistence
|
path: packages/stream_chat_persistence
|
||||||
stream_chat_localizations:
|
stream_chat_localizations:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/GetStream/stream-chat-flutter.git
|
url: https://github.com/GetStream/stream-chat-flutter.git
|
||||||
ref: feat/capabilities
|
ref: v4
|
||||||
path: packages/stream_chat_localizations
|
path: packages/stream_chat_localizations
|
||||||
flutter_local_notifications: ^9.0.0
|
flutter_local_notifications: ^9.0.0
|
||||||
flutter_svg:
|
flutter_svg: ^1.0.1
|
||||||
flutter_secure_storage: ^4.2.1
|
flutter_secure_storage: ^4.2.1
|
||||||
yaml: ^3.1.0
|
yaml: ^3.1.0
|
||||||
uuid: ^3.0.5
|
uuid: ^3.0.5
|
||||||
@@ -42,17 +42,17 @@ dependency_overrides:
|
|||||||
stream_chat:
|
stream_chat:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/GetStream/stream-chat-flutter.git
|
url: https://github.com/GetStream/stream-chat-flutter.git
|
||||||
ref: 5587622587e1fb31e1935d4209189db0434ef09b
|
ref: v4
|
||||||
path: packages/stream_chat
|
path: packages/stream_chat
|
||||||
stream_chat_flutter_core:
|
stream_chat_flutter_core:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/GetStream/stream-chat-flutter.git
|
url: https://github.com/GetStream/stream-chat-flutter.git
|
||||||
ref: 5587622587e1fb31e1935d4209189db0434ef09b
|
ref: v4
|
||||||
path: packages/stream_chat_flutter_core
|
path: packages/stream_chat_flutter_core
|
||||||
stream_chat_flutter:
|
stream_chat_flutter:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/GetStream/stream-chat-flutter.git
|
url: https://github.com/GetStream/stream-chat-flutter.git
|
||||||
ref: 5587622587e1fb31e1935d4209189db0434ef09b
|
ref: v4
|
||||||
path: packages/stream_chat_flutter
|
path: packages/stream_chat_flutter
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
|
|||||||
Reference in New Issue
Block a user