opt: fs explorer resizable & search next for loop

This commit is contained in:
Kingtous 2023-02-24 15:56:37 +08:00
parent c3c4505132
commit b10c0ffe54

View File

@ -316,7 +316,7 @@ class _FileManagerPageState extends State<FileManagerPage>
return; return;
} }
_jumpToEntry(isLocal, searchResult.first, scrollController, _jumpToEntry(isLocal, searchResult.first, scrollController,
kDesktopFileTransferRowHeight, buffer); kDesktopFileTransferRowHeight);
}, },
onSearch: (buffer) { onSearch: (buffer) {
debugPrint("searching for $buffer"); debugPrint("searching for $buffer");
@ -331,7 +331,7 @@ class _FileManagerPageState extends State<FileManagerPage>
return; return;
} }
_jumpToEntry(isLocal, searchResult.first, scrollController, _jumpToEntry(isLocal, searchResult.first, scrollController,
kDesktopFileTransferRowHeight, buffer); kDesktopFileTransferRowHeight);
}, },
child: ObxValue<RxString>( child: ObxValue<RxString>(
(searchText) { (searchText) {
@ -471,7 +471,11 @@ class _FileManagerPageState extends State<FileManagerPage>
return Column( return Column(
children: [ children: [
// Header // Header
_buildFileBrowserHeader(context, isLocal), Row(
children: [
Expanded(child: _buildFileBrowserHeader(context, isLocal)),
],
),
// Body // Body
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
@ -493,7 +497,7 @@ class _FileManagerPageState extends State<FileManagerPage>
} }
void _jumpToEntry(bool isLocal, Entry entry, void _jumpToEntry(bool isLocal, Entry entry,
ScrollController scrollController, double rowHeight, String buffer) { ScrollController scrollController, double rowHeight) {
final entries = model.getCurrentDir(isLocal).entries; final entries = model.getCurrentDir(isLocal).entries;
final index = entries.indexOf(entry); final index = entries.indexOf(entry);
if (index == -1) { if (index == -1) {
@ -501,7 +505,7 @@ class _FileManagerPageState extends State<FileManagerPage>
} }
final selectedEntries = getSelectedItems(isLocal); final selectedEntries = getSelectedItems(isLocal);
final searchResult = final searchResult =
entries.where((element) => element.name.startsWith(buffer)); entries.where((element) => element == entry);
selectedEntries.clear(); selectedEntries.clear();
if (searchResult.isEmpty) { if (searchResult.isEmpty) {
return; return;
@ -1380,18 +1384,23 @@ class _FileManagerPageState extends State<FileManagerPage>
height: kDesktopFileTransferHeaderHeight, height: kDesktopFileTransferHeaderHeight,
child: Row( child: Row(
children: [ children: [
Text( Flexible(
name, flex: 2,
style: headerTextStyle, child: Text(
overflow: TextOverflow.ellipsis, name,
).marginSymmetric(horizontal: 4), style: headerTextStyle,
ascending.value != null overflow: TextOverflow.ellipsis,
).marginSymmetric(horizontal: 4),
),
Flexible(
flex: 1,
child: ascending.value != null
? Icon( ? Icon(
ascending.value! ascending.value!
? Icons.keyboard_arrow_up_rounded ? Icons.keyboard_arrow_up_rounded
: Icons.keyboard_arrow_down_rounded, : Icons.keyboard_arrow_down_rounded,
) )
: const Offstage() : const Offstage())
], ],
), ),
), ),