first working version

This commit is contained in:
stopflock committed 2026-09-23 14:39:11 -05:00
1 parent c95171a3ad
commit 54ef1b8afc
26 files changed
+745 -27

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import '../services/localization_service.dart';
/// Dialog shown whenever a check finds that the user's OSM account has an
/// active block. Unlike the unread-notifications dialog, this has no
/// "don't show again" option and is shown every time a check finds a block.
class ActiveBlockDialog extends StatelessWidget {
final VoidCallback onViewMessages;
final VoidCallback onDismiss;
const ActiveBlockDialog({
super.key,
required this.onViewMessages,
required this.onDismiss,
});
@override
Widget build(BuildContext context) {
final locService = LocalizationService.instance;
return AlertDialog(
title: Row(
children: [
Icon(
Icons.block,
color: Theme.of(context).colorScheme.error,
),
const SizedBox(width: 8),
Expanded(
child: Text(locService.t('auth.activeBlockTitle')),
),
],
),
content: Text(locService.t('auth.activeBlockMessage')),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
onDismiss();
},
child: Text(locService.t('actions.dismiss')),
),
FilledButton.icon(
onPressed: () {
Navigator.of(context).pop();
onViewMessages();
},
icon: const Icon(Icons.message, size: 18),
label: Text(locService.t('auth.viewMessages')),
),
],
);
}
}
+17
View File
@@ -421,6 +421,7 @@ class _AddNodeSheetState extends State<AddNodeSheet> {
}
final allowSubmit = appState.isLoggedIn &&
!appState.hasActiveBlock &&
submittableProfiles.isNotEmpty &&
session.profile != null &&
session.profile!.isSubmittable &&
@@ -493,6 +494,22 @@ class _AddNodeSheetState extends State<AddNodeSheet> {
],
),
)
else if (appState.hasActiveBlock)
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
child: Row(
children: [
const Icon(Icons.block, color: Colors.red, size: 20),
const SizedBox(width: 6),
Expanded(
child: Text(
locService.t('addNode.accountBlocked'),
style: const TextStyle(color: Colors.red, fontSize: 13),
),
),
],
),
)
else if (submittableProfiles.isEmpty)
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
+17
View File
@@ -377,6 +377,7 @@ class _EditNodeSheetState extends State<EditNodeSheet> {
final allowSubmit = kEnableNodeEdits &&
appState.isLoggedIn &&
!appState.hasActiveBlock &&
submittableProfiles.isNotEmpty &&
session.profile != null &&
session.profile!.isSubmittable &&
@@ -526,6 +527,22 @@ class _EditNodeSheetState extends State<EditNodeSheet> {
],
),
)
else if (appState.hasActiveBlock)
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
child: Row(
children: [
const Icon(Icons.block, color: Colors.red, size: 20),
const SizedBox(width: 6),
Expanded(
child: Text(
locService.t('editNode.accountBlocked'),
style: const TextStyle(color: Colors.red, fontSize: 13),
),
),
],
),
)
else if (submittableProfiles.isEmpty)
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
+17
View File
@@ -184,6 +184,23 @@ class _NodeTagSheetState extends State<NodeTagSheet> {
return;
}
if (appState.hasActiveBlock) {
await showDialog<void>(
context: context,
builder: (BuildContext context) => AlertDialog(
title: Text(locService.t('node.confirmDeleteTitle')),
content: Text(locService.t('node.accountBlockedCannotDelete')),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(locService.ok),
),
],
),
);
return;
}
final result = await showDialog<({bool confirmed, String comment})>(
context: context,
builder: (BuildContext context) => _DeleteNodeDialog(