opt.: input field suggestion

This commit is contained in:
lollipopkit🏳️‍⚧️
2024-07-22 22:03:56 +08:00
parent 255abe8b11
commit 7a359588db
15 changed files with 75 additions and 50 deletions

View File

@@ -316,18 +316,21 @@ class BackupPage extends StatelessWidget {
label: 'URL',
hint: 'https://example.com/webdav/',
controller: url,
suggestion: false,
onSubmitted: (p0) => FocusScope.of(context).requestFocus(nodeUser),
),
Input(
label: l10n.user,
controller: user,
node: nodeUser,
suggestion: false,
onSubmitted: (p0) => FocusScope.of(context).requestFocus(nodePwd),
),
Input(
label: l10n.pwd,
controller: pwd,
node: nodePwd,
suggestion: false,
onSubmitted: (_) => context.pop(true),
),
],

View File

@@ -338,18 +338,21 @@ class _ContainerPageState extends State<ContainerPage> {
label: l10n.image,
hint: 'xxx:1.1',
controller: imageCtrl,
suggestion: false,
),
Input(
type: TextInputType.text,
controller: nameCtrl,
label: l10n.containerName,
hint: 'xxx',
suggestion: false,
),
Input(
type: TextInputType.text,
controller: argsCtrl,
label: l10n.extraArgs,
hint: '-p 2222:22 -v ~/.xxx/:/xxx',
suggestion: false,
),
],
),
@@ -425,6 +428,7 @@ class _ContainerPageState extends State<ContainerPage> {
controller: ctrl,
onSubmitted: _onSaveDockerHost,
hint: 'unix:///run/user/1000/docker.sock',
suggestion: false,
),
actions: [
TextButton(

View File

@@ -52,12 +52,14 @@ class _IPerfPageState extends State<IPerfPage> {
controller: _hostCtrl,
label: l10n.host,
icon: Icons.computer,
suggestion: false,
),
Input(
controller: _portCtrl,
label: l10n.port,
type: TextInputType.number,
icon: Icons.numbers,
suggestion: false,
),
],
);

View File

@@ -59,6 +59,7 @@ class _PingPageState extends State<PingPage>
controller: _textEditingController,
hint: l10n.inputDomainHere,
maxLines: 1,
suggestion: false,
onSubmitted: (_) => _doPing(),
),
actions: [

View File

@@ -135,6 +135,7 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage> {
onSubmitted: (_) => _focusScope.requestFocus(_keyNode),
label: l10n.name,
icon: Icons.info,
suggestion: true,
),
Input(
controller: _keyController,
@@ -145,6 +146,7 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage> {
onSubmitted: (_) => _focusScope.requestFocus(_pwdNode),
label: l10n.privateKey,
icon: Icons.vpn_key,
suggestion: false,
),
TextButton(
onPressed: () async {
@@ -181,6 +183,7 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage> {
obscureText: true,
label: l10n.pwd,
icon: Icons.password,
suggestion: false,
onSubmitted: (_) => _onTapSave(),
),
SizedBox(height: MediaQuery.of(context).size.height * 0.1),

View File

@@ -51,8 +51,7 @@ class _ProcessPageState extends State<ProcessPage> {
Future<void> _refresh() async {
if (mounted) {
final result =
await _client?.run(ShellFunc.process.exec).string;
final result = await _client?.run(ShellFunc.process.exec).string;
if (result == null || result.isEmpty) {
context.showSnackBar(l10n.noResult);
return;

View File

@@ -196,6 +196,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
label: l10n.host,
icon: BoxIcons.bx_server,
hint: 'example.com',
suggestion: false,
),
Input(
controller: _portController,
@@ -205,6 +206,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
label: l10n.port,
icon: Bootstrap.number_123,
hint: '22',
suggestion: false,
),
Input(
controller: _usernameController,
@@ -214,6 +216,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
label: l10n.user,
icon: Icons.account_box,
hint: 'root',
suggestion: false,
),
Input(
controller: _altUrlController,
@@ -222,6 +225,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
label: l10n.fallbackSshDest,
icon: MingCute.link_line,
hint: 'user@ip:port',
suggestion: false,
),
TagEditor(
tags: _tags,
@@ -288,6 +292,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
label: l10n.pwd,
icon: Icons.password,
hint: l10n.pwd,
suggestion: false,
onSubmitted: (_) => _onSave(),
));
}
@@ -354,6 +359,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
icon: Icons.image,
label: 'URL',
hint: 'https://example.com/logo.png',
suggestion: false,
),
UIs.height7,
..._buildPVEs(),
@@ -368,6 +374,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
label: l10n.deviceName,
icon: MingCute.low_temperature_line,
hint: 'nvme-pci-0400',
suggestion: false,
),
UIs.height7,
..._buildWOLs(),
@@ -396,6 +403,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
node: node,
label: 'URL',
hint: addr,
suggestion: false,
),
),
ListTile(
@@ -429,6 +437,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
label: 'JSON',
icon: Icons.code,
hint: '{${l10n.customCmdHint}}',
suggestion: false,
),
ListTile(
leading: const Padding(
@@ -460,6 +469,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
label: 'MAC ${l10n.addr}',
icon: Icons.computer,
hint: '00:11:22:33:44:55',
suggestion: false,
),
Input(
controller: _wolIpCtrl,
@@ -467,6 +477,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
label: 'IP ${l10n.addr}',
icon: Icons.network_cell,
hint: '192.168.1.x',
suggestion: false,
),
Input(
controller: _wolPwdCtrl,
@@ -475,6 +486,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
label: l10n.pwd,
icon: Icons.password,
hint: l10n.pwd,
suggestion: false,
),
];
}
@@ -620,17 +632,6 @@ class _ServerEditPageState extends State<ServerEditPage> {
wolCfg: wol,
);
// final tipShown = Stores.history.writeScriptTipShown;
// if (!tipShown.fetch()) {
// final ok = await context.showRoundDialog(
// title: l10n.attention,
// child: SimpleMarkdown(data: l10n.beforeConnect(Urls.thisRepo)),
// actions: Btns.oks(onTap: () => context.pop(true)),
// );
// if (ok != true) return;
// tipShown.put(true);
// }
if (widget.spi == null) {
Pros.server.addServer(spi);
} else {
@@ -645,12 +646,12 @@ class _ServerEditPageState extends State<ServerEditPage> {
leading: const Icon(Icons.tips_and_updates).paddingOnly(left: 13),
title: Text(l10n.attention),
onTap: () {
context.showRoundDialog(
title: l10n.attention,
child: SimpleMarkdown(data: l10n.writeScriptTip),
actions: Btns.oks(onTap: () => context.pop(true)),
);
},
context.showRoundDialog(
title: l10n.attention,
child: SimpleMarkdown(data: l10n.writeScriptTip),
actions: Btns.oks(onTap: () => context.pop(true)),
);
},
trailing: const Icon(Icons.keyboard_arrow_right),
).cardx;
}

