diff --git a/b0esche_cloud/lib/pages/file_explorer.dart b/b0esche_cloud/lib/pages/file_explorer.dart index 8a87f11..0be65aa 100644 --- a/b0esche_cloud/lib/pages/file_explorer.dart +++ b/b0esche_cloud/lib/pages/file_explorer.dart @@ -27,6 +27,7 @@ class _FileExplorerState extends State { bool _showField = false; final TextEditingController _searchController = TextEditingController(); String _searchQuery = ''; + final Map _hovered = {}; @override void dispose() { @@ -59,9 +60,9 @@ class _FileExplorerState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Text( + const Text( 'New Folder', - style: const TextStyle( + style: TextStyle( color: AppTheme.primaryText, fontSize: 18, fontWeight: FontWeight.bold, @@ -94,7 +95,9 @@ class _FileExplorerState extends State { ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), - borderSide: BorderSide(color: AppTheme.accentColor), + borderSide: const BorderSide( + color: AppTheme.accentColor, + ), ), ), ), @@ -169,9 +172,9 @@ class _FileExplorerState extends State { child: Stack( alignment: Alignment.centerLeft, children: [ - Positioned( + const Positioned( left: 0, - child: const Text( + child: Text( '/Drive', style: TextStyle( fontSize: 24, @@ -233,27 +236,13 @@ class _FileExplorerState extends State { children: [ PopupMenuButton( color: AppTheme.accentColor.withAlpha(200), - position: PopupMenuPosition.under, offset: const Offset(48, 8), - itemBuilder: (BuildContext context) => [ - const PopupMenuItem( - value: 'name', - - child: Text('Name'), - ), - const PopupMenuItem( - value: 'date', - child: Text('Date'), - ), - const PopupMenuItem( - value: 'size', - child: Text('Size'), - ), - const PopupMenuItem( - value: 'type', - child: Text('Type'), - ), + itemBuilder: (BuildContext context) => const [ + PopupMenuItem(value: 'name', child: Text('Name')), + PopupMenuItem(value: 'date', child: Text('Date')), + PopupMenuItem(value: 'size', child: Text('Size')), + PopupMenuItem(value: 'type', child: Text('Type')), ], onSelected: (value) { context.read().add( @@ -335,7 +324,7 @@ class _FileExplorerState extends State { ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(24), - borderSide: BorderSide(color: AppTheme.accentColor), + borderSide: const BorderSide(color: AppTheme.accentColor), ), ), onChanged: (value) { @@ -585,7 +574,6 @@ class _FileExplorerState extends State { ], ), ), - const SizedBox(width: 16), ModernGlassButton( onPressed: () async { @@ -623,95 +611,104 @@ class _FileExplorerState extends State { itemBuilder: (context, index) { final file = state.paginatedFiles[index]; final isSelected = _selectedFilePath == file.path; - return GestureDetector( - onTap: () { - setState(() { - _selectedFilePath = file.path; - }); - if (file.type == FileType.folder) { - context.read().add( - NavigateToFolder(file.path), - ); - } else { - // Open viewer - context.go('/viewer/${file.name}'); - } - }, - child: Container( - margin: const EdgeInsets.symmetric( - vertical: 4, - horizontal: 8, - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - border: isSelected - ? Border.all( - color: AppTheme.accentColor.withValues( - alpha: 0.4, - ), - width: 2, - ) - : null, - color: isSelected - ? AppTheme.accentColor.withValues(alpha: 0.08) - : Colors.transparent, - ), - child: ListTile( - leading: Icon( - file.type == FileType.folder - ? Icons.folder - : Icons.insert_drive_file, - color: AppTheme.primaryText, + final isHovered = _hovered[file.path] ?? false; + return MouseRegion( + onEnter: (_) => + setState(() => _hovered[file.path] = true), + onExit: (_) => + setState(() => _hovered[file.path] = false), + child: GestureDetector( + onTap: () { + setState(() { + _selectedFilePath = file.path; + }); + if (file.type == FileType.folder) { + context.read().add( + NavigateToFolder(file.path), + ); + } else { + // Open viewer + context.go('/viewer/${file.name}'); + } + }, + child: Container( + margin: const EdgeInsets.symmetric( + vertical: 4, + horizontal: 8, ), - title: Text( - file.type == FileType.folder - ? (file.name.startsWith('/') - ? file.name - : '/${file.name}') - : file.name, - style: const TextStyle( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + border: isSelected + ? Border.all( + color: AppTheme.accentColor.withValues( + alpha: 0.4, + ), + width: 2, + ) + : null, + color: isSelected + ? AppTheme.accentColor.withValues(alpha: 0.08) + : isHovered + ? Colors.white.withValues(alpha: 0.05) + : Colors.transparent, + ), + child: ListTile( + leading: Icon( + file.type == FileType.folder + ? Icons.folder + : Icons.insert_drive_file, color: AppTheme.primaryText, ), - ), - subtitle: Text( - file.type == FileType.folder - ? 'Folder' - : 'File - ${file.size} bytes', - style: const TextStyle( - color: AppTheme.secondaryText, + title: Text( + file.type == FileType.folder + ? (file.name.startsWith('/') + ? file.name + : '/${file.name}') + : file.name, + style: const TextStyle( + color: AppTheme.primaryText, + ), ), - ), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon( - Icons.edit, - color: AppTheme.secondaryText, - ), - splashColor: Colors.transparent, - highlightColor: Colors.transparent, - onPressed: () => _editFile(file), + subtitle: Text( + file.type == FileType.folder + ? 'Folder' + : 'File - ${file.size} bytes', + style: const TextStyle( + color: AppTheme.secondaryText, ), - IconButton( - icon: const Icon( - Icons.download, - color: AppTheme.secondaryText, + ), + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon( + Icons.edit, + color: AppTheme.secondaryText, + ), + splashColor: Colors.transparent, + highlightColor: Colors.transparent, + onPressed: () => _editFile(file), ), - splashColor: Colors.transparent, - highlightColor: Colors.transparent, - onPressed: () => _downloadFile(file), - ), - IconButton( - icon: const Icon( - Icons.send, - color: AppTheme.secondaryText, + IconButton( + icon: const Icon( + Icons.download, + color: AppTheme.secondaryText, + ), + splashColor: Colors.transparent, + highlightColor: Colors.transparent, + onPressed: () => _downloadFile(file), ), - splashColor: Colors.transparent, - highlightColor: Colors.transparent, - onPressed: () => _sendFile(file), - ), - ], + IconButton( + icon: const Icon( + Icons.send, + color: AppTheme.secondaryText, + ), + splashColor: Colors.transparent, + highlightColor: Colors.transparent, + onPressed: () => _sendFile(file), + ), + ], + ), ), ), ),