Merge branch 'opt-DialogAction'

This commit is contained in:
guozhigq
2024-04-27 16:08:44 +08:00
3 changed files with 52 additions and 80 deletions

View File

@ -131,51 +131,37 @@ class BangumiIntroController extends GetxController {
builder: (context) { builder: (context) {
return AlertDialog( return AlertDialog(
title: const Text('选择投币个数'), title: const Text('选择投币个数'),
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12), contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 24),
content: StatefulBuilder(builder: (context, StateSetter setState) { content: StatefulBuilder(builder: (context, StateSetter setState) {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [1, 2]
RadioListTile( .map(
value: 1, (e) => RadioListTile(
title: const Text('1枚'), value: e,
title: Text('$e枚'),
groupValue: _tempThemeValue, groupValue: _tempThemeValue,
onChanged: (value) { onChanged: (value) async {
_tempThemeValue = value!; _tempThemeValue = value!;
Get.appUpdate(); setState(() {});
},
),
RadioListTile(
value: 2,
title: const Text('2枚'),
groupValue: _tempThemeValue,
onChanged: (value) {
_tempThemeValue = value!;
Get.appUpdate();
},
),
],
);
}),
actions: [
TextButton(onPressed: () => Get.back(), child: const Text('取消')),
TextButton(
onPressed: () async {
var res = await VideoHttp.coinVideo( var res = await VideoHttp.coinVideo(
bvid: bvid, multiply: _tempThemeValue); bvid: bvid, multiply: _tempThemeValue);
if (res['status']) { if (res['status']) {
SmartDialog.showToast('投币成功 👏'); SmartDialog.showToast('投币成功 👏');
hasCoin.value = true; hasCoin.value = true;
bangumiDetail.value.stat!['coins'] = bangumiDetail.value.stat!['coins'] =
bangumiDetail.value.stat!['coins'] + _tempThemeValue; bangumiDetail.value.stat!['coins'] +
_tempThemeValue;
} else { } else {
SmartDialog.showToast(res['msg']); SmartDialog.showToast(res['msg']);
} }
Get.back(); Get.back();
}, },
child: const Text('确定'), ),
) )
], .toList(),
);
}),
); );
}); });
} }

View File

@ -29,7 +29,7 @@ class _SelectDialogState<T> extends State<SelectDialog<T>> {
return AlertDialog( return AlertDialog(
title: Text(widget.title), title: Text(widget.title),
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12), contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 24),
content: StatefulBuilder(builder: (context, StateSetter setState) { content: StatefulBuilder(builder: (context, StateSetter setState) {
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(

View File

@ -219,36 +219,19 @@ class VideoIntroController extends GetxController {
builder: (context) { builder: (context) {
return AlertDialog( return AlertDialog(
title: const Text('选择投币个数'), title: const Text('选择投币个数'),
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12), contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 24),
content: StatefulBuilder(builder: (context, StateSetter setState) { content: StatefulBuilder(builder: (context, StateSetter setState) {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [1, 2]
RadioListTile( .map(
value: 1, (e) => RadioListTile(
title: const Text('1枚'), value: e,
title: Text('$e枚'),
groupValue: _tempThemeValue, groupValue: _tempThemeValue,
onChanged: (value) { onChanged: (value) async {
_tempThemeValue = value!; _tempThemeValue = value!;
Get.appUpdate(); setState(() {});
},
),
RadioListTile(
value: 2,
title: const Text('2枚'),
groupValue: _tempThemeValue,
onChanged: (value) {
_tempThemeValue = value!;
Get.appUpdate();
},
),
],
);
}),
actions: [
TextButton(onPressed: () => Get.back(), child: const Text('取消')),
TextButton(
onPressed: () async {
var res = await VideoHttp.coinVideo( var res = await VideoHttp.coinVideo(
bvid: bvid, multiply: _tempThemeValue); bvid: bvid, multiply: _tempThemeValue);
if (res['status']) { if (res['status']) {
@ -261,8 +244,11 @@ class VideoIntroController extends GetxController {
} }
Get.back(); Get.back();
}, },
child: const Text('确定')) ),
], )
.toList(),
);
}),
); );
}); });
} }