View File

@@ -270,6 +270,7 @@ class _SettingPageState extends State<SettingPage> {
controller: ctrl,
hint: '#8b2252',
icon: Icons.colorize,
suggestion: false,
),
ColorPicker(
color: Color(_setting.primaryColor.fetch()),
@@ -784,6 +785,7 @@ class _SettingPageState extends State<SettingPage> {
icon: Icons.format_size,
controller: ctrl,
onSubmitted: _onSaveTextScaler,
suggestion: false,
),
actions: [
TextButton(
@@ -888,6 +890,7 @@ class _SettingPageState extends State<SettingPage> {
autoFocus: true,
type: TextInputType.number,
icon: Icons.font_download,
suggestion: false,
onSubmitted: (_) => onSave(),
),
actions: [
@@ -1151,6 +1154,7 @@ class _SettingPageState extends State<SettingPage> {
hint: 'https://example.com/logo.png',
icon: Icons.link,
maxLines: 2,
suggestion: false,
onSubmitted: onSave,
),
ListTile(

View File

@@ -114,6 +114,7 @@ class _SnippetEditPageState extends State<SnippetEditPage>
onSubmitted: (_) => FocusScope.of(context).requestFocus(_scriptNode),
label: l10n.name,
icon: Icons.info,
suggestion: true,
),
Input(
controller: _noteController,
@@ -122,6 +123,7 @@ class _SnippetEditPageState extends State<SnippetEditPage>
type: TextInputType.multiline,
label: l10n.note,
icon: Icons.note,
suggestion: true,
),
ValBuilder(
listenable: _tags,
@@ -146,6 +148,7 @@ class _SnippetEditPageState extends State<SnippetEditPage>
type: TextInputType.multiline,
label: l10n.snippet,
icon: Icons.code,
suggestion: false,
),
_buildAutoRunOn(),
_buildTip(),

View File

@@ -329,6 +329,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
child: Input(
autoFocus: true,
controller: TextEditingController(text: fileName),
suggestion: true,
onSubmitted: (p0) {
context.pop();
final newPath = '${file.parent.path}/$p0';

View File

@@ -267,6 +267,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
label: l10n.path,
node: node,
controller: controller,
suggestion: true,
onSubmitted: (value) => context.pop(value),
);
},
@@ -617,6 +618,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
icon: Icons.folder,
controller: textController,
label: l10n.name,
suggestion: true,
onSubmitted: (_) => onSubmitted(),
),
actions: [
@@ -672,6 +674,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
icon: Icons.insert_drive_file,
controller: textController,
label: l10n.name,
suggestion: true,
onSubmitted: (_) => onSubmitted(),
),
actions: [
@@ -723,6 +726,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
icon: Icons.abc,
controller: textController,
label: l10n.name,
suggestion: true,
onSubmitted: (_) => onSubmitted(),
),
actions: [