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 938 additions and 765 deletions
|
|
@ -8,6 +8,7 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:matrix/matrix.dart' as matrix;
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/pages/chat_details/chat_details_view.dart';
|
||||
|
|
@ -31,7 +32,6 @@ class ChatDetails extends StatefulWidget {
|
|||
}
|
||||
|
||||
class ChatDetailsController extends State<ChatDetails> {
|
||||
List<User>? members;
|
||||
bool displaySettings = false;
|
||||
|
||||
void toggleDisplaySettings() =>
|
||||
|
|
@ -42,7 +42,6 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
void setDisplaynameAction() async {
|
||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||
final input = await showTextInputDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
title: L10n.of(context)!.changeTheNameOfTheGroup,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
|
|
@ -103,7 +102,6 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
return setAliasAction();
|
||||
}
|
||||
final select = await showConfirmationDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
title: L10n.of(context)!.editRoomAliases,
|
||||
actions: [
|
||||
|
|
@ -176,7 +174,6 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
final domain = room.client.userID!.domain;
|
||||
|
||||
final input = await showTextInputDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
title: L10n.of(context)!.setInvitationLink,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
|
|
@ -201,17 +198,16 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
void setTopicAction() async {
|
||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||
final input = await showTextInputDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
title: L10n.of(context)!.setGroupDescription,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
cancelLabel: L10n.of(context)!.cancel,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: L10n.of(context)!.setGroupDescription,
|
||||
hintText: L10n.of(context)!.noGroupDescriptionYet,
|
||||
initialText: room.topic,
|
||||
minLines: 1,
|
||||
maxLines: 4,
|
||||
minLines: 4,
|
||||
maxLines: 8,
|
||||
)
|
||||
],
|
||||
);
|
||||
|
|
@ -229,30 +225,90 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
}
|
||||
}
|
||||
|
||||
void setGuestAccessAction(GuestAccess guestAccess) => showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => Matrix.of(context)
|
||||
.client
|
||||
.getRoomById(roomId!)!
|
||||
.setGuestAccess(guestAccess),
|
||||
);
|
||||
void setGuestAccess() async {
|
||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||
final currentGuestAccess = room.guestAccess;
|
||||
final newGuestAccess = await showConfirmationDialog<GuestAccess>(
|
||||
context: context,
|
||||
title: L10n.of(context)!.whoIsAllowedToJoinThisGroup,
|
||||
actions: GuestAccess.values
|
||||
.map(
|
||||
(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) =>
|
||||
showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => Matrix.of(context)
|
||||
.client
|
||||
.getRoomById(roomId!)!
|
||||
.setHistoryVisibility(historyVisibility),
|
||||
);
|
||||
void setHistoryVisibility() async {
|
||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||
final currentHistoryVisibility = room.historyVisibility;
|
||||
final newHistoryVisibility =
|
||||
await showConfirmationDialog<HistoryVisibility>(
|
||||
context: context,
|
||||
title: L10n.of(context)!.whoIsAllowedToJoinThisGroup,
|
||||
actions: HistoryVisibility.values
|
||||
.map(
|
||||
(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(
|
||||
context: context,
|
||||
future: () => Matrix.of(context)
|
||||
.client
|
||||
.getRoomById(roomId!)!
|
||||
.setJoinRules(joinRule),
|
||||
);
|
||||
void setJoinRules() async {
|
||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||
final currentJoinRule = room.joinRules;
|
||||
final newJoinRule = await showConfirmationDialog<JoinRules>(
|
||||
context: context,
|
||||
title: L10n.of(context)!.whoIsAllowedToJoinThisGroup,
|
||||
actions: JoinRules.values
|
||||
.map(
|
||||
(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 {
|
||||
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;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
members ??=
|
||||
Matrix.of(context).client.getRoomById(roomId!)!.getParticipants();
|
||||
return SizedBox(
|
||||
width: fixedWidth,
|
||||
child: ChatDetailsView(this),
|
||||
);
|
||||
}
|
||||
Widget build(BuildContext context) => ChatDetailsView(this);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue