Add back missing settings (#1046)
* added back chat description button * added search button to chat header
This commit is contained in:
parent
a44305a5af
commit
3a18bccc31
4 changed files with 135 additions and 1 deletions
|
|
@ -4506,5 +4506,7 @@
|
|||
"invitePeopleChatSubtitle": "Invite users or admins to this chat",
|
||||
"invitePeopleSpaceSubtitle": "Invite users or admins to this space",
|
||||
"noCapacityLimit": "No capacity limit",
|
||||
"downloadGroupText": "Download group text"
|
||||
"downloadGroupText": "Download group text",
|
||||
"spaceDescription": "Space description",
|
||||
"addSpaceDescription": "Add a space description"
|
||||
}
|
||||
|
|
@ -116,6 +116,13 @@ class ChatView extends StatelessWidget {
|
|||
// #Pangea
|
||||
} else {
|
||||
return [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.search_outlined),
|
||||
tooltip: L10n.of(context)!.search,
|
||||
onPressed: () {
|
||||
context.go('/rooms/${controller.room.id}/search');
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.info_outline),
|
||||
tooltip: L10n.of(context)!.chatDetails,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:fluffychat/pages/settings/settings.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/pages/chat_details/pangea_chat_details.dart';
|
||||
import 'package:fluffychat/pangea/pages/class_settings/p_class_widgets/class_description_button.dart';
|
||||
import 'package:fluffychat/pangea/utils/set_class_name.dart';
|
||||
|
|
@ -246,10 +247,112 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
if (mounted) setState(() {});
|
||||
}
|
||||
|
||||
final TextEditingController _descriptionController = TextEditingController();
|
||||
|
||||
Future<void> setChatDescription() async {
|
||||
if (roomId == null) return;
|
||||
final room = Matrix.of(context).client.getRoomById(roomId!);
|
||||
if (room == null) return;
|
||||
|
||||
if (room.topic.isNotEmpty) {
|
||||
_descriptionController.text = room.topic;
|
||||
}
|
||||
|
||||
final response = await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Dialog(
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 400,
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 12,
|
||||
),
|
||||
child: Text(
|
||||
room.isSpace
|
||||
? L10n.of(context)!.spaceDescription
|
||||
: L10n.of(context)!.chatDescription,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(null),
|
||||
),
|
||||
],
|
||||
),
|
||||
TextFormField(
|
||||
onTapOutside: (_) =>
|
||||
FocusManager.instance.primaryFocus?.unfocus(),
|
||||
decoration: InputDecoration(
|
||||
hintText: room.isSpace
|
||||
? L10n.of(context)!.addSpaceDescription
|
||||
: L10n.of(context)!.addGroupDescription,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 28.0,
|
||||
vertical: 12.0,
|
||||
),
|
||||
),
|
||||
controller: _descriptionController,
|
||||
enabled: room.isRoomAdmin,
|
||||
minLines: 1, // Minimum number of lines
|
||||
maxLines:
|
||||
null, // Allow the field to expand based on content
|
||||
keyboardType: TextInputType.multiline,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(null),
|
||||
child: Text(L10n.of(context)!.cancel),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(
|
||||
room.isRoomAdmin ? _descriptionController.text : null,
|
||||
),
|
||||
child: Text(L10n.of(context)!.confirm),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
if (response == null) return;
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => room.setDescription(response),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
MatrixState.pangeaController.classController.addMissingRoomRules(roomId);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_descriptionController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
// Pangea#
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,6 +202,28 @@ class PangeaChatDetailsView extends StatelessWidget {
|
|||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
TextButton.icon(
|
||||
onPressed: controller.setChatDescription,
|
||||
icon: const Icon(
|
||||
Icons.description_outlined,
|
||||
size: 14,
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor:
|
||||
theme.colorScheme.secondary,
|
||||
),
|
||||
label: Text(
|
||||
room.topic.isEmpty
|
||||
? room.isSpace
|
||||
? L10n.of(context)!
|
||||
.spaceDescription
|
||||
: L10n.of(context)!
|
||||
.chatDescription
|
||||
: room.topic,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue