mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-19 04:55:09 +00:00
design: Big redesign of three column mode to advanced two column mode
This commit is contained in:
parent
f442bb89f9
commit
9e13bd8dfd
24 changed files with 944 additions and 771 deletions
|
@ -1037,6 +1037,14 @@
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
|
"inviteContactToGroupQuestion": "Do you want to invite {contact} to the chat \"{groupName}\"?",
|
||||||
|
"@inviteContactToGroup": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {
|
||||||
|
"contact": {},
|
||||||
|
"groupName": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
"inviteContactToGroup": "Invite contact to {groupName}",
|
"inviteContactToGroup": "Invite contact to {groupName}",
|
||||||
"@inviteContactToGroup": {
|
"@inviteContactToGroup": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -1044,6 +1052,10 @@
|
||||||
"groupName": {}
|
"groupName": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"noGroupDescriptionYet": "No group description created yet.",
|
||||||
|
"anyoneCanKnock": "Anyone can knock",
|
||||||
|
"noOneCanJoin": "No one can join",
|
||||||
|
"tryAgain": "Try again",
|
||||||
"invited": "Invited",
|
"invited": "Invited",
|
||||||
"@invited": {
|
"@invited": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -2499,5 +2511,6 @@
|
||||||
},
|
},
|
||||||
"profileNotFound": "The user could not be found on the server. Maybe there is a connection problem or the user doesn't exist.",
|
"profileNotFound": "The user could not be found on the server. Maybe there is a connection problem or the user doesn't exist.",
|
||||||
"setTheme": "Set theme:",
|
"setTheme": "Set theme:",
|
||||||
"setColorTheme": "Set color theme:"
|
"setColorTheme": "Set color theme:",
|
||||||
|
"invite": "Invite"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import 'package:fluffychat/pages/chat/chat.dart';
|
||||||
import 'package:fluffychat/pages/chat_details/chat_details.dart';
|
import 'package:fluffychat/pages/chat_details/chat_details.dart';
|
||||||
import 'package:fluffychat/pages/chat_encryption_settings/chat_encryption_settings.dart';
|
import 'package:fluffychat/pages/chat_encryption_settings/chat_encryption_settings.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||||
|
import 'package:fluffychat/pages/chat_members/chat_members.dart';
|
||||||
import 'package:fluffychat/pages/chat_permissions_settings/chat_permissions_settings.dart';
|
import 'package:fluffychat/pages/chat_permissions_settings/chat_permissions_settings.dart';
|
||||||
import 'package:fluffychat/pages/device_settings/device_settings.dart';
|
import 'package:fluffychat/pages/device_settings/device_settings.dart';
|
||||||
import 'package:fluffychat/pages/homeserver_picker/homeserver_picker.dart';
|
import 'package:fluffychat/pages/homeserver_picker/homeserver_picker.dart';
|
||||||
|
@ -31,7 +32,6 @@ import 'package:fluffychat/pages/settings_stories/settings_stories.dart';
|
||||||
import 'package:fluffychat/pages/settings_style/settings_style.dart';
|
import 'package:fluffychat/pages/settings_style/settings_style.dart';
|
||||||
import 'package:fluffychat/pages/story/story_page.dart';
|
import 'package:fluffychat/pages/story/story_page.dart';
|
||||||
import 'package:fluffychat/widgets/layouts/empty_page.dart';
|
import 'package:fluffychat/widgets/layouts/empty_page.dart';
|
||||||
import 'package:fluffychat/widgets/layouts/side_view_layout.dart';
|
|
||||||
import 'package:fluffychat/widgets/layouts/two_column_layout.dart';
|
import 'package:fluffychat/widgets/layouts/two_column_layout.dart';
|
||||||
import 'package:fluffychat/widgets/log_view.dart';
|
import 'package:fluffychat/widgets/log_view.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
|
@ -218,23 +218,11 @@ abstract class AppRoutes {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ShellRoute(
|
|
||||||
pageBuilder: (context, state, child) => defaultPageBuilder(
|
|
||||||
context,
|
|
||||||
SideViewLayout(
|
|
||||||
mainView: ChatPage(
|
|
||||||
roomId: state.pathParameters['roomid']!,
|
|
||||||
),
|
|
||||||
sideView: child,
|
|
||||||
hideSideView: state.fullPath == '/rooms/:roomid',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
routes: [
|
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: ':roomid',
|
path: ':roomid',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
const SizedBox.shrink(),
|
ChatPage(roomId: state.pathParameters['roomid']!),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
routes: [
|
routes: [
|
||||||
|
@ -250,7 +238,9 @@ abstract class AppRoutes {
|
||||||
path: 'invite',
|
path: 'invite',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
const InvitationSelection(),
|
InvitationSelection(
|
||||||
|
roomId: state.pathParameters['roomid']!,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
),
|
),
|
||||||
|
@ -271,11 +261,19 @@ abstract class AppRoutes {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
static final List<RouteBase> _chatDetailsRoutes = [
|
static final List<RouteBase> _chatDetailsRoutes = [
|
||||||
|
GoRoute(
|
||||||
|
path: 'members',
|
||||||
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
|
context,
|
||||||
|
ChatMembersPage(
|
||||||
|
roomId: state.pathParameters['roomid']!,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
redirect: loggedOutRedirect,
|
||||||
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: 'permissions',
|
path: 'permissions',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
|
@ -288,7 +286,7 @@ abstract class AppRoutes {
|
||||||
path: 'invite',
|
path: 'invite',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
const InvitationSelection(),
|
InvitationSelection(roomId: state.pathParameters['roomid']!),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
),
|
),
|
||||||
|
|
|
@ -58,7 +58,11 @@ abstract class FluffyThemes {
|
||||||
static const Duration animationDuration = Duration(milliseconds: 250);
|
static const Duration animationDuration = Duration(milliseconds: 250);
|
||||||
static const Curve animationCurve = Curves.easeInOut;
|
static const Curve animationCurve = Curves.easeInOut;
|
||||||
|
|
||||||
static ThemeData buildTheme(Brightness brightness, [Color? seed]) {
|
static ThemeData buildTheme(
|
||||||
|
BuildContext context,
|
||||||
|
Brightness brightness, [
|
||||||
|
Color? seed,
|
||||||
|
]) {
|
||||||
final colorScheme = ColorScheme.fromSeed(
|
final colorScheme = ColorScheme.fromSeed(
|
||||||
brightness: brightness,
|
brightness: brightness,
|
||||||
seedColor: seed ?? AppConfig.colorSchemeSeed ?? AppConfig.primaryColor,
|
seedColor: seed ?? AppConfig.colorSchemeSeed ?? AppConfig.primaryColor,
|
||||||
|
@ -92,6 +96,9 @@ abstract class FluffyThemes {
|
||||||
filled: true,
|
filled: true,
|
||||||
),
|
),
|
||||||
appBarTheme: AppBarTheme(
|
appBarTheme: AppBarTheme(
|
||||||
|
toolbarHeight: FluffyThemes.isColumnMode(context) ? 72 : 56,
|
||||||
|
shadowColor: Colors.grey.withAlpha(64),
|
||||||
|
surfaceTintColor: colorScheme.background,
|
||||||
systemOverlayStyle: SystemUiOverlayStyle(
|
systemOverlayStyle: SystemUiOverlayStyle(
|
||||||
statusBarColor: Colors.transparent,
|
statusBarColor: Colors.transparent,
|
||||||
statusBarIconBrightness: brightness.reversed,
|
statusBarIconBrightness: brightness.reversed,
|
||||||
|
|
|
@ -8,6 +8,7 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
import 'package:matrix/matrix.dart' as matrix;
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/pages/chat_details/chat_details_view.dart';
|
import 'package:fluffychat/pages/chat_details/chat_details_view.dart';
|
||||||
|
@ -31,7 +32,6 @@ class ChatDetails extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChatDetailsController extends State<ChatDetails> {
|
class ChatDetailsController extends State<ChatDetails> {
|
||||||
List<User>? members;
|
|
||||||
bool displaySettings = false;
|
bool displaySettings = false;
|
||||||
|
|
||||||
void toggleDisplaySettings() =>
|
void toggleDisplaySettings() =>
|
||||||
|
@ -42,7 +42,6 @@ class ChatDetailsController extends State<ChatDetails> {
|
||||||
void setDisplaynameAction() async {
|
void setDisplaynameAction() async {
|
||||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.changeTheNameOfTheGroup,
|
title: L10n.of(context)!.changeTheNameOfTheGroup,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
@ -103,7 +102,6 @@ class ChatDetailsController extends State<ChatDetails> {
|
||||||
return setAliasAction();
|
return setAliasAction();
|
||||||
}
|
}
|
||||||
final select = await showConfirmationDialog(
|
final select = await showConfirmationDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.editRoomAliases,
|
title: L10n.of(context)!.editRoomAliases,
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -176,7 +174,6 @@ class ChatDetailsController extends State<ChatDetails> {
|
||||||
final domain = room.client.userID!.domain;
|
final domain = room.client.userID!.domain;
|
||||||
|
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.setInvitationLink,
|
title: L10n.of(context)!.setInvitationLink,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
@ -201,17 +198,16 @@ class ChatDetailsController extends State<ChatDetails> {
|
||||||
void setTopicAction() async {
|
void setTopicAction() async {
|
||||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.setGroupDescription,
|
title: L10n.of(context)!.setGroupDescription,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
cancelLabel: L10n.of(context)!.cancel,
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
textFields: [
|
textFields: [
|
||||||
DialogTextField(
|
DialogTextField(
|
||||||
hintText: L10n.of(context)!.setGroupDescription,
|
hintText: L10n.of(context)!.noGroupDescriptionYet,
|
||||||
initialText: room.topic,
|
initialText: room.topic,
|
||||||
minLines: 1,
|
minLines: 4,
|
||||||
maxLines: 4,
|
maxLines: 8,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -229,30 +225,90 @@ class ChatDetailsController extends State<ChatDetails> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setGuestAccessAction(GuestAccess guestAccess) => showFutureLoadingDialog(
|
void setGuestAccess() async {
|
||||||
|
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||||
|
final currentGuestAccess = room.guestAccess;
|
||||||
|
final newGuestAccess = await showConfirmationDialog<GuestAccess>(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => Matrix.of(context)
|
title: L10n.of(context)!.whoIsAllowedToJoinThisGroup,
|
||||||
.client
|
actions: GuestAccess.values
|
||||||
.getRoomById(roomId!)!
|
.map(
|
||||||
.setGuestAccess(guestAccess),
|
(guestAccess) => AlertDialogAction(
|
||||||
|
key: guestAccess,
|
||||||
|
label: guestAccess
|
||||||
|
.getLocalizedString(MatrixLocals(L10n.of(context)!)),
|
||||||
|
isDefaultAction: guestAccess == currentGuestAccess,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
);
|
);
|
||||||
|
if (newGuestAccess == null || newGuestAccess == currentGuestAccess) return;
|
||||||
|
await showFutureLoadingDialog(
|
||||||
|
context: context,
|
||||||
|
future: () => room.setGuestAccess(newGuestAccess),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void setHistoryVisibilityAction(HistoryVisibility historyVisibility) =>
|
void setHistoryVisibility() async {
|
||||||
showFutureLoadingDialog(
|
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||||
|
final currentHistoryVisibility = room.historyVisibility;
|
||||||
|
final newHistoryVisibility =
|
||||||
|
await showConfirmationDialog<HistoryVisibility>(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => Matrix.of(context)
|
title: L10n.of(context)!.whoIsAllowedToJoinThisGroup,
|
||||||
.client
|
actions: HistoryVisibility.values
|
||||||
.getRoomById(roomId!)!
|
.map(
|
||||||
.setHistoryVisibility(historyVisibility),
|
(visibility) => AlertDialogAction(
|
||||||
|
key: visibility,
|
||||||
|
label: visibility
|
||||||
|
.getLocalizedString(MatrixLocals(L10n.of(context)!)),
|
||||||
|
isDefaultAction: visibility == currentHistoryVisibility,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
);
|
);
|
||||||
|
if (newHistoryVisibility == null ||
|
||||||
|
newHistoryVisibility == currentHistoryVisibility) return;
|
||||||
|
await showFutureLoadingDialog(
|
||||||
|
context: context,
|
||||||
|
future: () => room.setHistoryVisibility(newHistoryVisibility),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void setJoinRulesAction(JoinRules joinRule) => showFutureLoadingDialog(
|
void setJoinRules() async {
|
||||||
|
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||||
|
final currentJoinRule = room.joinRules;
|
||||||
|
final newJoinRule = await showConfirmationDialog<JoinRules>(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => Matrix.of(context)
|
title: L10n.of(context)!.whoIsAllowedToJoinThisGroup,
|
||||||
.client
|
actions: JoinRules.values
|
||||||
.getRoomById(roomId!)!
|
.map(
|
||||||
.setJoinRules(joinRule),
|
(joinRule) => AlertDialogAction(
|
||||||
|
key: joinRule,
|
||||||
|
label:
|
||||||
|
joinRule.getLocalizedString(MatrixLocals(L10n.of(context)!)),
|
||||||
|
isDefaultAction: joinRule == currentJoinRule,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
);
|
);
|
||||||
|
if (newJoinRule == null || newJoinRule == currentJoinRule) return;
|
||||||
|
await showFutureLoadingDialog(
|
||||||
|
context: context,
|
||||||
|
future: () async {
|
||||||
|
await room.setJoinRules(newJoinRule);
|
||||||
|
room.client.setRoomVisibilityOnDirectory(
|
||||||
|
roomId!,
|
||||||
|
visibility: {
|
||||||
|
JoinRules.public,
|
||||||
|
JoinRules.knock,
|
||||||
|
}.contains(newJoinRule)
|
||||||
|
? matrix.Visibility.public
|
||||||
|
: matrix.Visibility.private,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void goToEmoteSettings() async {
|
void goToEmoteSettings() async {
|
||||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||||
|
@ -337,26 +393,8 @@ class ChatDetailsController extends State<ChatDetails> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void requestMoreMembersAction() async {
|
|
||||||
final room = Matrix.of(context).client.getRoomById(roomId!);
|
|
||||||
final participants = await showFutureLoadingDialog(
|
|
||||||
context: context,
|
|
||||||
future: () => room!.requestParticipants(),
|
|
||||||
);
|
|
||||||
if (participants.error == null) {
|
|
||||||
setState(() => members = participants.result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static const fixedWidth = 360.0;
|
static const fixedWidth = 360.0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) => ChatDetailsView(this);
|
||||||
members ??=
|
|
||||||
Matrix.of(context).client.getRoomById(roomId!)!.getParticipants();
|
|
||||||
return SizedBox(
|
|
||||||
width: fixedWidth,
|
|
||||||
child: ChatDetailsView(this),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import 'package:fluffychat/utils/fluffy_share.dart';
|
||||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/chat_settings_popup_menu.dart';
|
import 'package:fluffychat/widgets/chat_settings_popup_menu.dart';
|
||||||
import 'package:fluffychat/widgets/content_banner.dart';
|
|
||||||
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import '../../utils/url_launcher.dart';
|
import '../../utils/url_launcher.dart';
|
||||||
|
@ -36,33 +35,23 @@ class ChatDetailsView extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
controller.members!.removeWhere((u) => u.membership == Membership.leave);
|
|
||||||
final actualMembersCount = (room.summary.mInvitedMemberCount ?? 0) +
|
|
||||||
(room.summary.mJoinedMemberCount ?? 0);
|
|
||||||
final canRequestMoreMembers =
|
|
||||||
controller.members!.length < actualMembersCount;
|
|
||||||
final iconColor = Theme.of(context).textTheme.bodyLarge!.color;
|
|
||||||
return StreamBuilder(
|
return StreamBuilder(
|
||||||
stream: room.onUpdate.stream,
|
stream: room.onUpdate.stream,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
|
var members = room.getParticipants().toList()
|
||||||
|
..sort((b, a) => a.powerLevel.compareTo(b.powerLevel));
|
||||||
|
members = members.take(10).toList();
|
||||||
|
final actualMembersCount = (room.summary.mInvitedMemberCount ?? 0) +
|
||||||
|
(room.summary.mJoinedMemberCount ?? 0);
|
||||||
|
final canRequestMoreMembers = members.length < actualMembersCount;
|
||||||
|
final iconColor = Theme.of(context).textTheme.bodyLarge!.color;
|
||||||
|
final displayname = room.getLocalizedDisplayname(
|
||||||
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: NestedScrollView(
|
appBar: AppBar(
|
||||||
headerSliverBuilder:
|
leading: const Center(child: BackButton()),
|
||||||
(BuildContext context, bool innerBoxIsScrolled) => <Widget>[
|
|
||||||
SliverAppBar(
|
|
||||||
leading: IconButton(
|
|
||||||
icon: const Icon(Icons.close_outlined),
|
|
||||||
onPressed: () =>
|
|
||||||
GoRouterState.of(context).uri.path.startsWith('/spaces/')
|
|
||||||
? context.pop()
|
|
||||||
: context.go(
|
|
||||||
['', 'rooms', controller.roomId!].join('/'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
elevation: Theme.of(context).appBarTheme.elevation,
|
elevation: Theme.of(context).appBarTheme.elevation,
|
||||||
expandedHeight: 300.0,
|
|
||||||
floating: true,
|
|
||||||
pinned: true,
|
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
if (room.canonicalAlias.isNotEmpty)
|
if (room.canonicalAlias.isNotEmpty)
|
||||||
IconButton(
|
IconButton(
|
||||||
|
@ -75,32 +64,130 @@ class ChatDetailsView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
ChatSettingsPopupMenu(room, false)
|
ChatSettingsPopupMenu(room, false)
|
||||||
],
|
],
|
||||||
title: Text(
|
title: Text(L10n.of(context)!.chatDetails),
|
||||||
room.getLocalizedDisplayname(
|
|
||||||
MatrixLocals(L10n.of(context)!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
backgroundColor: Theme.of(context).appBarTheme.backgroundColor,
|
backgroundColor: Theme.of(context).appBarTheme.backgroundColor,
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
|
||||||
background: ContentBanner(
|
|
||||||
mxContent: room.avatar,
|
|
||||||
onEdit: room.canSendEvent('m.room.avatar')
|
|
||||||
? controller.setAvatarAction
|
|
||||||
: null,
|
|
||||||
defaultIcon: Icons.group_outlined,
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
body: MaxWidthBody(
|
body: MaxWidthBody(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: controller.members!.length +
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
1 +
|
shrinkWrap: true,
|
||||||
(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,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(32.0),
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Material(
|
||||||
|
elevation: Theme.of(context)
|
||||||
|
.appBarTheme
|
||||||
|
.scrolledUnderElevation ??
|
||||||
|
4,
|
||||||
|
shadowColor: Theme.of(context)
|
||||||
|
.appBarTheme
|
||||||
|
.shadowColor,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
side: BorderSide(
|
||||||
|
color: Theme.of(context).dividerColor,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
Avatar.defaultSize * 2.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Avatar(
|
||||||
|
mxContent: room.avatar,
|
||||||
|
name: displayname,
|
||||||
|
size: Avatar.defaultSize * 2.5,
|
||||||
|
fontSize: 18 * 2.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (room.canChangeStateEvent(
|
||||||
|
EventTypes.RoomAvatar,
|
||||||
|
))
|
||||||
|
Positioned(
|
||||||
|
bottom: 0,
|
||||||
|
right: 0,
|
||||||
|
child: FloatingActionButton.small(
|
||||||
|
onPressed: controller.setAvatarAction,
|
||||||
|
heroTag: null,
|
||||||
|
child: const Icon(
|
||||||
|
Icons.camera_alt_outlined,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
TextButton.icon(
|
||||||
|
onPressed: () => room.canChangeStateEvent(
|
||||||
|
EventTypes.RoomName,
|
||||||
|
)
|
||||||
|
? controller.setDisplaynameAction()
|
||||||
|
: FluffyShare.share(
|
||||||
|
displayname,
|
||||||
|
context,
|
||||||
|
copyOnly: true,
|
||||||
|
),
|
||||||
|
icon: Icon(
|
||||||
|
room.canChangeStateEvent(
|
||||||
|
EventTypes.RoomName,
|
||||||
|
)
|
||||||
|
? Icons.edit_outlined
|
||||||
|
: Icons.copy_outlined,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
foregroundColor: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onBackground,
|
||||||
|
),
|
||||||
|
label: Text(
|
||||||
|
displayname,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
// style: const TextStyle(fontSize: 18),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton.icon(
|
||||||
|
onPressed: () => context.go(
|
||||||
|
'/rooms/${controller.roomId}/details/members',
|
||||||
|
),
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.group_outlined,
|
||||||
|
size: 14,
|
||||||
|
),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
foregroundColor: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.secondary,
|
||||||
|
),
|
||||||
|
label: Text(
|
||||||
|
L10n.of(context)!.countParticipants(
|
||||||
|
actualMembersCount,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
// style: const TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
height: 1,
|
||||||
|
color: Theme.of(context).dividerColor,
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: room.canSendEvent(EventTypes.RoomTopic)
|
onTap: room.canSendEvent(EventTypes.RoomTopic)
|
||||||
? controller.setTopicAction
|
? controller.setTopicAction
|
||||||
|
@ -121,70 +208,35 @@ class ChatDetailsView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (room.topic.isNotEmpty)
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 16.0,
|
horizontal: 16.0,
|
||||||
),
|
),
|
||||||
child: Linkify(
|
child: Linkify(
|
||||||
text: room.topic.isEmpty
|
text: room.topic.isEmpty
|
||||||
? L10n.of(context)!.addGroupDescription
|
? L10n.of(context)!.noGroupDescriptionYet
|
||||||
: room.topic,
|
: room.topic,
|
||||||
options: const LinkifyOptions(humanize: false),
|
options: const LinkifyOptions(humanize: false),
|
||||||
linkStyle:
|
linkStyle:
|
||||||
const TextStyle(color: Colors.blueAccent),
|
const TextStyle(color: Colors.blueAccent),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: Theme.of(context)
|
fontStyle: room.topic.isEmpty
|
||||||
.textTheme
|
? FontStyle.italic
|
||||||
.bodyMedium!
|
: FontStyle.normal,
|
||||||
.color,
|
color:
|
||||||
decorationColor: Theme.of(context)
|
Theme.of(context).textTheme.bodyMedium!.color,
|
||||||
.textTheme
|
decorationColor:
|
||||||
.bodyMedium!
|
Theme.of(context).textTheme.bodyMedium!.color,
|
||||||
.color,
|
|
||||||
),
|
),
|
||||||
onOpen: (url) =>
|
onOpen: (url) =>
|
||||||
UrlLauncher(context, url.url).launchUrl(),
|
UrlLauncher(context, url.url).launchUrl(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 16),
|
||||||
const Divider(height: 1),
|
Divider(
|
||||||
ListTile(
|
height: 1,
|
||||||
title: Text(
|
color: Theme.of(context).dividerColor,
|
||||||
L10n.of(context)!.settings,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
trailing: Icon(
|
|
||||||
controller.displaySettings
|
|
||||||
? Icons.keyboard_arrow_down_outlined
|
|
||||||
: Icons.keyboard_arrow_right_outlined,
|
|
||||||
),
|
|
||||||
onTap: controller.toggleDisplaySettings,
|
|
||||||
),
|
|
||||||
if (controller.displaySettings) ...[
|
|
||||||
if (room.canSendEvent('m.room.name'))
|
|
||||||
ListTile(
|
|
||||||
leading: CircleAvatar(
|
|
||||||
backgroundColor:
|
|
||||||
Theme.of(context).scaffoldBackgroundColor,
|
|
||||||
foregroundColor: iconColor,
|
|
||||||
child: const Icon(
|
|
||||||
Icons.people_outline_outlined,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
L10n.of(context)!.changeTheNameOfTheGroup,
|
|
||||||
),
|
|
||||||
subtitle: Text(
|
|
||||||
room.getLocalizedDisplayname(
|
|
||||||
MatrixLocals(L10n.of(context)!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: controller.setDisplaynameAction,
|
|
||||||
),
|
),
|
||||||
if (room.joinRules == JoinRules.public)
|
if (room.joinRules == JoinRules.public)
|
||||||
ListTile(
|
ListTile(
|
||||||
|
@ -194,6 +246,7 @@ class ChatDetailsView extends StatelessWidget {
|
||||||
foregroundColor: iconColor,
|
foregroundColor: iconColor,
|
||||||
child: const Icon(Icons.link_outlined),
|
child: const Icon(Icons.link_outlined),
|
||||||
),
|
),
|
||||||
|
trailing: const Icon(Icons.chevron_right_outlined),
|
||||||
onTap: controller.editAliases,
|
onTap: controller.editAliases,
|
||||||
title: Text(L10n.of(context)!.editRoomAliases),
|
title: Text(L10n.of(context)!.editRoomAliases),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
|
@ -214,31 +267,9 @@ class ChatDetailsView extends StatelessWidget {
|
||||||
title: Text(L10n.of(context)!.emoteSettings),
|
title: Text(L10n.of(context)!.emoteSettings),
|
||||||
subtitle: Text(L10n.of(context)!.setCustomEmotes),
|
subtitle: Text(L10n.of(context)!.setCustomEmotes),
|
||||||
onTap: controller.goToEmoteSettings,
|
onTap: controller.goToEmoteSettings,
|
||||||
|
trailing: const Icon(Icons.chevron_right_outlined),
|
||||||
),
|
),
|
||||||
PopupMenuButton(
|
ListTile(
|
||||||
onSelected: controller.setJoinRulesAction,
|
|
||||||
itemBuilder: (BuildContext context) =>
|
|
||||||
<PopupMenuEntry<JoinRules>>[
|
|
||||||
if (room.canChangeJoinRules)
|
|
||||||
PopupMenuItem<JoinRules>(
|
|
||||||
value: JoinRules.public,
|
|
||||||
child: Text(
|
|
||||||
JoinRules.public.getLocalizedString(
|
|
||||||
MatrixLocals(L10n.of(context)!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (room.canChangeJoinRules)
|
|
||||||
PopupMenuItem<JoinRules>(
|
|
||||||
value: JoinRules.invite,
|
|
||||||
child: Text(
|
|
||||||
JoinRules.invite.getLocalizedString(
|
|
||||||
MatrixLocals(L10n.of(context)!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
child: ListTile(
|
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Theme.of(context).scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
|
@ -248,66 +279,23 @@ class ChatDetailsView extends StatelessWidget {
|
||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context)!.whoIsAllowedToJoinThisGroup,
|
L10n.of(context)!.whoIsAllowedToJoinThisGroup,
|
||||||
),
|
),
|
||||||
|
trailing: const Icon(Icons.chevron_right_outlined),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
room.joinRules?.getLocalizedString(
|
room.joinRules?.getLocalizedString(
|
||||||
MatrixLocals(L10n.of(context)!),
|
MatrixLocals(L10n.of(context)!),
|
||||||
) ??
|
) ??
|
||||||
L10n.of(context)!.none,
|
L10n.of(context)!.none,
|
||||||
),
|
),
|
||||||
|
onTap: controller.setJoinRules,
|
||||||
),
|
),
|
||||||
),
|
ListTile(
|
||||||
PopupMenuButton(
|
|
||||||
onSelected: controller.setHistoryVisibilityAction,
|
|
||||||
itemBuilder: (BuildContext context) =>
|
|
||||||
<PopupMenuEntry<HistoryVisibility>>[
|
|
||||||
if (room.canChangeHistoryVisibility)
|
|
||||||
PopupMenuItem<HistoryVisibility>(
|
|
||||||
value: HistoryVisibility.invited,
|
|
||||||
child: Text(
|
|
||||||
HistoryVisibility.invited
|
|
||||||
.getLocalizedString(
|
|
||||||
MatrixLocals(L10n.of(context)!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (room.canChangeHistoryVisibility)
|
|
||||||
PopupMenuItem<HistoryVisibility>(
|
|
||||||
value: HistoryVisibility.joined,
|
|
||||||
child: Text(
|
|
||||||
HistoryVisibility.joined
|
|
||||||
.getLocalizedString(
|
|
||||||
MatrixLocals(L10n.of(context)!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (room.canChangeHistoryVisibility)
|
|
||||||
PopupMenuItem<HistoryVisibility>(
|
|
||||||
value: HistoryVisibility.shared,
|
|
||||||
child: Text(
|
|
||||||
HistoryVisibility.shared
|
|
||||||
.getLocalizedString(
|
|
||||||
MatrixLocals(L10n.of(context)!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (room.canChangeHistoryVisibility)
|
|
||||||
PopupMenuItem<HistoryVisibility>(
|
|
||||||
value: HistoryVisibility.worldReadable,
|
|
||||||
child: Text(
|
|
||||||
HistoryVisibility.worldReadable
|
|
||||||
.getLocalizedString(
|
|
||||||
MatrixLocals(L10n.of(context)!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
child: ListTile(
|
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Theme.of(context).scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
foregroundColor: iconColor,
|
foregroundColor: iconColor,
|
||||||
child: const Icon(Icons.visibility_outlined),
|
child: const Icon(Icons.visibility_outlined),
|
||||||
),
|
),
|
||||||
|
trailing: const Icon(Icons.chevron_right_outlined),
|
||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context)!.visibilityOfTheChatHistory,
|
L10n.of(context)!.visibilityOfTheChatHistory,
|
||||||
),
|
),
|
||||||
|
@ -317,46 +305,19 @@ class ChatDetailsView extends StatelessWidget {
|
||||||
) ??
|
) ??
|
||||||
L10n.of(context)!.none,
|
L10n.of(context)!.none,
|
||||||
),
|
),
|
||||||
),
|
onTap: controller.setHistoryVisibility,
|
||||||
),
|
),
|
||||||
if (room.joinRules == JoinRules.public)
|
if (room.joinRules == JoinRules.public)
|
||||||
PopupMenuButton(
|
ListTile(
|
||||||
onSelected: controller.setGuestAccessAction,
|
|
||||||
itemBuilder: (BuildContext context) =>
|
|
||||||
<PopupMenuEntry<GuestAccess>>[
|
|
||||||
if (room.canChangeGuestAccess)
|
|
||||||
PopupMenuItem<GuestAccess>(
|
|
||||||
value: GuestAccess.canJoin,
|
|
||||||
child: Text(
|
|
||||||
GuestAccess.canJoin.getLocalizedString(
|
|
||||||
MatrixLocals(
|
|
||||||
L10n.of(context)!,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (room.canChangeGuestAccess)
|
|
||||||
PopupMenuItem<GuestAccess>(
|
|
||||||
value: GuestAccess.forbidden,
|
|
||||||
child: Text(
|
|
||||||
GuestAccess.forbidden
|
|
||||||
.getLocalizedString(
|
|
||||||
MatrixLocals(
|
|
||||||
L10n.of(context)!,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
child: ListTile(
|
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor: Theme.of(context)
|
backgroundColor:
|
||||||
.scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
foregroundColor: iconColor,
|
foregroundColor: iconColor,
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Icons.person_add_alt_1_outlined,
|
Icons.person_add_alt_1_outlined,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
trailing: const Icon(Icons.chevron_right_outlined),
|
||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context)!.areGuestsAllowedToJoin,
|
L10n.of(context)!.areGuestsAllowedToJoin,
|
||||||
),
|
),
|
||||||
|
@ -365,11 +326,10 @@ class ChatDetailsView extends StatelessWidget {
|
||||||
MatrixLocals(L10n.of(context)!),
|
MatrixLocals(L10n.of(context)!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
onTap: controller.setGuestAccess,
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title:
|
title: Text(L10n.of(context)!.editChatPermissions),
|
||||||
Text(L10n.of(context)!.editChatPermissions),
|
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
L10n.of(context)!.whoCanPerformWhichAction,
|
L10n.of(context)!.whoCanPerformWhichAction,
|
||||||
),
|
),
|
||||||
|
@ -381,60 +341,59 @@ class ChatDetailsView extends StatelessWidget {
|
||||||
Icons.edit_attributes_outlined,
|
Icons.edit_attributes_outlined,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
trailing: const Icon(Icons.chevron_right_outlined),
|
||||||
onTap: () => context
|
onTap: () => context
|
||||||
.go('/rooms/${room.id}/details/permissions'),
|
.go('/rooms/${room.id}/details/permissions'),
|
||||||
),
|
),
|
||||||
],
|
Divider(
|
||||||
const Divider(height: 1),
|
height: 1,
|
||||||
|
color: Theme.of(context).dividerColor,
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
actualMembersCount > 1
|
L10n.of(context)!.countParticipants(
|
||||||
? L10n.of(context)!.countParticipants(
|
|
||||||
actualMembersCount.toString(),
|
actualMembersCount.toString(),
|
||||||
)
|
),
|
||||||
: L10n.of(context)!.emptyChat,
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
room.canInvite
|
if (room.canInvite)
|
||||||
? ListTile(
|
ListTile(
|
||||||
title: Text(L10n.of(context)!.inviteContact),
|
title: Text(L10n.of(context)!.inviteContact),
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor:
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
Theme.of(context).primaryColor,
|
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
radius: Avatar.defaultSize / 2,
|
radius: Avatar.defaultSize / 2,
|
||||||
child: const Icon(Icons.add_outlined),
|
child: const Icon(Icons.add_outlined),
|
||||||
),
|
),
|
||||||
onTap: () =>
|
trailing: const Icon(Icons.chevron_right_outlined),
|
||||||
context.go('/rooms/${room.id}/invite'),
|
onTap: () => context.go('/rooms/${room.id}/invite'),
|
||||||
)
|
),
|
||||||
: const SizedBox.shrink(),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: i < controller.members!.length + 1
|
: i < members.length + 1
|
||||||
? ParticipantListItem(controller.members![i - 1])
|
? ParticipantListItem(members[i - 1])
|
||||||
: ListTile(
|
: ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context)!.loadCountMoreParticipants(
|
L10n.of(context)!.loadCountMoreParticipants(
|
||||||
(actualMembersCount -
|
(actualMembersCount - members.length).toString(),
|
||||||
controller.members!.length)
|
|
||||||
.toString(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Theme.of(context).scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Icons.refresh,
|
Icons.group_outlined,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: controller.requestMoreMembersAction,
|
onTap: () => context.go(
|
||||||
|
'/rooms/${controller.roomId!}/details/members',
|
||||||
),
|
),
|
||||||
|
trailing: const Icon(Icons.chevron_right_outlined),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -38,7 +38,12 @@ class ParticipantListItem extends StatelessWidget {
|
||||||
),
|
),
|
||||||
title: Row(
|
title: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(user.calcDisplayname()),
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
user.calcDisplayname(),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
if (permissionBatch.isNotEmpty)
|
if (permissionBatch.isNotEmpty)
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
|
|
|
@ -18,6 +18,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||||
|
|
||||||
return SliverAppBar(
|
return SliverAppBar(
|
||||||
floating: true,
|
floating: true,
|
||||||
|
toolbarHeight: Theme.of(context).appBarTheme.toolbarHeight ?? 56,
|
||||||
pinned:
|
pinned:
|
||||||
FluffyThemes.isColumnMode(context) || selectMode != SelectMode.normal,
|
FluffyThemes.isColumnMode(context) || selectMode != SelectMode.normal,
|
||||||
scrolledUnderElevation: selectMode == SelectMode.normal ? 0 : null,
|
scrolledUnderElevation: selectMode == SelectMode.normal ? 0 : null,
|
||||||
|
|
76
lib/pages/chat_members/chat_members.dart
Normal file
76
lib/pages/chat_members/chat_members.dart
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
|
import '../../widgets/matrix.dart';
|
||||||
|
import 'chat_members_view.dart';
|
||||||
|
|
||||||
|
class ChatMembersPage extends StatefulWidget {
|
||||||
|
final String roomId;
|
||||||
|
const ChatMembersPage({required this.roomId, super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ChatMembersPage> createState() => ChatMembersController();
|
||||||
|
}
|
||||||
|
|
||||||
|
class ChatMembersController extends State<ChatMembersPage> {
|
||||||
|
List<User>? members;
|
||||||
|
List<User>? filteredMembers;
|
||||||
|
Object? error;
|
||||||
|
|
||||||
|
final TextEditingController filterController = TextEditingController();
|
||||||
|
|
||||||
|
void setFilter([_]) async {
|
||||||
|
final filter = filterController.text.toLowerCase().trim();
|
||||||
|
|
||||||
|
if (filter.isEmpty) {
|
||||||
|
setState(() {
|
||||||
|
filteredMembers = members
|
||||||
|
?..sort((b, a) => a.powerLevel.compareTo(b.powerLevel));
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
filteredMembers = members
|
||||||
|
?.where(
|
||||||
|
(user) =>
|
||||||
|
user.displayName?.toLowerCase().contains(filter) ??
|
||||||
|
user.id.toLowerCase().contains(filter),
|
||||||
|
)
|
||||||
|
.toList()
|
||||||
|
?..sort((b, a) => a.powerLevel.compareTo(b.powerLevel));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void refreshMembers() async {
|
||||||
|
try {
|
||||||
|
setState(() {
|
||||||
|
error = null;
|
||||||
|
});
|
||||||
|
final participants = await Matrix.of(context)
|
||||||
|
.client
|
||||||
|
.getRoomById(widget.roomId)
|
||||||
|
?.requestParticipants();
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
members = participants;
|
||||||
|
});
|
||||||
|
setFilter();
|
||||||
|
} catch (e, s) {
|
||||||
|
Logs()
|
||||||
|
.d('Unable to request participants. Try again in 3 seconds...', e, s);
|
||||||
|
setState(() {
|
||||||
|
error = e;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
refreshMembers();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => ChatMembersView(this);
|
||||||
|
}
|
101
lib/pages/chat_members/chat_members_view.dart
Normal file
101
lib/pages/chat_members/chat_members_view.dart
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||||
|
import '../../widgets/layouts/max_width_body.dart';
|
||||||
|
import '../../widgets/matrix.dart';
|
||||||
|
import '../chat_details/participant_list_item.dart';
|
||||||
|
import 'chat_members.dart';
|
||||||
|
|
||||||
|
class ChatMembersView extends StatelessWidget {
|
||||||
|
final ChatMembersController controller;
|
||||||
|
const ChatMembersView(this.controller, {super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final room =
|
||||||
|
Matrix.of(context).client.getRoomById(controller.widget.roomId);
|
||||||
|
if (room == null) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(L10n.of(context)!.oopsSomethingWentWrong),
|
||||||
|
),
|
||||||
|
body: Center(
|
||||||
|
child: Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final members = controller.filteredMembers;
|
||||||
|
|
||||||
|
final roomCount = (room.summary.mJoinedMemberCount ?? 0) +
|
||||||
|
(room.summary.mInvitedMemberCount ?? 0);
|
||||||
|
|
||||||
|
final error = controller.error;
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
leading: const Center(child: BackButton()),
|
||||||
|
title: Text(
|
||||||
|
L10n.of(context)!.countParticipants(roomCount),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => context.go('/rooms/{room.id}/invite'),
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.person_add_outlined,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: MaxWidthBody(
|
||||||
|
withScrolling: false,
|
||||||
|
child: error != null
|
||||||
|
? Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.error_outline),
|
||||||
|
Text(error.toLocalizedString(context)),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
OutlinedButton.icon(
|
||||||
|
onPressed: controller.refreshMembers,
|
||||||
|
icon: const Icon(Icons.refresh_outlined),
|
||||||
|
label: Text(L10n.of(context)!.tryAgain),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: members == null
|
||||||
|
? const Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(16.0),
|
||||||
|
child: CircularProgressIndicator.adaptive(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: members.length + 1,
|
||||||
|
itemBuilder: (context, i) => i == 0
|
||||||
|
? Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: TextField(
|
||||||
|
controller: controller.filterController,
|
||||||
|
onChanged: controller.setFilter,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
prefixIcon: const Icon(Icons.search_outlined),
|
||||||
|
hintText: L10n.of(context)!.search,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ParticipantListItem(members[i - 1]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/pages/chat_permissions_settings/chat_permissions_settings.dart';
|
import 'package:fluffychat/pages/chat_permissions_settings/chat_permissions_settings.dart';
|
||||||
|
@ -19,17 +18,10 @@ class ChatPermissionsSettingsView extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: GoRouterState.of(context).uri.path.startsWith('/spaces/')
|
leading: const Center(child: BackButton()),
|
||||||
? null
|
|
||||||
: IconButton(
|
|
||||||
icon: const Icon(Icons.close_outlined),
|
|
||||||
onPressed: () =>
|
|
||||||
context.go(['', 'rooms', controller.roomId!].join('/')),
|
|
||||||
),
|
|
||||||
title: Text(L10n.of(context)!.editChatPermissions),
|
title: Text(L10n.of(context)!.editChatPermissions),
|
||||||
),
|
),
|
||||||
body: MaxWidthBody(
|
body: MaxWidthBody(
|
||||||
withScrolling: true,
|
|
||||||
child: StreamBuilder(
|
child: StreamBuilder(
|
||||||
stream: controller.onChanged,
|
stream: controller.onChanged,
|
||||||
builder: (context, _) {
|
builder: (context, _) {
|
||||||
|
|
|
@ -33,7 +33,6 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
|
|
||||||
void removeDevicesAction(List<Device> devices) async {
|
void removeDevicesAction(List<Device> devices) async {
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
|
@ -68,7 +67,6 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
|
|
||||||
void renameDeviceAction(Device device) async {
|
void renameDeviceAction(Device device) async {
|
||||||
final displayName = await showTextInputDialog(
|
final displayName = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.changeDeviceName,
|
title: L10n.of(context)!.changeDeviceName,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
|
|
@ -39,6 +39,8 @@ class DevicesSettingsView extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemCount: controller.notThisDevice.length + 1,
|
itemCount: controller.notThisDevice.length + 1,
|
||||||
itemBuilder: (BuildContext context, int i) {
|
itemBuilder: (BuildContext context, int i) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/pages/invitation_selection/invitation_selection_view.dart';
|
import 'package:fluffychat/pages/invitation_selection/invitation_selection_view.dart';
|
||||||
|
@ -14,7 +13,11 @@ import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import '../../utils/localized_exception_extension.dart';
|
import '../../utils/localized_exception_extension.dart';
|
||||||
|
|
||||||
class InvitationSelection extends StatefulWidget {
|
class InvitationSelection extends StatefulWidget {
|
||||||
const InvitationSelection({Key? key}) : super(key: key);
|
final String roomId;
|
||||||
|
const InvitationSelection({
|
||||||
|
Key? key,
|
||||||
|
required this.roomId,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvitationSelectionController createState() =>
|
InvitationSelectionController createState() =>
|
||||||
|
@ -28,7 +31,7 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
||||||
List<Profile> foundProfiles = [];
|
List<Profile> foundProfiles = [];
|
||||||
Timer? coolDown;
|
Timer? coolDown;
|
||||||
|
|
||||||
String? get roomId => GoRouterState.of(context).pathParameters['roomid'];
|
String? get roomId => widget.roomId;
|
||||||
|
|
||||||
Future<List<User>> getContacts(BuildContext context) async {
|
Future<List<User>> getContacts(BuildContext context) async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
|
@ -37,12 +40,10 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
||||||
participants.removeWhere(
|
participants.removeWhere(
|
||||||
(u) => ![Membership.join, Membership.invite].contains(u.membership),
|
(u) => ![Membership.join, Membership.invite].contains(u.membership),
|
||||||
);
|
);
|
||||||
final participantsIds = participants.map((p) => p.stateKey).toList();
|
|
||||||
final contacts = client.rooms
|
final contacts = client.rooms
|
||||||
.where((r) => r.isDirectChat)
|
.where((r) => r.isDirectChat)
|
||||||
.map((r) => r.unsafeGetUserFromMemoryOrFallback(r.directChatMatrixID!))
|
.map((r) => r.unsafeGetUserFromMemoryOrFallback(r.directChatMatrixID!))
|
||||||
.toList()
|
.toList();
|
||||||
..removeWhere((u) => participantsIds.contains(u.stateKey));
|
|
||||||
contacts.sort(
|
contacts.sort(
|
||||||
(a, b) => a.calcDisplayname().toLowerCase().compareTo(
|
(a, b) => a.calcDisplayname().toLowerCase().compareTo(
|
||||||
b.calcDisplayname().toLowerCase(),
|
b.calcDisplayname().toLowerCase(),
|
||||||
|
@ -51,17 +52,19 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
||||||
return contacts;
|
return contacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void inviteAction(BuildContext context, String id) async {
|
void inviteAction(BuildContext context, String id, String displayname) async {
|
||||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||||
if (OkCancelResult.ok !=
|
if (OkCancelResult.ok !=
|
||||||
await showOkCancelAlertDialog(
|
await showOkCancelAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.inviteContactToGroup(
|
title: L10n.of(context)!.inviteContact,
|
||||||
|
message: L10n.of(context)!.inviteContactToGroupQuestion(
|
||||||
|
displayname,
|
||||||
room.getLocalizedDisplayname(
|
room.getLocalizedDisplayname(
|
||||||
MatrixLocals(L10n.of(context)!),
|
MatrixLocals(L10n.of(context)!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.invite,
|
||||||
cancelLabel: L10n.of(context)!.cancel,
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
)) {
|
)) {
|
||||||
return;
|
return;
|
||||||
|
@ -118,19 +121,6 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final participants = Matrix.of(context)
|
|
||||||
.client
|
|
||||||
.getRoomById(roomId!)!
|
|
||||||
.getParticipants()
|
|
||||||
.where(
|
|
||||||
(user) =>
|
|
||||||
[Membership.join, Membership.invite].contains(user.membership),
|
|
||||||
)
|
|
||||||
.toList();
|
|
||||||
foundProfiles.removeWhere(
|
|
||||||
(profile) =>
|
|
||||||
participants.indexWhere((u) => u.id == profile.userId) != -1,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/pages/invitation_selection/invitation_selection.dart';
|
import 'package:fluffychat/pages/invitation_selection/invitation_selection.dart';
|
||||||
|
@ -20,23 +19,20 @@ class InvitationSelectionView extends StatelessWidget {
|
||||||
final groupName = room.name.isEmpty ? L10n.of(context)!.group : room.name;
|
final groupName = room.name.isEmpty ? L10n.of(context)!.group : room.name;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: GoRouterState.of(context).uri.path.startsWith('/spaces/')
|
leading: const Center(child: BackButton()),
|
||||||
? null
|
|
||||||
: IconButton(
|
|
||||||
icon: const Icon(Icons.close_outlined),
|
|
||||||
onPressed: () =>
|
|
||||||
context.go(['', 'rooms', controller.roomId!].join('/')),
|
|
||||||
),
|
|
||||||
titleSpacing: 0,
|
titleSpacing: 0,
|
||||||
title: SizedBox(
|
title: Text(L10n.of(context)!.inviteContact),
|
||||||
height: 44,
|
),
|
||||||
child: Padding(
|
body: MaxWidthBody(
|
||||||
padding: const EdgeInsets.only(right: 12.0),
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
textInputAction: TextInputAction.search,
|
textInputAction: TextInputAction.search,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: L10n.of(context)!.inviteContactToGroup(groupName),
|
hintText: L10n.of(context)!.inviteContactToGroup(groupName),
|
||||||
suffixIcon: controller.loading
|
prefixIcon: controller.loading
|
||||||
? const Padding(
|
? const Padding(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
vertical: 10.0,
|
vertical: 10.0,
|
||||||
|
@ -54,29 +50,32 @@ class InvitationSelectionView extends StatelessWidget {
|
||||||
onChanged: controller.searchUserWithCoolDown,
|
onChanged: controller.searchUserWithCoolDown,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
StreamBuilder<Object>(
|
||||||
),
|
stream: room.onUpdate.stream,
|
||||||
body: MaxWidthBody(
|
builder: (context, snapshot) {
|
||||||
withScrolling: true,
|
final participants =
|
||||||
child: controller.foundProfiles.isNotEmpty
|
room.getParticipants().map((user) => user.id).toSet();
|
||||||
|
return controller.foundProfiles.isNotEmpty
|
||||||
? ListView.builder(
|
? ListView.builder(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: controller.foundProfiles.length,
|
itemCount: controller.foundProfiles.length,
|
||||||
itemBuilder: (BuildContext context, int i) => ListTile(
|
itemBuilder: (BuildContext context, int i) =>
|
||||||
leading: Avatar(
|
_InviteContactListTile(
|
||||||
mxContent: controller.foundProfiles[i].avatarUrl,
|
avatarUrl: controller.foundProfiles[i].avatarUrl,
|
||||||
name: controller.foundProfiles[i].displayName ??
|
displayname: controller
|
||||||
controller.foundProfiles[i].userId,
|
.foundProfiles[i].displayName ??
|
||||||
),
|
controller.foundProfiles[i].userId.localpart ??
|
||||||
title: Text(
|
L10n.of(context)!.user,
|
||||||
controller.foundProfiles[i].displayName ??
|
userId: controller.foundProfiles[i].userId,
|
||||||
controller.foundProfiles[i].userId.localpart!,
|
isMember: participants
|
||||||
),
|
.contains(controller.foundProfiles[i].userId),
|
||||||
subtitle: Text(controller.foundProfiles[i].userId),
|
|
||||||
onTap: () => controller.inviteAction(
|
onTap: () => controller.inviteAction(
|
||||||
context,
|
context,
|
||||||
controller.foundProfiles[i].userId,
|
controller.foundProfiles[i].userId,
|
||||||
|
controller.foundProfiles[i].displayName ??
|
||||||
|
controller.foundProfiles[i].userId.localpart ??
|
||||||
|
L10n.of(context)!.user,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -85,7 +84,9 @@ class InvitationSelectionView extends StatelessWidget {
|
||||||
builder: (BuildContext context, snapshot) {
|
builder: (BuildContext context, snapshot) {
|
||||||
if (!snapshot.hasData) {
|
if (!snapshot.hasData) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator.adaptive(strokeWidth: 2),
|
child: CircularProgressIndicator.adaptive(
|
||||||
|
strokeWidth: 2,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final contacts = snapshot.data!;
|
final contacts = snapshot.data!;
|
||||||
|
@ -93,30 +94,76 @@ class InvitationSelectionView extends StatelessWidget {
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: contacts.length,
|
itemCount: contacts.length,
|
||||||
itemBuilder: (BuildContext context, int i) => ListTile(
|
itemBuilder: (BuildContext context, int i) =>
|
||||||
|
_InviteContactListTile(
|
||||||
|
avatarUrl: contacts[i].avatarUrl,
|
||||||
|
displayname: contacts[i].displayName ??
|
||||||
|
contacts[i].id.localpart ??
|
||||||
|
L10n.of(context)!.user,
|
||||||
|
userId: contacts[i].id,
|
||||||
|
isMember: participants.contains(contacts[i].id),
|
||||||
|
onTap: () => controller.inviteAction(
|
||||||
|
context,
|
||||||
|
contacts[i].id,
|
||||||
|
contacts[i].displayName ??
|
||||||
|
contacts[i].id.localpart ??
|
||||||
|
L10n.of(context)!.user,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InviteContactListTile extends StatelessWidget {
|
||||||
|
final String userId;
|
||||||
|
final String displayname;
|
||||||
|
final Uri? avatarUrl;
|
||||||
|
final bool isMember;
|
||||||
|
final void Function() onTap;
|
||||||
|
|
||||||
|
const _InviteContactListTile({
|
||||||
|
Key? key,
|
||||||
|
required this.userId,
|
||||||
|
required this.displayname,
|
||||||
|
required this.avatarUrl,
|
||||||
|
required this.isMember,
|
||||||
|
required this.onTap,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Opacity(
|
||||||
|
opacity: isMember ? 0.5 : 1,
|
||||||
|
child: ListTile(
|
||||||
leading: Avatar(
|
leading: Avatar(
|
||||||
mxContent: contacts[i].avatarUrl,
|
mxContent: avatarUrl,
|
||||||
name: contacts[i].calcDisplayname(),
|
name: displayname,
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
contacts[i].calcDisplayname(),
|
displayname,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
contacts[i].id,
|
userId,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () =>
|
onTap: isMember ? null : onTap,
|
||||||
controller.inviteAction(context, contacts[i].id),
|
trailing: isMember
|
||||||
),
|
? Text(L10n.of(context)!.participant)
|
||||||
);
|
: const Icon(Icons.person_add_outlined),
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class NewPrivateChatView extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: MaxWidthBody(
|
child: MaxWidthBody(
|
||||||
withScrolling: true,
|
withFrame: false,
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.all(_qrCodePadding),
|
margin: const EdgeInsets.all(_qrCodePadding),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
|
@ -98,7 +98,6 @@ class NewPrivateChatView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
MaxWidthBody(
|
MaxWidthBody(
|
||||||
withScrolling: false,
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: Form(
|
child: Form(
|
||||||
|
|
|
@ -24,7 +24,6 @@ class SettingsChatView extends StatelessWidget {
|
||||||
body: ListTileTheme(
|
body: ListTileTheme(
|
||||||
iconColor: Theme.of(context).textTheme.bodyLarge!.color,
|
iconColor: Theme.of(context).textTheme.bodyLarge!.color,
|
||||||
child: MaxWidthBody(
|
child: MaxWidthBody(
|
||||||
withScrolling: true,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
|
|
|
@ -59,6 +59,7 @@ class EmotesSettingsView extends StatelessWidget {
|
||||||
: null,
|
: null,
|
||||||
body: MaxWidthBody(
|
body: MaxWidthBody(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (!controller.readonly)
|
if (!controller.readonly)
|
||||||
Container(
|
Container(
|
||||||
|
@ -116,13 +117,8 @@ class EmotesSettingsView extends StatelessWidget {
|
||||||
onChanged: controller.setIsGloballyActive,
|
onChanged: controller.setIsGloballyActive,
|
||||||
),
|
),
|
||||||
if (!controller.readonly || controller.room != null)
|
if (!controller.readonly || controller.room != null)
|
||||||
Divider(
|
const Divider(thickness: 1),
|
||||||
height: 2,
|
imageKeys.isEmpty
|
||||||
thickness: 2,
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: imageKeys.isEmpty
|
|
||||||
? Center(
|
? Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
|
@ -133,6 +129,8 @@ class EmotesSettingsView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: ListView.separated(
|
: ListView.separated(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
separatorBuilder: (BuildContext context, int i) =>
|
separatorBuilder: (BuildContext context, int i) =>
|
||||||
const SizedBox.shrink(),
|
const SizedBox.shrink(),
|
||||||
itemCount: imageKeys.length + 1,
|
itemCount: imageKeys.length + 1,
|
||||||
|
@ -190,15 +188,13 @@ class EmotesSettingsView extends StatelessWidget {
|
||||||
prefixText: ': ',
|
prefixText: ': ',
|
||||||
suffixText: ':',
|
suffixText: ':',
|
||||||
prefixStyle: TextStyle(
|
prefixStyle: TextStyle(
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.colorScheme
|
Theme.of(context).colorScheme.secondary,
|
||||||
.secondary,
|
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
suffixStyle: TextStyle(
|
suffixStyle: TextStyle(
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.colorScheme
|
Theme.of(context).colorScheme.secondary,
|
||||||
.secondary,
|
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
|
@ -229,7 +225,6 @@ class EmotesSettingsView extends StatelessWidget {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -23,7 +23,6 @@ class SettingsNotificationsView extends StatelessWidget {
|
||||||
title: Text(L10n.of(context)!.notifications),
|
title: Text(L10n.of(context)!.notifications),
|
||||||
),
|
),
|
||||||
body: MaxWidthBody(
|
body: MaxWidthBody(
|
||||||
withScrolling: true,
|
|
||||||
child: StreamBuilder(
|
child: StreamBuilder(
|
||||||
stream: Matrix.of(context)
|
stream: Matrix.of(context)
|
||||||
.client
|
.client
|
||||||
|
|
|
@ -20,7 +20,6 @@ class SettingsSecurityView extends StatelessWidget {
|
||||||
body: ListTileTheme(
|
body: ListTileTheme(
|
||||||
iconColor: Theme.of(context).colorScheme.onBackground,
|
iconColor: Theme.of(context).colorScheme.onBackground,
|
||||||
child: MaxWidthBody(
|
child: MaxWidthBody(
|
||||||
withScrolling: true,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
|
|
|
@ -24,7 +24,6 @@ class SettingsStyleView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
body: MaxWidthBody(
|
body: MaxWidthBody(
|
||||||
withScrolling: true,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
|
|
|
@ -36,8 +36,9 @@ class FluffyChatApp extends StatelessWidget {
|
||||||
builder: (context, themeMode, primaryColor) => MaterialApp.router(
|
builder: (context, themeMode, primaryColor) => MaterialApp.router(
|
||||||
title: AppConfig.applicationName,
|
title: AppConfig.applicationName,
|
||||||
themeMode: themeMode,
|
themeMode: themeMode,
|
||||||
theme: FluffyThemes.buildTheme(Brightness.light, primaryColor),
|
theme: FluffyThemes.buildTheme(context, Brightness.light, primaryColor),
|
||||||
darkTheme: FluffyThemes.buildTheme(Brightness.dark, primaryColor),
|
darkTheme:
|
||||||
|
FluffyThemes.buildTheme(context, Brightness.dark, primaryColor),
|
||||||
scrollBehavior: CustomScrollBehavior(),
|
scrollBehavior: CustomScrollBehavior(),
|
||||||
localizationsDelegates: L10n.localizationsDelegates,
|
localizationsDelegates: L10n.localizationsDelegates,
|
||||||
supportedLocales: L10n.supportedLocales,
|
supportedLocales: L10n.supportedLocales,
|
||||||
|
|
|
@ -2,15 +2,19 @@ import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
|
|
||||||
class MaxWidthBody extends StatelessWidget {
|
class MaxWidthBody extends StatelessWidget {
|
||||||
final Widget? child;
|
final Widget? child;
|
||||||
final double maxWidth;
|
final double maxWidth;
|
||||||
|
final bool withFrame;
|
||||||
final bool withScrolling;
|
final bool withScrolling;
|
||||||
|
|
||||||
const MaxWidthBody({
|
const MaxWidthBody({
|
||||||
this.child,
|
this.child,
|
||||||
this.maxWidth = 600,
|
this.maxWidth = 600,
|
||||||
this.withScrolling = false,
|
this.withFrame = true,
|
||||||
|
this.withScrolling = true,
|
||||||
Key? key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
@override
|
@override
|
||||||
|
@ -18,20 +22,32 @@ class MaxWidthBody extends StatelessWidget {
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
|
final paddingVal = max(0, (constraints.maxWidth - maxWidth) / 2);
|
||||||
|
final hasPadding = paddingVal > 0;
|
||||||
final padding = EdgeInsets.symmetric(
|
final padding = EdgeInsets.symmetric(
|
||||||
|
vertical: hasPadding ? 32 : 0,
|
||||||
horizontal: max(0, (constraints.maxWidth - maxWidth) / 2),
|
horizontal: max(0, (constraints.maxWidth - maxWidth) / 2),
|
||||||
);
|
);
|
||||||
return withScrolling
|
final childWithPadding = Padding(
|
||||||
? SingleChildScrollView(
|
|
||||||
physics: const ScrollPhysics(),
|
|
||||||
child: Padding(
|
|
||||||
padding: padding,
|
padding: padding,
|
||||||
child: child,
|
child: withFrame && hasPadding
|
||||||
|
? Material(
|
||||||
|
elevation:
|
||||||
|
Theme.of(context).appBarTheme.scrolledUnderElevation ??
|
||||||
|
4,
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
AppConfig.borderRadius,
|
||||||
),
|
),
|
||||||
)
|
shadowColor: Theme.of(context).appBarTheme.shadowColor,
|
||||||
: Padding(
|
|
||||||
padding: padding,
|
|
||||||
child: child,
|
child: child,
|
||||||
|
)
|
||||||
|
: child,
|
||||||
|
);
|
||||||
|
if (!withScrolling) return childWithPadding;
|
||||||
|
return SingleChildScrollView(
|
||||||
|
physics: const ScrollPhysics(),
|
||||||
|
child: childWithPadding,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:fluffychat/config/themes.dart';
|
|
||||||
|
|
||||||
class SideViewLayout extends StatelessWidget {
|
|
||||||
final Widget mainView;
|
|
||||||
final Widget sideView;
|
|
||||||
final bool hideSideView;
|
|
||||||
|
|
||||||
const SideViewLayout({
|
|
||||||
Key? key,
|
|
||||||
required this.mainView,
|
|
||||||
required this.sideView,
|
|
||||||
required this.hideSideView,
|
|
||||||
}) : super(key: key);
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final sideView = this.sideView;
|
|
||||||
const sideViewWidth = 360.0;
|
|
||||||
final threeColumnMode = FluffyThemes.isThreeColumnMode(context);
|
|
||||||
return Stack(
|
|
||||||
children: [
|
|
||||||
AnimatedPositioned(
|
|
||||||
duration: FluffyThemes.animationDuration,
|
|
||||||
curve: FluffyThemes.animationCurve,
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
bottom: 0,
|
|
||||||
right: !threeColumnMode || hideSideView ? 0 : sideViewWidth,
|
|
||||||
child: ClipRRect(child: mainView),
|
|
||||||
),
|
|
||||||
AnimatedPositioned(
|
|
||||||
duration: FluffyThemes.animationDuration,
|
|
||||||
curve: FluffyThemes.animationCurve,
|
|
||||||
bottom: 0,
|
|
||||||
top: 0,
|
|
||||||
right: 0,
|
|
||||||
left: !threeColumnMode && !hideSideView ? 0 : null,
|
|
||||||
width: hideSideView
|
|
||||||
? 0
|
|
||||||
: !threeColumnMode
|
|
||||||
? null
|
|
||||||
: sideViewWidth,
|
|
||||||
child: hideSideView
|
|
||||||
? const SizedBox.shrink()
|
|
||||||
: Container(
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
left: BorderSide(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: sideView,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -25,8 +25,8 @@ class LockScreenState extends State<LockScreen> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: FluffyThemes.buildTheme(Brightness.light),
|
theme: FluffyThemes.buildTheme(context, Brightness.light),
|
||||||
darkTheme: FluffyThemes.buildTheme(Brightness.dark),
|
darkTheme: FluffyThemes.buildTheme(context, Brightness.dark),
|
||||||
localizationsDelegates: L10n.localizationsDelegates,
|
localizationsDelegates: L10n.localizationsDelegates,
|
||||||
supportedLocales: L10n.supportedLocales,
|
supportedLocales: L10n.supportedLocales,
|
||||||
home: Builder(
|
home: Builder(
|
||||||
|
|
Loading…
Reference in a new issue