改为null的形式

This commit is contained in:
orz12
2023-12-23 15:49:04 +08:00
parent 0cf707b4c5
commit 25d32f8cc8
4 changed files with 22 additions and 28 deletions

View File

@ -24,13 +24,11 @@ class _ActionPanelState extends State<ActionPanel> {
final DynamicsController _dynamicsController = Get.put(DynamicsController());
late ModuleStatModel stat;
bool isProcessing = false;
VoidCallback handleState(Future Function() action) {
return () async {
if (!isProcessing) {
setState(() => isProcessing = true);
await action();
setState(() => isProcessing = false);
}
void Function()? handleState(Future Function() action) {
return isProcessing ? null : () async {
setState(() => isProcessing = true);
await action();
setState(() => isProcessing = false);
};
}
@override