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,13 +161,14 @@ class _CommentMoreMenuPopup extends HookWidget {
? const CircularProgressIndicator.adaptive()
: const Icon(Icons.flag),
title: const Text('Report'),
onTap: () {
if (store.reportingState.isLoading) return;
onTap: store.reportingState.isLoading
? null
: () {
Navigator.of(context).pop();
loggedInAction((token) async {
final reason = await ReportDialog.show(context);
if (reason != null) {
unawaited(store.report(token, reason));
await store.report(token, reason);
}
})();
},

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,13 +127,14 @@ class PostMoreMenu extends HookWidget {
? const CircularProgressIndicator.adaptive()
: const Icon(Icons.flag),
title: const Text('Report'),
onTap: () {
if (store.reportingState.isLoading) return;
onTap: store.reportingState.isLoading
? null
: () {
Navigator.of(context).pop();
loggedInAction((token) async {
final reason = await ReportDialog.show(context);
if (reason != null) {
unawaited(store.report(token, reason));
await store.report(token, reason);
}
})();
},

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(