Add reporting functionality
This commit is contained in:
parent
3ab8451a64
commit
cd61509f75
4 changed files with 82 additions and 2 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import "package:clipboard/clipboard.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_hooks/flutter_hooks.dart";
|
||||
import "package:matrix/matrix.dart";
|
||||
import "package:nexus/widgets/form_text_input.dart";
|
||||
|
||||
class RoomMenu extends StatelessWidget {
|
||||
final Room room;
|
||||
|
|
@ -51,6 +53,52 @@ class RoomMenu extends StatelessWidget {
|
|||
title: Text("Leave", style: TextStyle(color: danger)),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: () => showDialog(
|
||||
context: context,
|
||||
builder: (context) => HookBuilder(
|
||||
builder: (_) {
|
||||
final reasonController = useTextEditingController();
|
||||
return AlertDialog(
|
||||
title: Text("Report"),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
"Report this room to your server administrators, who can take action like banning this room.",
|
||||
),
|
||||
|
||||
SizedBox(height: 12),
|
||||
FormTextInput(
|
||||
required: false,
|
||||
capitalize: true,
|
||||
controller: reasonController,
|
||||
title: "Reason for deletion (optional)",
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
child: Text("Cancel"),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
room.client.reportRoom(room.id, reasonController.text);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text("Report"),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.report, color: danger),
|
||||
title: Text("Report", style: TextStyle(color: danger)),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue