✨ Abuse reports
This commit is contained in:
@ -222,9 +222,17 @@ class AccountScreen extends HookConsumerWidget {
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 24),
|
||||
title: Text('relationships').tr(),
|
||||
onTap: () {
|
||||
context.push('/account/relationship');
|
||||
context.push('/account/relationships');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
minTileHeight: 48,
|
||||
title: Text('abuseReports').tr(),
|
||||
contentPadding: const EdgeInsets.only(left: 24, right: 17),
|
||||
leading: const Icon(Symbols.gavel),
|
||||
trailing: const Icon(Symbols.chevron_right),
|
||||
onTap: () => context.push('/safety/reports/me'),
|
||||
),
|
||||
const Divider(height: 1).padding(vertical: 8),
|
||||
ListTile(
|
||||
minTileHeight: 48,
|
||||
|
@ -395,7 +395,7 @@ class _AccountAppbarForcegroundColorProviderElement
|
||||
String get uname => (origin as AccountAppbarForcegroundColorProvider).uname;
|
||||
}
|
||||
|
||||
String _$accountDirectChatHash() => r'60d0015fc2a3c8fc2190bb41d6818cf3027d9d0a';
|
||||
String _$accountDirectChatHash() => r'3d28c8ba8079159f724fe3cd47bbe00db55cedcc';
|
||||
|
||||
/// See also [accountDirectChat].
|
||||
@ProviderFor(accountDirectChat)
|
||||
@ -517,7 +517,7 @@ class _AccountDirectChatProviderElement
|
||||
}
|
||||
|
||||
String _$accountRelationshipHash() =>
|
||||
r'cb7d0d3f8cd4f23ad9d2d529872c540dac483d4f';
|
||||
r'0be2420e1f6a65b8dcead9617191471924aaf232';
|
||||
|
||||
/// See also [accountRelationship].
|
||||
@ProviderFor(accountRelationship)
|
||||
|
@ -77,6 +77,7 @@ class RealmDetailScreen extends HookConsumerWidget {
|
||||
);
|
||||
|
||||
return AppScaffold(
|
||||
noBackground: false,
|
||||
body: realmState.when(
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (error, _) => Center(child: Text('Error: $error')),
|
||||
|
66
lib/screens/reports/report_detail.dart
Normal file
66
lib/screens/reports/report_detail.dart
Normal file
@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/abuse_report.dart';
|
||||
import 'package:island/services/abuse_report_service.dart';
|
||||
|
||||
class AbuseReportDetailScreen extends ConsumerStatefulWidget {
|
||||
final String reportId;
|
||||
|
||||
const AbuseReportDetailScreen({super.key, required this.reportId});
|
||||
|
||||
@override
|
||||
ConsumerState<AbuseReportDetailScreen> createState() =>
|
||||
_AbuseReportDetailScreenState();
|
||||
}
|
||||
|
||||
class _AbuseReportDetailScreenState
|
||||
extends ConsumerState<AbuseReportDetailScreen> {
|
||||
Future<SnAbuseReport>? _reportFuture;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_reportFuture =
|
||||
ref.read(abuseReportServiceProvider).getReport(widget.reportId);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Abuse Report Details'),
|
||||
),
|
||||
body: FutureBuilder<SnAbuseReport>(
|
||||
future: _reportFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (snapshot.hasError) {
|
||||
return Center(child: Text('Error: ${snapshot.error}'));
|
||||
} else if (snapshot.hasData) {
|
||||
final report = snapshot.data!;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Report ID: ${report.id}'),
|
||||
Text('Resource Identifier: ${report.resourceIdentifier}'),
|
||||
Text('Type: ${report.type}'),
|
||||
Text('Reason: ${report.reason}'),
|
||||
Text('Resolved At: ${report.resolvedAt}'),
|
||||
Text('Resolution: ${report.resolution}'),
|
||||
Text('Account ID: ${report.accountId}'),
|
||||
Text('Created At: ${report.createdAt}'),
|
||||
Text('Updated At: ${report.updatedAt}'),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const Center(child: Text('No data'));
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
59
lib/screens/reports/report_list.dart
Normal file
59
lib/screens/reports/report_list.dart
Normal file
@ -0,0 +1,59 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/abuse_report.dart';
|
||||
import 'package:island/services/abuse_report_service.dart';
|
||||
|
||||
class AbuseReportListScreen extends ConsumerStatefulWidget {
|
||||
const AbuseReportListScreen({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<AbuseReportListScreen> createState() =>
|
||||
_AbuseReportListScreenState();
|
||||
}
|
||||
|
||||
class _AbuseReportListScreenState extends ConsumerState<AbuseReportListScreen> {
|
||||
Future<List<SnAbuseReport>>? _reportsFuture;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_reportsFuture = ref.read(abuseReportServiceProvider).getReports();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('My Abuse Reports'),
|
||||
),
|
||||
body: FutureBuilder<List<SnAbuseReport>>(
|
||||
future: _reportsFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (snapshot.hasError) {
|
||||
return Center(child: Text('Error: ${snapshot.error}'));
|
||||
} else if (snapshot.hasData) {
|
||||
final reports = snapshot.data!;
|
||||
return ListView.builder(
|
||||
itemCount: reports.length,
|
||||
itemBuilder: (context, index) {
|
||||
final report = reports[index];
|
||||
return ListTile(
|
||||
title: Text(report.reason),
|
||||
subtitle: Text(report.id),
|
||||
onTap: () {
|
||||
context.push('/safety/reports/me/${report.id}');
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return const Center(child: Text('No data'));
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user