diff --git a/lib/pages/bangumi/introduction/view.dart b/lib/pages/bangumi/introduction/view.dart index 583be7d9..63c66515 100644 --- a/lib/pages/bangumi/introduction/view.dart +++ b/lib/pages/bangumi/introduction/view.dart @@ -122,13 +122,11 @@ class _BangumiInfoState extends State { late double sheetHeight; int? cid; 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 diff --git a/lib/pages/dynamics/widgets/action_panel.dart b/lib/pages/dynamics/widgets/action_panel.dart index 46ab7202..0ca09b8c 100644 --- a/lib/pages/dynamics/widgets/action_panel.dart +++ b/lib/pages/dynamics/widgets/action_panel.dart @@ -24,13 +24,11 @@ class _ActionPanelState extends State { 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 diff --git a/lib/pages/video/detail/introduction/view.dart b/lib/pages/video/detail/introduction/view.dart index 424ac509..a0d4adde 100644 --- a/lib/pages/video/detail/introduction/view.dart +++ b/lib/pages/video/detail/introduction/view.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:get/get.dart'; @@ -135,13 +137,11 @@ class _VideoInfoState extends State with TickerProviderStateMixin { late String memberHeroTag; late bool enableAi; 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 diff --git a/lib/pages/video/detail/reply/widgets/zan.dart b/lib/pages/video/detail/reply/widgets/zan.dart index 6ce732dd..b9ead14e 100644 --- a/lib/pages/video/detail/reply/widgets/zan.dart +++ b/lib/pages/video/detail/reply/widgets/zan.dart @@ -48,13 +48,11 @@ class _ZanButtonState extends State { } } 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); }; }