Was-ist-neu-Bericht als In-App-Dialog nach dem Abgleich
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../services/sync_service.dart';
|
||||
|
||||
/// „Willkommen zurück" — was sich seit dem letzten erfolgreichen Abgleich
|
||||
/// getan hat. Rein in-App, ohne Benachrichtigungs-Kanal und ohne neue
|
||||
/// Abhängigkeit.
|
||||
class SyncBerichtDialog extends StatelessWidget {
|
||||
const SyncBerichtDialog({super.key, required this.bericht});
|
||||
|
||||
final SyncBericht bericht;
|
||||
|
||||
static String textFuer(SyncBericht b) {
|
||||
if (b.istLeer) return 'Nichts Neues seit dem letzten Abgleich.';
|
||||
final teile = <String>[];
|
||||
if (b.neueSongs > 0) teile.add('${b.neueSongs} neue Titel');
|
||||
if (b.geloeschte > 0) teile.add('${b.geloeschte} entfernt');
|
||||
if (b.favoriten > 0) teile.add('${b.favoriten} Favoriten geändert');
|
||||
return '${teile.join(' · ')}.';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Willkommen zurück!'),
|
||||
content: Text(textFuer(bericht)),
|
||||
actions: [
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Alles klar'),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user