mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 23:34:24 +01:00
new: pick dialog support tags
This commit is contained in:
@@ -120,7 +120,6 @@ class _ServerPageState extends State<ServerPage>
|
||||
_tag = p0;
|
||||
}),
|
||||
initTag: _tag,
|
||||
all: l10n.all,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@ class _SnippetListPageState extends State<SnippetListPage> {
|
||||
tags: provider.tags,
|
||||
onTagChanged: (tag) => setState(() => _tag = tag),
|
||||
initTag: _tag,
|
||||
all: l10n.all,
|
||||
width: _media.size.width,
|
||||
),
|
||||
footer: UIs.height77,
|
||||
|
||||
@@ -275,12 +275,20 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
||||
}
|
||||
break;
|
||||
case VirtualKeyFunc.snippet:
|
||||
final s = await context.showPickSingleDialog<Snippet>(
|
||||
items: Pros.snippet.snippets,
|
||||
name: (p0) => p0.name,
|
||||
final snippets = await context.showPickWithTagDialog<Snippet>(
|
||||
tags: Pros.snippet.tags,
|
||||
itemsBuilder: (e) {
|
||||
if (e == null) return Pros.snippet.snippets;
|
||||
return Pros.snippet.snippets
|
||||
.where((element) => element.tags?.contains(e) ?? false)
|
||||
.toList();
|
||||
},
|
||||
name: (e) => e.name,
|
||||
);
|
||||
if (s == null) return;
|
||||
_terminal.textInput(s.script);
|
||||
if (snippets == null || snippets.isEmpty) return;
|
||||
|
||||
final snippet = snippets.first;
|
||||
_terminal.textInput(snippet.script);
|
||||
_terminal.keyInput(TerminalKey.enter);
|
||||
break;
|
||||
case VirtualKeyFunc.file:
|
||||
|
||||
Reference in New Issue
Block a user