Files
notas/lib/widgets/sync_status_indicator.dart
T
Marcos efe602a5da feat: Implement note encryption and synchronization features
- Added NoteEncryption class for encrypting and decrypting note content using AES-GCM.
- Updated NoteRepository to handle synchronization of notes and categories with the server, including encryption of note data before sending.
- Introduced SyncRequest and SyncResponse models for managing synchronization data.
- Enhanced LocalVaultService to store and retrieve the encryption key.
- Modified HomeScreen and SettingsScreen to trigger synchronization after note operations and manage API endpoint settings.
- Added SyncStatusIndicator to provide visual feedback on synchronization status in the app title bar.
- Created Category model to manage note categories with encryption support.
- Updated note model to include UUID, server version, deletion status, and category ID.
- Added necessary UI elements for displaying and managing the encryption key in SettingsScreen.
- Updated dependencies in pubspec.yaml for cryptography and HTTP handling.
2026-05-18 16:11:19 +02:00

63 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
enum SyncStatus {
idle,
syncing,
synced,
error,
}
class SyncStatusIndicator extends StatelessWidget {
const SyncStatusIndicator({
required this.status,
this.errorMessage,
super.key,
});
final SyncStatus status;
final String? errorMessage;
@override
Widget build(BuildContext context) {
switch (status) {
case SyncStatus.idle:
return const SizedBox.shrink();
case SyncStatus.syncing:
return const Tooltip(
message: 'Sincronizando...',
child: SizedBox(
width: 16,
height: 16,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
Color.fromARGB(255, 150, 150, 150),
),
),
),
);
case SyncStatus.synced:
return const Tooltip(
message: 'Sincronizado',
child: Icon(
Icons.check_circle,
size: 16,
color: Colors.green,
),
);
case SyncStatus.error:
return Tooltip(
message: errorMessage ?? 'Error al sincronizar',
child: const Icon(
Icons.error,
size: 16,
color: Colors.red,
),
);
}
}
}