opt: simple dialog

This commit is contained in:
My-Responsitories
2026-06-13 11:58:33 +08:00
parent c63fe3866c
commit 3085d58508
26 changed files with 1184 additions and 1433 deletions

View File

@@ -82,49 +82,45 @@ class _WhisperSettingsPageState extends State<WhisperSettingsPage> {
String? selected;
showDialog(
context: context,
builder: (context) => AlertDialog(
builder: (context) => SimpleDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 12),
content: Column(
mainAxisSize: MainAxisSize.min,
children: item.redirect.windowSelect.item.map(
(e) {
if (e.selected) {
selected ??= e.text;
}
return ListTile(
dense: true,
onTap: () async {
if (!e.selected) {
Get.back();
for (final j in item.redirect.windowSelect.item) {
j.selected = false;
}
item.redirect.selectedSummary = e.text;
e.selected = true;
_controller.loadingState.refresh();
final settings = {key: item};
final res = await _controller.onSet(settings);
if (!res) {
for (final j in item.redirect.windowSelect.item) {
j.selected = j.text == selected;
}
item.redirect.selectedSummary = selected!;
_controller.loadingState.refresh();
}
children: item.redirect.windowSelect.item.map(
(e) {
if (e.selected) {
selected ??= e.text;
}
return SimpleDialogOption(
onPressed: () async {
if (!e.selected) {
Get.back();
for (final j in item.redirect.windowSelect.item) {
j.selected = false;
}
},
title: Text(
e.text,
style: TextStyle(
fontSize: 14,
color: e.selected ? theme.colorScheme.primary : null,
),
item.redirect.selectedSummary = e.text;
e.selected = true;
_controller.loadingState.refresh();
final settings = {key: item};
final res = await _controller.onSet(settings);
if (!res) {
for (final j in item.redirect.windowSelect.item) {
j.selected = j.text == selected;
}
item.redirect.selectedSummary = selected!;
_controller.loadingState.refresh();
}
}
},
child: Text(
e.text,
style: TextStyle(
fontSize: 14,
color: e.selected ? theme.colorScheme.primary : null,
),
);
},
).toList(),
),
),
);
},
).toList(),
),
);
} else if (item.redirect.otherPage.hasUrl()) {