|
|
|
@ -41,30 +41,9 @@ class _FileExplorerState extends State<FileExplorer> {
@@ -41,30 +41,9 @@ class _FileExplorerState extends State<FileExplorer> {
|
|
|
|
|
final fileProvider = Provider.of<FileProvider>(context); |
|
|
|
|
|
|
|
|
|
return Container( |
|
|
|
|
color: Colors.grey[200], |
|
|
|
|
color: Colors.white, |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Padding( |
|
|
|
|
padding: const EdgeInsets.all(4.0), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: TextField( |
|
|
|
|
decoration: const InputDecoration( |
|
|
|
|
hintText: 'Search files...', |
|
|
|
|
prefixIcon: Icon(Icons.search), |
|
|
|
|
isDense: true, |
|
|
|
|
), |
|
|
|
|
onChanged: (value) => fileProvider.searchFiles(value), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
IconButton( |
|
|
|
|
icon: const Icon(Icons.folder_open), // 改为文件夹打开图标 |
|
|
|
|
onPressed: () => _promptForDirectory(context), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: Scrollbar( |
|
|
|
|
controller: _scrollController, // 添加控制器绑定 |
|
|
|
@ -199,8 +178,12 @@ class _FileNodeWidget extends StatelessWidget {
@@ -199,8 +178,12 @@ class _FileNodeWidget extends StatelessWidget {
|
|
|
|
|
) |
|
|
|
|
: const Icon(null, size: 2), |
|
|
|
|
node.isDirectory |
|
|
|
|
? Icon(Icons.folder, color: Colors.cyan[500], size: 16) |
|
|
|
|
: Icon(Icons.file_open, color: Colors.amber[700], size: 16), |
|
|
|
|
? Icon( |
|
|
|
|
node.isExpanded ? Icons.folder_open : Icons.folder, |
|
|
|
|
color: Colors.cyan[500], |
|
|
|
|
size: 18, |
|
|
|
|
) |
|
|
|
|
: Icon(node.iconData, color: Colors.amber[700], size: 20), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|