diff --git a/lib/pages/fav_create/view.dart b/lib/pages/fav_create/view.dart index a55500ea..f178f5eb 100644 --- a/lib/pages/fav_create/view.dart +++ b/lib/pages/fav_create/view.dart @@ -155,11 +155,13 @@ class _CreateFavPageState extends State { bucket: 'medialist', dir: 'cover', ).then((res) { - if (res['status']) { - _cover = res['data']['location']; - (context as Element).markNeedsBuild(); - } else { - SmartDialog.showToast(res['msg']); + if (context.mounted) { + if (res['status']) { + _cover = res['data']['location']; + (context as Element).markNeedsBuild(); + } else { + SmartDialog.showToast(res['msg']); + } } }); } diff --git a/lib/pages/video/pay_coins/view.dart b/lib/pages/video/pay_coins/view.dart index 3080f4b0..f7cf9723 100644 --- a/lib/pages/video/pay_coins/view.dart +++ b/lib/pages/video/pay_coins/view.dart @@ -188,9 +188,7 @@ class _PayCoinsPageState extends State } void _scale() { - _scale22Controller.forward().whenComplete(() { - _scale22Controller.reverse(); - }); + _scale22Controller.forward().whenComplete(_scale22Controller.reverse); } void _onScroll(int index) { @@ -478,9 +476,7 @@ class _PayCoinsPageState extends State } }); } - _boxAnimController.forward().whenComplete(() { - _boxAnimController.reverse(); - }); + _boxAnimController.forward().whenComplete(_boxAnimController.reverse); _coinSlideController.forward().whenComplete(() { _coinFadeController.forward().whenComplete(() { Get.back(); diff --git a/lib/pages/video/post_panel/view.dart b/lib/pages/video/post_panel/view.dart index df85ac87..62bc5ac2 100644 --- a/lib/pages/video/post_panel/view.dart +++ b/lib/pages/video/post_panel/view.dart @@ -163,17 +163,17 @@ class _PostPanelState extends CommonCollapseSlidePageState { ), const SizedBox(height: 8), ], - Wrap( - runSpacing: 8, - spacing: 16, - children: [ - Row( - mainAxisSize: MainAxisSize.min, + Builder( + builder: (context) { + return Wrap( + runSpacing: 8, + spacing: 16, children: [ - const Text('分类: '), - Builder( - builder: (context) { - return PopupMenuButton( + Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Text('分类: '), + PopupMenuButton( initialValue: list![index].category, onSelected: (item) { @@ -249,76 +249,92 @@ class _PostPanelState extends CommonCollapseSlidePageState { ), ], ), - ); - }, + ), + ], + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Text('行为类别: '), + Builder( + builder: (context) { + return PopupMenuButton< + ActionType>( + initialValue: + list![index].actionType, + onSelected: (item) { + list![index].actionType = + item; + if (item == + ActionType.full) { + updateSegment( + isFirst: true, + index: index, + value: 0, + ); + } + (context as Element) + .markNeedsBuild(); + }, + itemBuilder: (context) => + ActionType.values + .map( + (item) => + PopupMenuItem< + ActionType>( + enabled: list![ + index] + .category + .toActionType + .contains( + item), + value: item, + child: Text( + item.title), + ), + ) + .toList(), + child: Row( + mainAxisSize: + MainAxisSize.min, + children: [ + Text( + list![index] + .actionType + .title, + style: TextStyle( + height: 1, + fontSize: 14, + color: theme + .colorScheme + .secondary, + ), + strutStyle: + const StrutStyle( + height: 1, + leading: 0, + ), + ), + Icon( + MdiIcons + .unfoldMoreHorizontal, + size: MediaQuery + .textScalerOf( + context) + .scale(14), + color: theme.colorScheme + .secondary, + ), + ], + ), + ); + }, + ), + ], ), ], - ), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - const Text('行为类别: '), - Builder(builder: (context) { - return PopupMenuButton( - initialValue: - list![index].actionType, - onSelected: (item) { - list![index].actionType = item; - if (item == ActionType.full) { - updateSegment( - isFirst: true, - index: index, - value: 0, - ); - } - (context as Element) - .markNeedsBuild(); - }, - itemBuilder: (context) => ActionType - .values - .map( - (item) => - PopupMenuItem( - enabled: list![index] - .category - .toActionType - .contains(item), - value: item, - child: Text(item.title), - ), - ) - .toList(), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - list![index].actionType.title, - style: TextStyle( - height: 1, - fontSize: 14, - color: theme - .colorScheme.secondary, - ), - strutStyle: const StrutStyle( - height: 1, - leading: 0, - ), - ), - Icon( - MdiIcons.unfoldMoreHorizontal, - size: MediaQuery.textScalerOf( - context) - .scale(14), - color: theme - .colorScheme.secondary, - ), - ], - ), - ); - }), - ], - ), - ], + ); + }, ), ], ),