2020-01-04 12:53:49 +00:00
|
|
|
import 'dart:async';
|
2020-01-01 18:10:13 +00:00
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:famedlysdk/famedlysdk.dart';
|
|
|
|
import 'package:fluffychat/components/adaptive_page_layout.dart';
|
|
|
|
import 'package:fluffychat/components/chat_settings_popup_menu.dart';
|
|
|
|
import 'package:fluffychat/components/content_banner.dart';
|
2020-02-16 10:09:28 +00:00
|
|
|
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
2020-01-01 18:10:13 +00:00
|
|
|
import 'package:fluffychat/components/list_items/participant_list_item.dart';
|
2020-01-20 12:46:39 +00:00
|
|
|
import 'package:fluffychat/i18n/i18n.dart';
|
2020-01-01 18:10:13 +00:00
|
|
|
import 'package:fluffychat/utils/app_route.dart';
|
|
|
|
import 'package:fluffychat/views/chat_list.dart';
|
|
|
|
import 'package:fluffychat/views/invitation_selection.dart';
|
2020-01-23 11:11:57 +00:00
|
|
|
import 'package:flutter/foundation.dart';
|
2020-01-01 18:10:13 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2020-01-19 18:28:12 +00:00
|
|
|
import 'package:flutter/services.dart';
|
2020-04-12 07:19:22 +00:00
|
|
|
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
2020-01-01 18:10:13 +00:00
|
|
|
import 'package:image_picker/image_picker.dart';
|
2020-01-17 11:06:03 +00:00
|
|
|
import 'package:link_text/link_text.dart';
|
2020-01-01 18:10:13 +00:00
|
|
|
|
|
|
|
class ChatDetails extends StatefulWidget {
|
|
|
|
final Room room;
|
|
|
|
|
|
|
|
const ChatDetails(this.room);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_ChatDetailsState createState() => _ChatDetailsState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
List<User> members;
|
2020-02-16 10:09:28 +00:00
|
|
|
void setDisplaynameAction(BuildContext context) async {
|
|
|
|
final String displayname = await SimpleDialogs(context).enterText(
|
|
|
|
titleText: I18n.of(context).changeTheNameOfTheGroup,
|
|
|
|
labelText: I18n.of(context).changeTheNameOfTheGroup,
|
2020-05-05 12:55:19 +00:00
|
|
|
hintText: widget.room.getLocalizedDisplayname(I18n.of(context)),
|
2020-02-16 10:09:28 +00:00
|
|
|
);
|
|
|
|
if (displayname == null) return;
|
2020-04-27 11:36:39 +00:00
|
|
|
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
2020-01-01 18:10:13 +00:00
|
|
|
widget.room.setName(displayname),
|
|
|
|
);
|
2020-01-04 12:53:49 +00:00
|
|
|
if (success != false) {
|
2020-04-12 07:19:22 +00:00
|
|
|
showToast(I18n.of(context).displaynameHasBeenChanged);
|
2020-01-01 18:10:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-16 10:09:28 +00:00
|
|
|
void setCanonicalAliasAction(context) async {
|
|
|
|
final String s = await SimpleDialogs(context).enterText(
|
|
|
|
titleText: I18n.of(context).setInvitationLink,
|
|
|
|
labelText: I18n.of(context).setInvitationLink,
|
|
|
|
hintText: I18n.of(context).alias.toLowerCase(),
|
|
|
|
prefixText: "#",
|
2020-02-16 10:36:18 +00:00
|
|
|
suffixText: ":" + widget.room.client.userID.domain,
|
2020-02-16 10:09:28 +00:00
|
|
|
);
|
|
|
|
if (s == null) return;
|
2020-02-10 12:05:11 +00:00
|
|
|
final String domain = widget.room.client.userID.domain;
|
2020-01-19 14:07:42 +00:00
|
|
|
final String canonicalAlias = "%23" + s + "%3A" + domain;
|
|
|
|
final Event aliasEvent = widget.room.getState("m.room.aliases", domain);
|
|
|
|
final List aliases =
|
|
|
|
aliasEvent != null ? aliasEvent.content["aliases"] ?? [] : [];
|
|
|
|
if (aliases.indexWhere((s) => s == canonicalAlias) == -1) {
|
|
|
|
List<String> newAliases = List.from(aliases);
|
|
|
|
newAliases.add(canonicalAlias);
|
2020-04-27 11:36:39 +00:00
|
|
|
final response = await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
2020-01-19 14:07:42 +00:00
|
|
|
widget.room.client.jsonRequest(
|
|
|
|
type: HTTPType.GET,
|
|
|
|
action: "/client/r0/directory/room/$canonicalAlias",
|
|
|
|
),
|
|
|
|
);
|
|
|
|
if (response == false) {
|
2020-04-27 11:36:39 +00:00
|
|
|
final success =
|
|
|
|
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
2020-01-19 14:07:42 +00:00
|
|
|
widget.room.client.jsonRequest(
|
|
|
|
type: HTTPType.PUT,
|
|
|
|
action: "/client/r0/directory/room/$canonicalAlias",
|
|
|
|
data: {"room_id": widget.room.id}),
|
|
|
|
);
|
|
|
|
if (success == false) return;
|
|
|
|
}
|
|
|
|
}
|
2020-04-27 11:36:39 +00:00
|
|
|
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
2020-01-19 14:07:42 +00:00
|
|
|
widget.room.client.jsonRequest(
|
|
|
|
type: HTTPType.PUT,
|
|
|
|
action:
|
|
|
|
"/client/r0/rooms/${widget.room.id}/state/m.room.canonical_alias",
|
|
|
|
data: {"alias": "#$s:$domain"}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-02-16 10:09:28 +00:00
|
|
|
void setTopicAction(BuildContext context) async {
|
|
|
|
final String displayname = await SimpleDialogs(context).enterText(
|
|
|
|
titleText: I18n.of(context).setGroupDescription,
|
|
|
|
labelText: I18n.of(context).setGroupDescription,
|
|
|
|
hintText: (widget.room.topic?.isNotEmpty ?? false)
|
|
|
|
? widget.room.topic
|
|
|
|
: I18n.of(context).addGroupDescription,
|
|
|
|
multiLine: true,
|
|
|
|
);
|
|
|
|
if (displayname == null) return;
|
2020-04-27 11:36:39 +00:00
|
|
|
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
2020-01-17 11:06:03 +00:00
|
|
|
widget.room.setDescription(displayname),
|
|
|
|
);
|
|
|
|
if (success != false) {
|
2020-04-12 07:19:22 +00:00
|
|
|
showToast(I18n.of(context).groupDescriptionHasBeenChanged);
|
2020-01-17 11:06:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-01 18:10:13 +00:00
|
|
|
void setAvatarAction(BuildContext context) async {
|
|
|
|
final File tempFile = await ImagePicker.pickImage(
|
|
|
|
source: ImageSource.gallery,
|
|
|
|
imageQuality: 50,
|
|
|
|
maxWidth: 1600,
|
|
|
|
maxHeight: 1600);
|
|
|
|
if (tempFile == null) return;
|
2020-04-27 11:36:39 +00:00
|
|
|
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
2020-01-01 18:10:13 +00:00
|
|
|
widget.room.setAvatar(
|
|
|
|
MatrixFile(
|
|
|
|
bytes: await tempFile.readAsBytes(),
|
|
|
|
path: tempFile.path,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
2020-01-04 12:53:49 +00:00
|
|
|
if (success != false) {
|
2020-04-12 07:19:22 +00:00
|
|
|
showToast(I18n.of(context).avatarHasBeenChanged);
|
2020-01-01 18:10:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void requestMoreMembersAction(BuildContext context) async {
|
2020-04-27 11:36:39 +00:00
|
|
|
final List<User> participants = await SimpleDialogs(context)
|
2020-01-01 18:10:13 +00:00
|
|
|
.tryRequestWithLoadingDialog(widget.room.requestParticipants());
|
|
|
|
if (participants != null) setState(() => members = participants);
|
|
|
|
}
|
|
|
|
|
2020-01-04 12:53:49 +00:00
|
|
|
StreamSubscription onUpdate;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
onUpdate?.cancel();
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
2020-01-01 18:10:13 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2020-01-05 11:27:03 +00:00
|
|
|
if (widget.room == null) {
|
2020-01-20 12:46:39 +00:00
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
title: Text(I18n.of(context).oopsSomethingWentWrong),
|
|
|
|
),
|
|
|
|
body: Center(
|
|
|
|
child: Text(I18n.of(context).youAreNoLongerParticipatingInThisChat),
|
|
|
|
),
|
2020-01-05 11:27:03 +00:00
|
|
|
);
|
|
|
|
}
|
2020-01-01 18:10:13 +00:00
|
|
|
members ??= widget.room.getParticipants();
|
2020-04-02 11:14:39 +00:00
|
|
|
members.removeWhere((u) => u.membership == Membership.leave);
|
2020-01-01 18:10:13 +00:00
|
|
|
final int actualMembersCount =
|
|
|
|
widget.room.mInvitedMemberCount + widget.room.mJoinedMemberCount;
|
|
|
|
final bool canRequestMoreMembers = members.length < actualMembersCount;
|
2020-01-04 12:53:49 +00:00
|
|
|
this.onUpdate ??= widget.room.onUpdate.stream
|
|
|
|
.listen((id) => setState(() => members = null));
|
2020-01-01 18:10:13 +00:00
|
|
|
return AdaptivePageLayout(
|
|
|
|
primaryPage: FocusPage.SECOND,
|
|
|
|
firstScaffold: ChatList(
|
|
|
|
activeChat: widget.room.id,
|
|
|
|
),
|
|
|
|
secondScaffold: Scaffold(
|
2020-02-16 09:48:20 +00:00
|
|
|
body: NestedScrollView(
|
|
|
|
headerSliverBuilder:
|
|
|
|
(BuildContext context, bool innerBoxIsScrolled) => <Widget>[
|
|
|
|
SliverAppBar(
|
|
|
|
expandedHeight: 300.0,
|
|
|
|
floating: true,
|
|
|
|
pinned: true,
|
|
|
|
actions: <Widget>[
|
|
|
|
if (widget.room.canonicalAlias?.isNotEmpty ?? false)
|
|
|
|
IconButton(
|
|
|
|
icon: Icon(Icons.share),
|
|
|
|
onPressed: () {
|
|
|
|
Clipboard.setData(
|
|
|
|
ClipboardData(text: widget.room.canonicalAlias),
|
|
|
|
);
|
2020-04-12 07:19:22 +00:00
|
|
|
showToast(I18n.of(context).copiedToClipboard);
|
2020-02-16 09:48:20 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
ChatSettingsPopupMenu(widget.room, false)
|
|
|
|
],
|
2020-05-05 12:55:19 +00:00
|
|
|
title: Text(widget.room.getLocalizedDisplayname(I18n.of(context)),
|
2020-02-16 19:11:39 +00:00
|
|
|
style: TextStyle(
|
2020-02-16 19:28:07 +00:00
|
|
|
color:
|
|
|
|
Theme.of(context).appBarTheme.textTheme.title.color)),
|
2020-02-16 09:48:20 +00:00
|
|
|
backgroundColor: Theme.of(context).appBarTheme.color,
|
|
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
|
|
background: ContentBanner(widget.room.avatar,
|
|
|
|
onEdit: widget.room.canSendEvent("m.room.avatar") && !kIsWeb
|
|
|
|
? () => setAvatarAction(context)
|
|
|
|
: null),
|
2020-01-19 14:07:42 +00:00
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
),
|
2020-01-19 14:07:42 +00:00
|
|
|
],
|
2020-02-16 09:48:20 +00:00
|
|
|
body: ListView.builder(
|
|
|
|
itemCount: members.length + 1 + (canRequestMoreMembers ? 1 : 0),
|
|
|
|
itemBuilder: (BuildContext context, int i) => i == 0
|
|
|
|
? Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: <Widget>[
|
2020-02-16 10:09:28 +00:00
|
|
|
ListTile(
|
|
|
|
leading: widget.room.canSendEvent("m.room.topic")
|
|
|
|
? CircleAvatar(
|
2020-02-16 19:11:39 +00:00
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
2020-02-16 10:09:28 +00:00
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
child: Icon(Icons.edit),
|
|
|
|
)
|
|
|
|
: null,
|
|
|
|
title: Text("${I18n.of(context).groupDescription}:",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
fontWeight: FontWeight.bold)),
|
|
|
|
subtitle: LinkText(
|
|
|
|
text: widget.room.topic?.isEmpty ?? true
|
|
|
|
? I18n.of(context).addGroupDescription
|
|
|
|
: widget.room.topic,
|
|
|
|
linkStyle: TextStyle(color: Colors.blueAccent),
|
|
|
|
textStyle: TextStyle(
|
|
|
|
fontSize: 14,
|
2020-02-23 08:31:44 +00:00
|
|
|
color: Theme.of(context).textTheme.body1.color,
|
2020-02-16 10:09:28 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: widget.room.canSendEvent("m.room.topic")
|
|
|
|
? () => setTopicAction(context)
|
|
|
|
: null,
|
|
|
|
),
|
|
|
|
Divider(thickness: 1),
|
2020-01-19 14:07:42 +00:00
|
|
|
ListTile(
|
2020-02-16 09:48:20 +00:00
|
|
|
title: Text(
|
|
|
|
I18n.of(context).settings,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
fontWeight: FontWeight.bold,
|
2020-01-19 14:07:42 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
if (widget.room.canSendEvent("m.room.name"))
|
|
|
|
ListTile(
|
|
|
|
leading: CircleAvatar(
|
2020-02-16 19:11:39 +00:00
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
2020-02-16 09:48:20 +00:00
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
child: Icon(Icons.people),
|
|
|
|
),
|
2020-02-16 10:09:28 +00:00
|
|
|
title: Text(I18n.of(context).changeTheNameOfTheGroup),
|
2020-05-05 12:55:19 +00:00
|
|
|
subtitle: Text(widget.room
|
|
|
|
.getLocalizedDisplayname(I18n.of(context))),
|
2020-02-16 10:09:28 +00:00
|
|
|
onTap: () => setDisplaynameAction(context),
|
2020-01-19 14:07:42 +00:00
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
if (widget.room.canSendEvent("m.room.canonical_alias") &&
|
|
|
|
widget.room.joinRules == JoinRules.public)
|
|
|
|
ListTile(
|
|
|
|
leading: CircleAvatar(
|
2020-02-16 19:11:39 +00:00
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
2020-01-19 14:07:42 +00:00
|
|
|
foregroundColor: Colors.grey,
|
2020-02-16 09:48:20 +00:00
|
|
|
child: Icon(Icons.link),
|
2020-01-19 14:07:42 +00:00
|
|
|
),
|
2020-02-16 10:09:28 +00:00
|
|
|
onTap: () => setCanonicalAliasAction(context),
|
|
|
|
title: Text(I18n.of(context).setInvitationLink),
|
|
|
|
subtitle: Text(
|
|
|
|
(widget.room.canonicalAlias?.isNotEmpty ?? false)
|
|
|
|
? widget.room.canonicalAlias
|
|
|
|
: I18n.of(context).none),
|
2020-01-19 14:07:42 +00:00
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
PopupMenuButton(
|
|
|
|
child: ListTile(
|
|
|
|
leading: CircleAvatar(
|
2020-02-16 19:11:39 +00:00
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
2020-02-16 09:48:20 +00:00
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
child: Icon(Icons.public)),
|
|
|
|
title: Text(
|
|
|
|
I18n.of(context).whoIsAllowedToJoinThisGroup),
|
|
|
|
subtitle: Text(
|
2020-05-05 12:55:19 +00:00
|
|
|
widget.room.joinRules
|
|
|
|
.getLocalizedString(I18n.of(context)),
|
2020-02-16 09:48:20 +00:00
|
|
|
),
|
2020-01-19 14:07:42 +00:00
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
onSelected: (JoinRules joinRule) =>
|
2020-04-27 11:36:39 +00:00
|
|
|
SimpleDialogs(context).tryRequestWithLoadingDialog(
|
2020-02-16 09:48:20 +00:00
|
|
|
widget.room.setJoinRules(joinRule),
|
|
|
|
),
|
|
|
|
itemBuilder: (BuildContext context) =>
|
|
|
|
<PopupMenuEntry<JoinRules>>[
|
|
|
|
if (widget.room.canChangeJoinRules)
|
|
|
|
PopupMenuItem<JoinRules>(
|
|
|
|
value: JoinRules.public,
|
2020-05-05 12:55:19 +00:00
|
|
|
child: Text(JoinRules.public
|
|
|
|
.getLocalizedString(I18n.of(context))),
|
2020-02-16 09:48:20 +00:00
|
|
|
),
|
|
|
|
if (widget.room.canChangeJoinRules)
|
|
|
|
PopupMenuItem<JoinRules>(
|
|
|
|
value: JoinRules.invite,
|
2020-05-05 12:55:19 +00:00
|
|
|
child: Text(JoinRules.invite
|
|
|
|
.getLocalizedString(I18n.of(context))),
|
2020-02-16 09:48:20 +00:00
|
|
|
),
|
|
|
|
],
|
2020-01-19 14:07:42 +00:00
|
|
|
),
|
|
|
|
PopupMenuButton(
|
|
|
|
child: ListTile(
|
|
|
|
leading: CircleAvatar(
|
2020-02-16 19:11:39 +00:00
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
2020-01-19 14:07:42 +00:00
|
|
|
foregroundColor: Colors.grey,
|
2020-02-16 09:48:20 +00:00
|
|
|
child: Icon(Icons.visibility),
|
2020-01-19 14:07:42 +00:00
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
title:
|
|
|
|
Text(I18n.of(context).visibilityOfTheChatHistory),
|
2020-01-19 14:07:42 +00:00
|
|
|
subtitle: Text(
|
2020-02-16 09:48:20 +00:00
|
|
|
widget.room.historyVisibility
|
2020-05-05 12:55:19 +00:00
|
|
|
.getLocalizedString(I18n.of(context)),
|
2020-01-19 14:07:42 +00:00
|
|
|
),
|
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
onSelected: (HistoryVisibility historyVisibility) =>
|
2020-04-27 11:36:39 +00:00
|
|
|
SimpleDialogs(context).tryRequestWithLoadingDialog(
|
2020-02-16 09:48:20 +00:00
|
|
|
widget.room.setHistoryVisibility(historyVisibility),
|
2020-01-19 14:07:42 +00:00
|
|
|
),
|
|
|
|
itemBuilder: (BuildContext context) =>
|
2020-02-16 09:48:20 +00:00
|
|
|
<PopupMenuEntry<HistoryVisibility>>[
|
|
|
|
if (widget.room.canChangeHistoryVisibility)
|
|
|
|
PopupMenuItem<HistoryVisibility>(
|
|
|
|
value: HistoryVisibility.invited,
|
|
|
|
child: Text(HistoryVisibility.invited
|
2020-05-05 12:55:19 +00:00
|
|
|
.getLocalizedString(I18n.of(context))),
|
2020-01-19 14:07:42 +00:00
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
if (widget.room.canChangeHistoryVisibility)
|
|
|
|
PopupMenuItem<HistoryVisibility>(
|
|
|
|
value: HistoryVisibility.joined,
|
|
|
|
child: Text(HistoryVisibility.joined
|
2020-05-05 12:55:19 +00:00
|
|
|
.getLocalizedString(I18n.of(context))),
|
2020-02-16 09:48:20 +00:00
|
|
|
),
|
|
|
|
if (widget.room.canChangeHistoryVisibility)
|
|
|
|
PopupMenuItem<HistoryVisibility>(
|
|
|
|
value: HistoryVisibility.shared,
|
|
|
|
child: Text(HistoryVisibility.shared
|
2020-05-05 12:55:19 +00:00
|
|
|
.getLocalizedString(I18n.of(context))),
|
2020-02-16 09:48:20 +00:00
|
|
|
),
|
|
|
|
if (widget.room.canChangeHistoryVisibility)
|
|
|
|
PopupMenuItem<HistoryVisibility>(
|
|
|
|
value: HistoryVisibility.world_readable,
|
|
|
|
child: Text(HistoryVisibility.world_readable
|
2020-05-05 12:55:19 +00:00
|
|
|
.getLocalizedString(I18n.of(context))),
|
2020-01-19 14:07:42 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
if (widget.room.joinRules == JoinRules.public)
|
|
|
|
PopupMenuButton(
|
|
|
|
child: ListTile(
|
2020-01-17 09:39:46 +00:00
|
|
|
leading: CircleAvatar(
|
2020-02-16 19:11:39 +00:00
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
2020-02-16 09:48:20 +00:00
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
child: Icon(Icons.info_outline),
|
2020-01-17 09:39:46 +00:00
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
title:
|
|
|
|
Text(I18n.of(context).areGuestsAllowedToJoin),
|
|
|
|
subtitle: Text(
|
|
|
|
widget.room.guestAccess
|
2020-05-05 12:55:19 +00:00
|
|
|
.getLocalizedString(I18n.of(context)),
|
2020-01-03 11:07:04 +00:00
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
),
|
|
|
|
onSelected: (GuestAccess guestAccess) =>
|
2020-04-27 11:36:39 +00:00
|
|
|
SimpleDialogs(context)
|
|
|
|
.tryRequestWithLoadingDialog(
|
2020-02-16 09:48:20 +00:00
|
|
|
widget.room.setGuestAccess(guestAccess),
|
|
|
|
),
|
|
|
|
itemBuilder: (BuildContext context) =>
|
|
|
|
<PopupMenuEntry<GuestAccess>>[
|
|
|
|
if (widget.room.canChangeGuestAccess)
|
|
|
|
PopupMenuItem<GuestAccess>(
|
|
|
|
value: GuestAccess.can_join,
|
|
|
|
child: Text(
|
|
|
|
GuestAccess.can_join
|
2020-05-05 12:55:19 +00:00
|
|
|
.getLocalizedString(I18n.of(context)),
|
2020-02-16 09:48:20 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
if (widget.room.canChangeGuestAccess)
|
|
|
|
PopupMenuItem<GuestAccess>(
|
|
|
|
value: GuestAccess.forbidden,
|
|
|
|
child: Text(
|
|
|
|
GuestAccess.forbidden
|
2020-05-05 12:55:19 +00:00
|
|
|
.getLocalizedString(I18n.of(context)),
|
2020-02-16 09:48:20 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2020-02-16 10:09:28 +00:00
|
|
|
Divider(thickness: 1),
|
2020-02-16 09:48:20 +00:00
|
|
|
ListTile(
|
|
|
|
title: Text(
|
|
|
|
actualMembersCount > 1
|
|
|
|
? I18n.of(context).countParticipants(
|
|
|
|
actualMembersCount.toString())
|
|
|
|
: I18n.of(context).emptyChat,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
widget.room.canInvite
|
|
|
|
? ListTile(
|
|
|
|
title: Text(I18n.of(context).inviteContact),
|
|
|
|
leading: CircleAvatar(
|
|
|
|
child: Icon(Icons.add),
|
|
|
|
backgroundColor: Theme.of(context).primaryColor,
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
),
|
|
|
|
onTap: () => Navigator.of(context).push(
|
|
|
|
AppRoute.defaultRoute(
|
|
|
|
context,
|
|
|
|
InvitationSelection(widget.room),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: i < members.length + 1
|
|
|
|
? ParticipantListItem(members[i - 1])
|
|
|
|
: ListTile(
|
|
|
|
title: Text(I18n.of(context).loadCountMoreParticipants(
|
|
|
|
(actualMembersCount - members.length).toString())),
|
|
|
|
leading: CircleAvatar(
|
2020-02-16 19:11:39 +00:00
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
2020-02-16 09:48:20 +00:00
|
|
|
child: Icon(
|
|
|
|
Icons.refresh,
|
|
|
|
color: Colors.grey,
|
|
|
|
),
|
2020-01-18 12:22:22 +00:00
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
onTap: () => requestMoreMembersAction(context),
|
2020-01-18 12:22:22 +00:00
|
|
|
),
|
2020-02-16 09:48:20 +00:00
|
|
|
),
|
2020-01-01 18:10:13 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|