diff --git a/b0esche_cloud/lib/pages/file_explorer.dart b/b0esche_cloud/lib/pages/file_explorer.dart index 57b8970..5d58a82 100644 --- a/b0esche_cloud/lib/pages/file_explorer.dart +++ b/b0esche_cloud/lib/pages/file_explorer.dart @@ -1310,7 +1310,10 @@ class _FileExplorerState extends State onPressed: () => _downloadFile(file), ), IconButton( - icon: const Icon(Icons.share, color: AppTheme.secondaryText), + icon: const Icon( + Icons.share_outlined, + color: AppTheme.secondaryText, + ), splashColor: Colors.transparent, highlightColor: Colors.transparent, onPressed: () => _shareFile(file), diff --git a/b0esche_cloud/lib/pages/public_file_viewer.dart b/b0esche_cloud/lib/pages/public_file_viewer.dart index ff06df1..874919b 100644 --- a/b0esche_cloud/lib/pages/public_file_viewer.dart +++ b/b0esche_cloud/lib/pages/public_file_viewer.dart @@ -83,63 +83,77 @@ class _PublicFileViewerState extends State { : _error != null ? Padding( padding: const EdgeInsets.all(24), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Icon(Icons.link_off, size: 64, color: Colors.red[400]), - const SizedBox(height: 16), - Text( - _error!, - style: TextStyle( - color: AppTheme.primaryText, - fontSize: 18, - ), - textAlign: TextAlign.center, + child: Card( + color: AppTheme.primaryBackground, + elevation: 4, + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.link_off, size: 64, color: Colors.red[400]), + const SizedBox(height: 16), + Text( + _error!, + style: TextStyle( + color: AppTheme.primaryText, + fontSize: 18, + ), + textAlign: TextAlign.center, + ), + ], ), - ], + ), ), ) : _fileData != null ? Padding( padding: const EdgeInsets.all(24), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Icon( - Icons.insert_drive_file, - size: 64, - color: AppTheme.primaryText, - ), - const SizedBox(height: 16), - Text( - _fileData!['fileName'] ?? 'Unknown file', - style: TextStyle( - color: AppTheme.primaryText, - fontSize: 24, - fontWeight: FontWeight.bold, - ), - textAlign: TextAlign.center, - ), - const SizedBox(height: 8), - Text( - 'Size: ${(_fileData!['fileSize'] ?? 0) ~/ 1024} KB', - style: TextStyle(color: AppTheme.secondaryText), - ), - const SizedBox(height: 24), - ElevatedButton.icon( - onPressed: _downloadFile, - icon: const Icon(Icons.download), - label: const Text('Download File'), - style: ElevatedButton.styleFrom( - backgroundColor: AppTheme.accentColor, - foregroundColor: Colors.white, - padding: const EdgeInsets.symmetric( - horizontal: 24, - vertical: 12, + child: Card( + color: AppTheme.primaryBackground, + elevation: 4, + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.insert_drive_file, + size: 64, + color: AppTheme.primaryText, ), - ), + const SizedBox(height: 16), + Text( + _fileData!['fileName'] ?? 'Unknown file', + style: TextStyle( + color: AppTheme.primaryText, + fontSize: 24, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.center, + ), + const SizedBox(height: 8), + Text( + 'Size: ${(_fileData!['fileSize'] ?? 0) ~/ 1024} KB', + style: TextStyle(color: AppTheme.secondaryText), + ), + const SizedBox(height: 24), + ElevatedButton.icon( + onPressed: _downloadFile, + icon: const Icon(Icons.download), + label: const Text('Download File'), + style: ElevatedButton.styleFrom( + backgroundColor: AppTheme.accentColor, + foregroundColor: Colors.white, + padding: const EdgeInsets.symmetric( + horizontal: 24, + vertical: 12, + ), + ), + ), + ], ), - ], + ), ), ) : const SizedBox(), diff --git a/b0esche_cloud/lib/widgets/share_file_dialog.dart b/b0esche_cloud/lib/widgets/share_file_dialog.dart index 211501c..29a3373 100644 --- a/b0esche_cloud/lib/widgets/share_file_dialog.dart +++ b/b0esche_cloud/lib/widgets/share_file_dialog.dart @@ -24,6 +24,7 @@ class _ShareFileDialogState extends State { bool _isLoading = true; String? _shareUrl; String? _error; + late final TextEditingController _urlController = TextEditingController(); @override void initState() { @@ -31,6 +32,12 @@ class _ShareFileDialogState extends State { _loadShareLink(); } + @override + void dispose() { + _urlController.dispose(); + super.dispose(); + } + Future _loadShareLink() async { setState(() { _isLoading = true; @@ -46,17 +53,20 @@ class _ShareFileDialogState extends State { if (response['exists'] == true) { setState(() { _shareUrl = response['url']; + _urlController.text = _shareUrl!; _isLoading = false; }); } else { setState(() { _shareUrl = null; + _urlController.clear(); _isLoading = false; }); } } catch (e) { setState(() { - _error = 'Failed to load share link'; + _shareUrl = null; + _urlController.clear(); _isLoading = false; }); } @@ -77,6 +87,7 @@ class _ShareFileDialogState extends State { setState(() { _shareUrl = response['url']; + _urlController.text = _shareUrl!; _isLoading = false; }); } catch (e) { @@ -101,6 +112,7 @@ class _ShareFileDialogState extends State { setState(() { _shareUrl = null; + _urlController.clear(); _isLoading = false; }); } catch (e) { @@ -180,35 +192,17 @@ class _ShareFileDialogState extends State { style: TextStyle(color: AppTheme.secondaryText), ), const SizedBox(height: 16), - Container( - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: Colors.white.withValues(alpha: 0.1), - borderRadius: BorderRadius.circular(8), - ), - child: Row( - children: [ - Expanded( - child: Text( - _shareUrl!, - style: TextStyle( - color: AppTheme.primaryText, - fontFamily: 'monospace', - fontSize: 14, - ), - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - ), - IconButton( - icon: const Icon( - Icons.copy, - color: AppTheme.accentColor, - ), - onPressed: _copyToClipboard, - tooltip: 'Copy link', - ), - ], + TextField( + controller: _urlController, + readOnly: true, + maxLines: 2, + decoration: InputDecoration( + labelText: 'Share link', + border: const OutlineInputBorder(), + suffixIcon: IconButton( + icon: const Icon(Icons.copy), + onPressed: _copyToClipboard, + ), ), ), const SizedBox(height: 16),