Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-01-29 13:35:51 +08:00
parent bcbfe5c849
commit 5979ddb60c
46 changed files with 3266 additions and 3293 deletions

View File

@@ -69,20 +69,18 @@ class _AboutPageState extends State<AboutPage> {
void _showDialog() => showDialog(
context: context,
builder: (context) {
return AlertDialog(
constraints: StyleString.dialogFixedConstraints,
content: TextField(
autofocus: true,
onSubmitted: (value) {
Get.back();
if (value.isNotEmpty) {
PageUtils.handleWebview(value, inApp: true);
}
},
),
);
},
builder: (context) => AlertDialog(
constraints: StyleString.dialogFixedConstraints,
content: TextField(
autofocus: true,
onSubmitted: (value) {
Get.back();
if (value.isNotEmpty) {
PageUtils.handleWebview(value, inApp: true);
}
},
),
),
);
@override
@@ -454,61 +452,59 @@ Future<void> showImportExportDialog<T>(
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text('输入$title'),
constraints: StyleString.dialogFixedConstraints,
content: TextFormField(
key: key,
minLines: 4,
maxLines: 12,
autofocus: true,
decoration: const InputDecoration(
border: OutlineInputBorder(),
errorMaxLines: 3,
),
validator: (value) {
if (forceErrorText != null) return forceErrorText;
try {
json = jsonDecode(value!) as T;
return null;
} catch (e) {
if (e is FormatException) {}
return '解析json失败$e';
}
},
builder: (context) => AlertDialog(
title: Text('输入$title'),
constraints: StyleString.dialogFixedConstraints,
content: TextFormField(
key: key,
minLines: 4,
maxLines: 12,
autofocus: true,
decoration: const InputDecoration(
border: OutlineInputBorder(),
errorMaxLines: 3,
),
actions: [
TextButton(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
validator: (value) {
if (forceErrorText != null) return forceErrorText;
try {
json = jsonDecode(value!) as T;
return null;
} catch (e) {
if (e is FormatException) {}
return '解析json失败$e';
}
},
),
actions: [
TextButton(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
),
TextButton(
onPressed: () async {
if (key.currentState?.validate() == true) {
try {
if (await fromJson(json)) {
Get.back();
SmartDialog.showToast('导入成功');
return;
}
} catch (e) {
forceErrorText = '导入失败:$e';
),
TextButton(
onPressed: () async {
if (key.currentState?.validate() == true) {
try {
if (await fromJson(json)) {
Get.back();
SmartDialog.showToast('导入成功');
return;
}
key.currentState?.validate();
forceErrorText = null;
} catch (e) {
forceErrorText = '导入失败:$e';
}
},
child: const Text('确定'),
),
],
);
},
key.currentState?.validate();
forceErrorText = null;
}
},
child: const Text('确定'),
),
],
),
);
},
),