|
|
|
@ -1,4 +1,3 @@
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
import 'dart:io';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:famedlysdk/famedlysdk.dart';
|
|
|
|
import 'package:famedlysdk/famedlysdk.dart';
|
|
|
|
@ -131,14 +130,6 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
if (participants != null) setState(() => members = participants);
|
|
|
|
if (participants != null) setState(() => members = participants);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StreamSubscription onUpdate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
void dispose() {
|
|
|
|
|
|
|
|
onUpdate?.cancel();
|
|
|
|
|
|
|
|
super.dispose();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
if (widget.room == null) {
|
|
|
|
if (widget.room == null) {
|
|
|
|
@ -156,14 +147,15 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
final int actualMembersCount =
|
|
|
|
final int actualMembersCount =
|
|
|
|
widget.room.mInvitedMemberCount + widget.room.mJoinedMemberCount;
|
|
|
|
widget.room.mInvitedMemberCount + widget.room.mJoinedMemberCount;
|
|
|
|
final bool canRequestMoreMembers = members.length < actualMembersCount;
|
|
|
|
final bool canRequestMoreMembers = members.length < actualMembersCount;
|
|
|
|
this.onUpdate ??= widget.room.onUpdate.stream
|
|
|
|
|
|
|
|
.listen((id) => setState(() => members = null));
|
|
|
|
|
|
|
|
return AdaptivePageLayout(
|
|
|
|
return AdaptivePageLayout(
|
|
|
|
primaryPage: FocusPage.SECOND,
|
|
|
|
primaryPage: FocusPage.SECOND,
|
|
|
|
firstScaffold: ChatList(
|
|
|
|
firstScaffold: ChatList(
|
|
|
|
activeChat: widget.room.id,
|
|
|
|
activeChat: widget.room.id,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
secondScaffold: Scaffold(
|
|
|
|
secondScaffold: StreamBuilder(
|
|
|
|
|
|
|
|
stream: widget.room.onUpdate.stream,
|
|
|
|
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
body: NestedScrollView(
|
|
|
|
body: NestedScrollView(
|
|
|
|
headerSliverBuilder:
|
|
|
|
headerSliverBuilder:
|
|
|
|
(BuildContext context, bool innerBoxIsScrolled) => <Widget>[
|
|
|
|
(BuildContext context, bool innerBoxIsScrolled) => <Widget>[
|
|
|
|
@ -184,7 +176,8 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
ChatSettingsPopupMenu(widget.room, false)
|
|
|
|
ChatSettingsPopupMenu(widget.room, false)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
title: Text(widget.room.getLocalizedDisplayname(L10n.of(context)),
|
|
|
|
title: Text(
|
|
|
|
|
|
|
|
widget.room.getLocalizedDisplayname(L10n.of(context)),
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context)
|
|
|
|
color: Theme.of(context)
|
|
|
|
.appBarTheme
|
|
|
|
.appBarTheme
|
|
|
|
@ -194,14 +187,16 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
backgroundColor: Theme.of(context).appBarTheme.color,
|
|
|
|
backgroundColor: Theme.of(context).appBarTheme.color,
|
|
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
|
|
background: ContentBanner(widget.room.avatar,
|
|
|
|
background: ContentBanner(widget.room.avatar,
|
|
|
|
onEdit: widget.room.canSendEvent("m.room.avatar") && !kIsWeb
|
|
|
|
onEdit: widget.room.canSendEvent("m.room.avatar") &&
|
|
|
|
|
|
|
|
!kIsWeb
|
|
|
|
? () => setAvatarAction(context)
|
|
|
|
? () => setAvatarAction(context)
|
|
|
|
: null),
|
|
|
|
: null),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
body: ListView.builder(
|
|
|
|
body: ListView.builder(
|
|
|
|
itemCount: members.length + 1 + (canRequestMoreMembers ? 1 : 0),
|
|
|
|
itemCount:
|
|
|
|
|
|
|
|
members.length + 1 + (canRequestMoreMembers ? 1 : 0),
|
|
|
|
itemBuilder: (BuildContext context, int i) => i == 0
|
|
|
|
itemBuilder: (BuildContext context, int i) => i == 0
|
|
|
|
? Column(
|
|
|
|
? Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
@ -209,13 +204,14 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
ListTile(
|
|
|
|
ListTile(
|
|
|
|
leading: widget.room.canSendEvent("m.room.topic")
|
|
|
|
leading: widget.room.canSendEvent("m.room.topic")
|
|
|
|
? CircleAvatar(
|
|
|
|
? CircleAvatar(
|
|
|
|
backgroundColor:
|
|
|
|
backgroundColor: Theme.of(context)
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
.scaffoldBackgroundColor,
|
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
child: Icon(Icons.edit),
|
|
|
|
child: Icon(Icons.edit),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: null,
|
|
|
|
: null,
|
|
|
|
title: Text("${L10n.of(context).groupDescription}:",
|
|
|
|
title: Text(
|
|
|
|
|
|
|
|
"${L10n.of(context).groupDescription}:",
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
fontWeight: FontWeight.bold)),
|
|
|
|
fontWeight: FontWeight.bold)),
|
|
|
|
@ -226,7 +222,10 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
linkStyle: TextStyle(color: Colors.blueAccent),
|
|
|
|
linkStyle: TextStyle(color: Colors.blueAccent),
|
|
|
|
textStyle: TextStyle(
|
|
|
|
textStyle: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
fontSize: 14,
|
|
|
|
color: Theme.of(context).textTheme.bodyText2.color,
|
|
|
|
color: Theme.of(context)
|
|
|
|
|
|
|
|
.textTheme
|
|
|
|
|
|
|
|
.bodyText2
|
|
|
|
|
|
|
|
.color,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: widget.room.canSendEvent("m.room.topic")
|
|
|
|
onTap: widget.room.canSendEvent("m.room.topic")
|
|
|
|
@ -251,12 +250,14 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
child: Icon(Icons.people),
|
|
|
|
child: Icon(Icons.people),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title: Text(L10n.of(context).changeTheNameOfTheGroup),
|
|
|
|
title: Text(
|
|
|
|
|
|
|
|
L10n.of(context).changeTheNameOfTheGroup),
|
|
|
|
subtitle: Text(widget.room
|
|
|
|
subtitle: Text(widget.room
|
|
|
|
.getLocalizedDisplayname(L10n.of(context))),
|
|
|
|
.getLocalizedDisplayname(L10n.of(context))),
|
|
|
|
onTap: () => setDisplaynameAction(context),
|
|
|
|
onTap: () => setDisplaynameAction(context),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (widget.room.canSendEvent("m.room.canonical_alias") &&
|
|
|
|
if (widget.room
|
|
|
|
|
|
|
|
.canSendEvent("m.room.canonical_alias") &&
|
|
|
|
widget.room.joinRules == JoinRules.public)
|
|
|
|
widget.room.joinRules == JoinRules.public)
|
|
|
|
ListTile(
|
|
|
|
ListTile(
|
|
|
|
leading: CircleAvatar(
|
|
|
|
leading: CircleAvatar(
|
|
|
|
@ -268,26 +269,28 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
onTap: () => setCanonicalAliasAction(context),
|
|
|
|
onTap: () => setCanonicalAliasAction(context),
|
|
|
|
title: Text(L10n.of(context).setInvitationLink),
|
|
|
|
title: Text(L10n.of(context).setInvitationLink),
|
|
|
|
subtitle: Text(
|
|
|
|
subtitle: Text(
|
|
|
|
(widget.room.canonicalAlias?.isNotEmpty ?? false)
|
|
|
|
(widget.room.canonicalAlias?.isNotEmpty ??
|
|
|
|
|
|
|
|
false)
|
|
|
|
? widget.room.canonicalAlias
|
|
|
|
? widget.room.canonicalAlias
|
|
|
|
: L10n.of(context).none),
|
|
|
|
: L10n.of(context).none),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
PopupMenuButton(
|
|
|
|
PopupMenuButton(
|
|
|
|
child: ListTile(
|
|
|
|
child: ListTile(
|
|
|
|
leading: CircleAvatar(
|
|
|
|
leading: CircleAvatar(
|
|
|
|
backgroundColor:
|
|
|
|
backgroundColor: Theme.of(context)
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
.scaffoldBackgroundColor,
|
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
child: Icon(Icons.public)),
|
|
|
|
child: Icon(Icons.public)),
|
|
|
|
title: Text(
|
|
|
|
title: Text(L10n.of(context)
|
|
|
|
L10n.of(context).whoIsAllowedToJoinThisGroup),
|
|
|
|
.whoIsAllowedToJoinThisGroup),
|
|
|
|
subtitle: Text(
|
|
|
|
subtitle: Text(
|
|
|
|
widget.room.joinRules
|
|
|
|
widget.room.joinRules
|
|
|
|
.getLocalizedString(L10n.of(context)),
|
|
|
|
.getLocalizedString(L10n.of(context)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onSelected: (JoinRules joinRule) =>
|
|
|
|
onSelected: (JoinRules joinRule) =>
|
|
|
|
SimpleDialogs(context).tryRequestWithLoadingDialog(
|
|
|
|
SimpleDialogs(context)
|
|
|
|
|
|
|
|
.tryRequestWithLoadingDialog(
|
|
|
|
widget.room.setJoinRules(joinRule),
|
|
|
|
widget.room.setJoinRules(joinRule),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
itemBuilder: (BuildContext context) =>
|
|
|
|
itemBuilder: (BuildContext context) =>
|
|
|
|
@ -314,16 +317,19 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
child: Icon(Icons.visibility),
|
|
|
|
child: Icon(Icons.visibility),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title:
|
|
|
|
title: Text(L10n.of(context)
|
|
|
|
Text(L10n.of(context).visibilityOfTheChatHistory),
|
|
|
|
.visibilityOfTheChatHistory),
|
|
|
|
subtitle: Text(
|
|
|
|
subtitle: Text(
|
|
|
|
widget.room.historyVisibility
|
|
|
|
widget.room.historyVisibility
|
|
|
|
.getLocalizedString(L10n.of(context)),
|
|
|
|
.getLocalizedString(L10n.of(context)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onSelected: (HistoryVisibility historyVisibility) =>
|
|
|
|
onSelected:
|
|
|
|
SimpleDialogs(context).tryRequestWithLoadingDialog(
|
|
|
|
(HistoryVisibility historyVisibility) =>
|
|
|
|
widget.room.setHistoryVisibility(historyVisibility),
|
|
|
|
SimpleDialogs(context)
|
|
|
|
|
|
|
|
.tryRequestWithLoadingDialog(
|
|
|
|
|
|
|
|
widget.room
|
|
|
|
|
|
|
|
.setHistoryVisibility(historyVisibility),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
itemBuilder: (BuildContext context) =>
|
|
|
|
itemBuilder: (BuildContext context) =>
|
|
|
|
<PopupMenuEntry<HistoryVisibility>>[
|
|
|
|
<PopupMenuEntry<HistoryVisibility>>[
|
|
|
|
@ -357,13 +363,13 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
PopupMenuButton(
|
|
|
|
PopupMenuButton(
|
|
|
|
child: ListTile(
|
|
|
|
child: ListTile(
|
|
|
|
leading: CircleAvatar(
|
|
|
|
leading: CircleAvatar(
|
|
|
|
backgroundColor:
|
|
|
|
backgroundColor: Theme.of(context)
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
.scaffoldBackgroundColor,
|
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
foregroundColor: Colors.grey,
|
|
|
|
child: Icon(Icons.info_outline),
|
|
|
|
child: Icon(Icons.info_outline),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title:
|
|
|
|
title: Text(
|
|
|
|
Text(L10n.of(context).areGuestsAllowedToJoin),
|
|
|
|
L10n.of(context).areGuestsAllowedToJoin),
|
|
|
|
subtitle: Text(
|
|
|
|
subtitle: Text(
|
|
|
|
widget.room.guestAccess
|
|
|
|
widget.room.guestAccess
|
|
|
|
.getLocalizedString(L10n.of(context)),
|
|
|
|
.getLocalizedString(L10n.of(context)),
|
|
|
|
@ -380,8 +386,8 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
PopupMenuItem<GuestAccess>(
|
|
|
|
PopupMenuItem<GuestAccess>(
|
|
|
|
value: GuestAccess.can_join,
|
|
|
|
value: GuestAccess.can_join,
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
GuestAccess.can_join
|
|
|
|
GuestAccess.can_join.getLocalizedString(
|
|
|
|
.getLocalizedString(L10n.of(context)),
|
|
|
|
L10n.of(context)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (widget.room.canChangeGuestAccess)
|
|
|
|
if (widget.room.canChangeGuestAccess)
|
|
|
|
@ -389,7 +395,8 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
value: GuestAccess.forbidden,
|
|
|
|
value: GuestAccess.forbidden,
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
GuestAccess.forbidden
|
|
|
|
GuestAccess.forbidden
|
|
|
|
.getLocalizedString(L10n.of(context)),
|
|
|
|
.getLocalizedString(
|
|
|
|
|
|
|
|
L10n.of(context)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
@ -412,7 +419,8 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
title: Text(L10n.of(context).inviteContact),
|
|
|
|
title: Text(L10n.of(context).inviteContact),
|
|
|
|
leading: CircleAvatar(
|
|
|
|
leading: CircleAvatar(
|
|
|
|
child: Icon(Icons.add),
|
|
|
|
child: Icon(Icons.add),
|
|
|
|
backgroundColor: Theme.of(context).primaryColor,
|
|
|
|
backgroundColor:
|
|
|
|
|
|
|
|
Theme.of(context).primaryColor,
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () => Navigator.of(context).push(
|
|
|
|
onTap: () => Navigator.of(context).push(
|
|
|
|
@ -428,8 +436,10 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
: i < members.length + 1
|
|
|
|
: i < members.length + 1
|
|
|
|
? ParticipantListItem(members[i - 1])
|
|
|
|
? ParticipantListItem(members[i - 1])
|
|
|
|
: ListTile(
|
|
|
|
: ListTile(
|
|
|
|
title: Text(L10n.of(context).loadCountMoreParticipants(
|
|
|
|
title: Text(L10n.of(context)
|
|
|
|
(actualMembersCount - members.length).toString())),
|
|
|
|
.loadCountMoreParticipants(
|
|
|
|
|
|
|
|
(actualMembersCount - members.length)
|
|
|
|
|
|
|
|
.toString())),
|
|
|
|
leading: CircleAvatar(
|
|
|
|
leading: CircleAvatar(
|
|
|
|
backgroundColor:
|
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
@ -442,7 +452,8 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|