diff --git a/lib/ui/screens/user_page_sections/about_user_section.dart b/lib/ui/screens/user_page_sections/about_user_section.dart index b4677c0..12faba4 100644 --- a/lib/ui/screens/user_page_sections/about_user_section.dart +++ b/lib/ui/screens/user_page_sections/about_user_section.dart @@ -1,8 +1,12 @@ +import 'package:comunic/enums/report_target_type.dart'; import 'package:comunic/enums/user_page_visibility.dart'; import 'package:comunic/helpers/friends_helper.dart'; +import 'package:comunic/helpers/server_config_helper.dart'; import 'package:comunic/models/advanced_user_info.dart'; import 'package:comunic/models/displayed_content.dart'; import 'package:comunic/models/friend_status.dart'; +import 'package:comunic/models/report_target.dart'; +import 'package:comunic/ui/dialogs/report_dialog.dart'; import 'package:comunic/ui/widgets/FrienshipStatusWidget.dart'; import 'package:comunic/ui/widgets/async_screen_widget.dart'; import 'package:comunic/ui/widgets/text_widget.dart'; @@ -21,7 +25,7 @@ class AboutUserSection extends StatefulWidget { const AboutUserSection({ Key? key, required this.user, - }) : super(key: key); + }) : super(key: key); @override _AboutUserSectionState createState() => _AboutUserSectionState(); @@ -129,6 +133,21 @@ class _AboutUserSectionState extends State { ? tr("Public page")! : tr("Private page")!)), ), + + // Report user + !widget.user.isCurrentUser && srvConfig!.isReportingEnabled + ? ListTile( + textColor: Colors.red, + leading: Icon(Icons.flag, color: Colors.red), + title: Text(tr("Report abuse")!), + onTap: _reportAbuse, + ) + : Container(), ], ); + + /// Report user + void _reportAbuse() => showReportDialog( + ctx: context, + target: ReportTarget(ReportTargetType.User, widget.user.id)); }