Replace inline Colors.* with SojornColors tokens in secure_chat screens + chat_data_management + local_key_backup
This commit is contained in:
parent
cca4ffa08b
commit
cefa69d7e7
|
|
@ -5,6 +5,7 @@ import '../../services/local_key_backup_service.dart';
|
|||
import '../../services/simple_e2ee_service.dart';
|
||||
import '../../services/local_message_store.dart';
|
||||
import '../../theme/app_theme.dart';
|
||||
import '../../theme/tokens.dart';
|
||||
|
||||
class ChatDataManagementScreen extends StatefulWidget {
|
||||
const ChatDataManagementScreen({super.key});
|
||||
|
|
@ -58,7 +59,7 @@ class _ChatDataManagementScreenState extends State<ChatDataManagementScreen> {
|
|||
appBar: AppBar(
|
||||
backgroundColor: AppTheme.scaffoldBg,
|
||||
elevation: 0,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
surfaceTintColor: SojornColors.transparent,
|
||||
title: Text(
|
||||
'Chat Data & Backup',
|
||||
style: GoogleFonts.literata(
|
||||
|
|
@ -99,7 +100,7 @@ class _ChatDataManagementScreenState extends State<ChatDataManagementScreen> {
|
|||
Widget _buildStatusCard() {
|
||||
final isHealthy = _isBackupEnabled && _hasPassword;
|
||||
final icon = isHealthy ? Icons.cloud_done_rounded : Icons.cloud_off_rounded;
|
||||
final color = isHealthy ? Colors.green : AppTheme.textDisabled;
|
||||
final color = isHealthy ? const Color(0xFF4CAF50) : AppTheme.textDisabled;
|
||||
final label = isHealthy ? 'Auto-Backup Active' : 'Backup Not Set Up';
|
||||
|
||||
return Container(
|
||||
|
|
@ -234,7 +235,7 @@ class _ChatDataManagementScreenState extends State<ChatDataManagementScreen> {
|
|||
label: const Text('Set Backup Password'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.brightNavy,
|
||||
foregroundColor: Colors.white,
|
||||
foregroundColor: SojornColors.basicWhite,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
|
|
@ -585,7 +586,7 @@ class _ChatDataManagementScreenState extends State<ChatDataManagementScreen> {
|
|||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.brightNavy,
|
||||
foregroundColor: Colors.white,
|
||||
foregroundColor: SojornColors.basicWhite,
|
||||
),
|
||||
child: const Text('Enable Backup'),
|
||||
),
|
||||
|
|
@ -604,14 +605,14 @@ class _ChatDataManagementScreenState extends State<ChatDataManagementScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Backup enabled! Your messages will be backed up automatically.'),
|
||||
backgroundColor: Colors.green,
|
||||
backgroundColor: const Color(0xFF4CAF50),
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Setup failed: $e'), backgroundColor: Colors.red),
|
||||
SnackBar(content: Text('Setup failed: $e'), backgroundColor: SojornColors.destructive),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
|
@ -626,13 +627,13 @@ class _ChatDataManagementScreenState extends State<ChatDataManagementScreen> {
|
|||
await _loadStatus();
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Backup complete!'), backgroundColor: Colors.green),
|
||||
const SnackBar(content: Text('Backup complete!'), backgroundColor: Color(0xFF4CAF50)),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Backup failed: $e'), backgroundColor: Colors.red),
|
||||
SnackBar(content: Text('Backup failed: $e'), backgroundColor: SojornColors.destructive),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
|
@ -706,13 +707,13 @@ class _ChatDataManagementScreenState extends State<ChatDataManagementScreen> {
|
|||
await _loadStatus();
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Password updated and backup re-encrypted.'), backgroundColor: Colors.green),
|
||||
const SnackBar(content: Text('Password updated and backup re-encrypted.'), backgroundColor: Color(0xFF4CAF50)),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Failed: $e'), backgroundColor: Colors.red),
|
||||
SnackBar(content: Text('Failed: $e'), backgroundColor: SojornColors.destructive),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
|
@ -776,7 +777,7 @@ class _ChatDataManagementScreenState extends State<ChatDataManagementScreen> {
|
|||
onPressed: () => Navigator.pop(ctx, controller.text),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.royalPurple,
|
||||
foregroundColor: Colors.white,
|
||||
foregroundColor: SojornColors.basicWhite,
|
||||
),
|
||||
child: const Text('Restore'),
|
||||
),
|
||||
|
|
@ -793,14 +794,14 @@ class _ChatDataManagementScreenState extends State<ChatDataManagementScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Restored ${result['restored_keys']} keys and ${result['restored_messages']} messages!'),
|
||||
backgroundColor: Colors.green,
|
||||
backgroundColor: const Color(0xFF4CAF50),
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Restore failed: $e'), backgroundColor: Colors.red),
|
||||
SnackBar(content: Text('Restore failed: $e'), backgroundColor: SojornColors.destructive),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
|
@ -850,13 +851,13 @@ class _ChatDataManagementScreenState extends State<ChatDataManagementScreen> {
|
|||
final path = await LocalKeyBackupService.saveBackupToDevice(backup);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Exported to: $path'), backgroundColor: Colors.green),
|
||||
SnackBar(content: Text('Exported to: $path'), backgroundColor: const Color(0xFF4CAF50)),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Export failed: $e'), backgroundColor: Colors.red),
|
||||
SnackBar(content: Text('Export failed: $e'), backgroundColor: SojornColors.destructive),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -898,14 +899,14 @@ class _ChatDataManagementScreenState extends State<ChatDataManagementScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Imported ${result['restored_keys']} keys and ${result['restored_messages']} messages!'),
|
||||
backgroundColor: Colors.green,
|
||||
backgroundColor: const Color(0xFF4CAF50),
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Import failed: $e'), backgroundColor: Colors.red),
|
||||
SnackBar(content: Text('Import failed: $e'), backgroundColor: SojornColors.destructive),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import '../../models/secure_chat.dart';
|
|||
import '../../services/secure_chat_service.dart';
|
||||
import 'chat_data_management_screen.dart';
|
||||
import '../../theme/app_theme.dart';
|
||||
import '../../theme/tokens.dart';
|
||||
import '../../widgets/media/signed_media_image.dart';
|
||||
import '../home/full_screen_shell.dart';
|
||||
import 'secure_chat_screen.dart';
|
||||
|
|
@ -98,7 +99,7 @@ class _SecureChatFullScreenState extends State<SecureChatFullScreen> {
|
|||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
backgroundColor: SojornColors.transparent,
|
||||
builder: (context) => NewConversationSheet(
|
||||
onConversationStarted: (conversation) {
|
||||
Navigator.pop(context); // Close new conversation sheet
|
||||
|
|
@ -163,7 +164,7 @@ class _SecureChatFullScreenState extends State<SecureChatFullScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Keys uploaded successfully'),
|
||||
backgroundColor: Colors.green,
|
||||
backgroundColor: const Color(0xFF4CAF50),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -172,7 +173,7 @@ class _SecureChatFullScreenState extends State<SecureChatFullScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Failed to upload keys: $e'),
|
||||
backgroundColor: Colors.red,
|
||||
backgroundColor: SojornColors.destructive,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -205,7 +206,7 @@ class _SecureChatFullScreenState extends State<SecureChatFullScreen> {
|
|||
label: Text('New Conversation'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.brightNavy,
|
||||
foregroundColor: Colors.white,
|
||||
foregroundColor: SojornColors.basicWhite,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
|
|
@ -263,7 +264,7 @@ class _SecureChatFullScreenState extends State<SecureChatFullScreen> {
|
|||
Icon(
|
||||
Icons.error_outline,
|
||||
size: 64,
|
||||
color: Colors.red[400],
|
||||
color: SojornColors.destructive,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
|
|
@ -288,7 +289,7 @@ class _SecureChatFullScreenState extends State<SecureChatFullScreen> {
|
|||
onPressed: _loadConversations,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.brightNavy,
|
||||
foregroundColor: Colors.white,
|
||||
foregroundColor: SojornColors.basicWhite,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
),
|
||||
child: Text('Try Again'),
|
||||
|
|
@ -334,7 +335,7 @@ class _SecureChatFullScreenState extends State<SecureChatFullScreen> {
|
|||
onPressed: _showNewConversationSheet,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.brightNavy,
|
||||
foregroundColor: Colors.white,
|
||||
foregroundColor: SojornColors.basicWhite,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
),
|
||||
child: Text('Start Conversation'),
|
||||
|
|
@ -360,7 +361,7 @@ class _SecureChatFullScreenState extends State<SecureChatFullScreen> {
|
|||
return Center(
|
||||
child: Text(
|
||||
'Error loading conversations: ${snapshot.error}',
|
||||
style: GoogleFonts.inter(color: Colors.red),
|
||||
style: GoogleFonts.inter(color: SojornColors.destructive),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -455,7 +456,7 @@ class _SecureChatFullScreenState extends State<SecureChatFullScreen> {
|
|||
onPressed: () => Navigator.pop(context, true),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.error,
|
||||
foregroundColor: Colors.white,
|
||||
foregroundColor: SojornColors.basicWhite,
|
||||
),
|
||||
child: Text('Delete'),
|
||||
),
|
||||
|
|
@ -470,7 +471,7 @@ class _SecureChatFullScreenState extends State<SecureChatFullScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Conversation deleted'),
|
||||
backgroundColor: Colors.green,
|
||||
backgroundColor: const Color(0xFF4CAF50),
|
||||
),
|
||||
);
|
||||
_loadConversations();
|
||||
|
|
@ -480,7 +481,7 @@ class _SecureChatFullScreenState extends State<SecureChatFullScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Failed to delete: $e'),
|
||||
backgroundColor: Colors.red,
|
||||
backgroundColor: SojornColors.destructive,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -529,7 +530,7 @@ class _ConversationTileState extends State<_ConversationTile> {
|
|||
padding: const EdgeInsets.only(right: 24),
|
||||
child: const Icon(
|
||||
Icons.delete_outline,
|
||||
color: Colors.white,
|
||||
color: SojornColors.basicWhite,
|
||||
size: 28,
|
||||
),
|
||||
),
|
||||
|
|
@ -544,7 +545,7 @@ class _ConversationTileState extends State<_ConversationTile> {
|
|||
),
|
||||
),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
color: SojornColors.transparent,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
onTap: widget.onTap,
|
||||
|
|
@ -658,7 +659,7 @@ class _ConversationTileState extends State<_ConversationTile> {
|
|||
child: Text(
|
||||
widget.conversation.unreadCount.toString(),
|
||||
style: GoogleFonts.inter(
|
||||
color: Colors.white,
|
||||
color: SojornColors.basicWhite,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../theme/tokens.dart';
|
||||
import 'package:cryptography/cryptography.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
|
@ -477,7 +478,7 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
appBar: AppBar(
|
||||
backgroundColor: AppTheme.scaffoldBg,
|
||||
elevation: 0,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
surfaceTintColor: SojornColors.transparent,
|
||||
title: Text(
|
||||
'Full Backup & Recovery',
|
||||
style: GoogleFonts.literata(
|
||||
|
|
@ -538,7 +539,7 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? AppTheme.brightNavy : Colors.transparent,
|
||||
color: isSelected ? AppTheme.brightNavy : SojornColors.transparent,
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
|
|
@ -546,7 +547,7 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
title,
|
||||
style: GoogleFonts.inter(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected ? Colors.white : AppTheme.textSecondary,
|
||||
color: isSelected ? SojornColors.basicWhite : AppTheme.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -667,19 +668,19 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
),
|
||||
value: _includeKeys,
|
||||
onChanged: (v) => setState(() => _includeKeys = v),
|
||||
activeColor: _useCloud ? Colors.red : AppTheme.brightNavy,
|
||||
activeColor: _useCloud ? SojornColors.destructive : AppTheme.brightNavy,
|
||||
),
|
||||
if (_useCloud && !_includeKeys)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.security, size: 16, color: Colors.green),
|
||||
Icon(Icons.security, size: 16, color: const Color(0xFF4CAF50)),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Secure Mode: Zero Knowledge. Server cannot decrypt.',
|
||||
style: GoogleFonts.inter(fontSize: 12, color: Colors.green),
|
||||
style: GoogleFonts.inter(fontSize: 12, color: const Color(0xFF4CAF50)),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
@ -696,14 +697,14 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
height: 16,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(SojornColors.basicWhite),
|
||||
),
|
||||
)
|
||||
: Icon(_useCloud ? Icons.cloud_upload : Icons.file_download),
|
||||
label: Text(_isCreatingBackup ? 'Processing...' : (_useCloud ? 'Upload Backup' : 'Export Backup')),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.brightNavy,
|
||||
foregroundColor: Colors.white,
|
||||
foregroundColor: SojornColors.basicWhite,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
),
|
||||
),
|
||||
|
|
@ -757,14 +758,14 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
height: 16,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(SojornColors.basicWhite),
|
||||
),
|
||||
)
|
||||
: Icon(_useCloud ? Icons.cloud_download : Icons.file_upload),
|
||||
label: Text(_isRestoringBackup ? 'Restoring...' : (_useCloud ? 'Download & Restore' : 'Import Backup')),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.royalPurple,
|
||||
foregroundColor: Colors.white,
|
||||
foregroundColor: SojornColors.basicWhite,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
),
|
||||
),
|
||||
|
|
@ -838,7 +839,7 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Backup uploaded securely!'),
|
||||
backgroundColor: Colors.green,
|
||||
backgroundColor: const Color(0xFF4CAF50),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -847,7 +848,7 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Upload failed: $e'),
|
||||
backgroundColor: Colors.red,
|
||||
backgroundColor: SojornColors.destructive,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -872,7 +873,7 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Backup restored! ${result['restored_keys']} keys, ${result['restored_messages']} messages.'),
|
||||
backgroundColor: Colors.green,
|
||||
backgroundColor: const Color(0xFF4CAF50),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -881,7 +882,7 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Restore failed: $e'),
|
||||
backgroundColor: Colors.red,
|
||||
backgroundColor: SojornColors.destructive,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -918,7 +919,7 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Backup saved successfully!'),
|
||||
backgroundColor: Colors.green,
|
||||
backgroundColor: const Color(0xFF4CAF50),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -928,7 +929,7 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Failed to create backup: $e'),
|
||||
backgroundColor: Colors.red,
|
||||
backgroundColor: SojornColors.destructive,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -959,7 +960,7 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Backup restored successfully! ${result['restored_keys']} keys and ${result['restored_messages']} messages recovered.'),
|
||||
backgroundColor: Colors.green,
|
||||
backgroundColor: const Color(0xFF4CAF50),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -969,7 +970,7 @@ class _LocalBackupScreenState extends State<LocalBackupScreen> {
|
|||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Failed to restore backup: $e'),
|
||||
backgroundColor: Colors.red,
|
||||
backgroundColor: SojornColors.destructive,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue