This commit is contained in:
Filip Krawczyk 2021-10-25 19:52:29 +02:00
parent 8703246c65
commit 725807c75b
3 changed files with 23 additions and 24 deletions

View File

@ -1,5 +1,3 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:lemmy_api_client/v3.dart';
@ -163,16 +161,17 @@ class _CommentMoreMenuPopup extends HookWidget {
? const CircularProgressIndicator.adaptive()
: const Icon(Icons.flag),
title: const Text('Report'),
onTap: () {
if (store.reportingState.isLoading) return;
Navigator.of(context).pop();
loggedInAction((token) async {
final reason = await ReportDialog.show(context);
if (reason != null) {
unawaited(store.report(token, reason));
}
})();
},
onTap: store.reportingState.isLoading
? null
: () {
Navigator.of(context).pop();
loggedInAction((token) async {
final reason = await ReportDialog.show(context);
if (reason != null) {
await store.report(token, reason);
}
})();
},
),
ListTile(
leading: const Icon(Icons.info_outline),

View File

@ -1,5 +1,3 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
@ -129,16 +127,17 @@ class PostMoreMenu extends HookWidget {
? const CircularProgressIndicator.adaptive()
: const Icon(Icons.flag),
title: const Text('Report'),
onTap: () {
if (store.reportingState.isLoading) return;
Navigator.of(context).pop();
loggedInAction((token) async {
final reason = await ReportDialog.show(context);
if (reason != null) {
unawaited(store.report(token, reason));
}
})();
},
onTap: store.reportingState.isLoading
? null
: () {
Navigator.of(context).pop();
loggedInAction((token) async {
final reason = await ReportDialog.show(context);
if (reason != null) {
await store.report(token, reason);
}
})();
},
),
ListTile(
leading: const Icon(Icons.info_outline),

View File

@ -7,6 +7,7 @@ class ReportDialog extends HookWidget {
@override
Widget build(BuildContext context) {
final controller = useListenable(useTextEditingController());
return AlertDialog(
title: const Text('Report'),
content: TextField(