diff --git a/lib/common/widgets/dynamic_sliver_appbar_medium.dart b/lib/common/widgets/dynamic_sliver_appbar_medium.dart index 237b33194..efd347ffb 100644 --- a/lib/common/widgets/dynamic_sliver_appbar_medium.dart +++ b/lib/common/widgets/dynamic_sliver_appbar_medium.dart @@ -43,10 +43,10 @@ class DynamicSliverAppBarMedium extends StatefulWidget { this.forceMaterialTransparency = false, this.clipBehavior, this.appBarClipper, - this.callback, + this.afterCalc, }); - final ValueChanged? callback; + final ValueChanged? afterCalc; final Widget? flexibleSpace; final Widget? leading; final bool automaticallyImplyLeading; @@ -108,7 +108,7 @@ class _DynamicSliverAppBarMediumState extends State { _height = (_childKey.currentContext!.findRenderObject()! as RenderBox) .size .height; - widget.callback?.call(_height); + widget.afterCalc?.call(_height); }); }); } diff --git a/lib/http/danmaku.dart b/lib/http/danmaku.dart index 8e4fdf6ec..8f6a12388 100644 --- a/lib/http/danmaku.dart +++ b/lib/http/danmaku.dart @@ -17,7 +17,7 @@ abstract final class DanmakuHttp { required String bvid, int? progress, // 弹幕出现在视频内的时间(单位为毫秒,默认为0) int? color, // 弹幕颜色(默认白色,16777215) - int? fontsize, // 弹幕字号(默认25) + int? fontSize, // 弹幕字号(默认25) int? pool, // 弹幕池选择(0:普通池 1:字幕池 2:特殊池(代码/BAS弹幕)默认普通池,0) //int? rnd,// 当前时间戳*1000000(若无此项,则发送弹幕冷却时间限制为90s;若有此项,则发送弹幕冷却时间限制为5s) bool colorful = false, //60001:专属渐变彩色(需要会员) @@ -38,7 +38,7 @@ abstract final class DanmakuHttp { 'bvid': bvid, 'progress': ?progress, 'color': ?colorful ? 16777215 : color, - 'fontsize': ?fontsize, + 'fontsize': ?fontSize, 'pool': ?pool, 'rnd': DateTime.now().microsecondsSinceEpoch, 'colorful': ?colorful ? 60001 : null, diff --git a/lib/pages/article/view.dart b/lib/pages/article/view.dart index 1f1bec5a2..5bd7d3c6a 100644 --- a/lib/pages/article/view.dart +++ b/lib/pages/article/view.dart @@ -597,7 +597,7 @@ class _ArticlePageState extends CommonDynPageState { pic: summary.cover, title: summary.title, uname: summary.author?.name, - callback: () { + onSuccess: () { if (forward != null) { int count = forward.count ?? 0; forward.count = count + 1; diff --git a/lib/pages/article/widgets/opus_content.dart b/lib/pages/article/widgets/opus_content.dart index 20dd5ef14..4a3ec66aa 100644 --- a/lib/pages/article/widgets/opus_content.dart +++ b/lib/pages/article/widgets/opus_content.dart @@ -11,8 +11,8 @@ import 'package:PiliPlus/models/dynamics/article_content_model.dart' import 'package:PiliPlus/models/dynamics/result.dart'; import 'package:PiliPlus/pages/dynamics/widgets/vote.dart'; import 'package:PiliPlus/utils/app_scheme.dart'; -import 'package:PiliPlus/utils/extension/context_ext.dart'; import 'package:PiliPlus/utils/extension/string_ext.dart'; +import 'package:PiliPlus/utils/extension/theme_ext.dart'; import 'package:PiliPlus/utils/image_utils.dart'; import 'package:PiliPlus/utils/page_utils.dart'; import 'package:cached_network_image/cached_network_image.dart'; @@ -149,13 +149,12 @@ class OpusContent extends StatelessWidget { return const SliverToBoxAdapter(); } - late final highlight = Highlight()..registerLanguages(builtinAllLanguages); - late final isDarkMode = context.isDarkMode; - final colorScheme = Theme.of(context).colorScheme; - + late final isDarkMode = colorScheme.isDark; late final surfaceLuminance = colorScheme.surface.computeLuminance(); + late final highlight = Highlight()..registerLanguages(builtinAllLanguages); + return SliverList.separated( itemCount: opus.length, itemBuilder: (context, index) { diff --git a/lib/pages/common/publish/common_rich_text_pub_page.dart b/lib/pages/common/publish/common_rich_text_pub_page.dart index f412bc1b4..ff6d4e0a7 100644 --- a/lib/pages/common/publish/common_rich_text_pub_page.dart +++ b/lib/pages/common/publish/common_rich_text_pub_page.dart @@ -273,7 +273,7 @@ abstract class CommonRichTextPubPageState final res = await DynMentionPanel.onDynMention( context, offset: _mentionOffset, - callback: (offset) => _mentionOffset = offset, + onCachePos: (offset) => _mentionOffset = offset, ); if (res != null) { if (res is MentionItem) { diff --git a/lib/pages/dynamics/widgets/action_panel.dart b/lib/pages/dynamics/widgets/action_panel.dart index 40daf36a1..8cad2382d 100644 --- a/lib/pages/dynamics/widgets/action_panel.dart +++ b/lib/pages/dynamics/widgets/action_panel.dart @@ -38,7 +38,7 @@ class ActionPanel extends StatelessWidget { useSafeArea: true, builder: (_) => RepostPanel( item: item, - callback: () { + onSuccess: () { int count = forward.count ?? 0; forward.count = count + 1; if (context.mounted) { diff --git a/lib/pages/dynamics/widgets/vote.dart b/lib/pages/dynamics/widgets/vote.dart index 8c4b02bca..a174a91ef 100644 --- a/lib/pages/dynamics/widgets/vote.dart +++ b/lib/pages/dynamics/widgets/vote.dart @@ -18,12 +18,12 @@ import 'package:get/get.dart' hide ContextExtensionss; class VotePanel extends StatefulWidget { final VoteInfo voteInfo; - final FutureOr> Function(Set, bool) callback; + final FutureOr> Function(Set, bool) onVote; const VotePanel({ super.key, required this.voteInfo, - required this.callback, + required this.onVote, }); @override @@ -112,7 +112,7 @@ class _VotePanelState extends State { () => OutlinedButton( onPressed: groupValue.isNotEmpty ? () async { - final res = await widget.callback( + final res = await widget.onVote( groupValue.toSet(), anonymous, ); @@ -597,7 +597,7 @@ Future showVoteDialog( padding: const EdgeInsets.all(24), child: VotePanel( voteInfo: voteInfo.data, - callback: (votes, anonymous) => DynamicsHttp.doVote( + onVote: (votes, anonymous) => DynamicsHttp.doVote( voteId: voteId, votes: votes.toList(), anonymous: anonymous, diff --git a/lib/pages/dynamics_create/view.dart b/lib/pages/dynamics_create/view.dart index 332e8c640..3b8788fcd 100644 --- a/lib/pages/dynamics_create/view.dart +++ b/lib/pages/dynamics_create/view.dart @@ -754,7 +754,7 @@ class _CreateDynPanelState extends CommonRichTextPubPageState { TopicItem? res = await SelectTopicPanel.onSelectTopic( context, offset: _topicOffset, - callback: (offset) => _topicOffset = offset, + onCachePos: (offset) => _topicOffset = offset, ); if (res != null) { topic.value = Pair(first: res.id, second: res.name); diff --git a/lib/pages/dynamics_detail/view.dart b/lib/pages/dynamics_detail/view.dart index d82fcc7fa..eb09ccdf6 100644 --- a/lib/pages/dynamics_detail/view.dart +++ b/lib/pages/dynamics_detail/view.dart @@ -278,7 +278,7 @@ class _DynamicDetailPageState extends CommonDynPageState { useSafeArea: true, builder: (context) => RepostPanel( item: controller.dynItem, - callback: () { + onSuccess: () { if (forward != null) { int count = forward.count ?? 0; forward.count = count + 1; diff --git a/lib/pages/dynamics_mention/view.dart b/lib/pages/dynamics_mention/view.dart index 1309f2871..e870ec46e 100644 --- a/lib/pages/dynamics_mention/view.dart +++ b/lib/pages/dynamics_mention/view.dart @@ -21,16 +21,16 @@ class DynMentionPanel extends StatefulWidget { const DynMentionPanel({ super.key, this.scrollController, - this.callback, + this.onCachePos, }); final ScrollController? scrollController; - final ValueChanged? callback; + final ValueChanged? onCachePos; static Future onDynMention( BuildContext context, { double offset = 0, - ValueChanged? callback, + ValueChanged? onCachePos, }) { return showModalBottomSheet( context: Get.context!, @@ -49,7 +49,7 @@ class DynMentionPanel extends StatefulWidget { snapSizes: const [0.65], builder: (context, scrollController) => DynMentionPanel( scrollController: scrollController, - callback: callback, + onCachePos: onCachePos, ), ), ); @@ -179,7 +179,7 @@ class _DynMentionPanelState _controller.focusNode.unfocus(); } } else if (notification is ScrollEndNotification) { - widget.callback?.call(notification.metrics.pixels); + widget.onCachePos?.call(notification.metrics.pixels); } return false; }, diff --git a/lib/pages/dynamics_repost/view.dart b/lib/pages/dynamics_repost/view.dart index 2d5d067c0..f7faa3d20 100644 --- a/lib/pages/dynamics_repost/view.dart +++ b/lib/pages/dynamics_repost/view.dart @@ -20,7 +20,7 @@ class RepostPanel extends CommonRichTextPubPage { super.key, this.item, this.dynIdStr, - this.callback, + this.onSuccess, // video this.rid, this.dynType, @@ -38,7 +38,7 @@ class RepostPanel extends CommonRichTextPubPage { final DynamicItemModel? item; final String? dynIdStr; - final VoidCallback? callback; + final VoidCallback? onSuccess; @override State createState() => _RepostPanelState(); @@ -432,7 +432,7 @@ class _RepostPanelState extends CommonRichTextPubPageState { hasPub = true; Get.back(); SmartDialog.showToast('转发成功'); - widget.callback?.call(); + widget.onSuccess?.call(); var id = result['data']?['dyn_id']; RequestUtils.insertCreatedDyn(id); RequestUtils.checkCreatedDyn( diff --git a/lib/pages/dynamics_select_topic/view.dart b/lib/pages/dynamics_select_topic/view.dart index bee4cc821..fc82ab80b 100644 --- a/lib/pages/dynamics_select_topic/view.dart +++ b/lib/pages/dynamics_select_topic/view.dart @@ -18,16 +18,16 @@ class SelectTopicPanel extends StatefulWidget { const SelectTopicPanel({ super.key, this.scrollController, - this.callback, + this.onCachePos, }); final ScrollController? scrollController; - final ValueChanged? callback; + final ValueChanged? onCachePos; static Future onSelectTopic( BuildContext context, { double offset = 0, - ValueChanged? callback, + ValueChanged? onCachePos, }) { return showModalBottomSheet( context: Get.context!, @@ -46,7 +46,7 @@ class SelectTopicPanel extends StatefulWidget { snapSizes: const [0.65], builder: (context, scrollController) => SelectTopicPanel( scrollController: scrollController, - callback: callback, + onCachePos: onCachePos, ), ), ); @@ -171,7 +171,7 @@ class _SelectTopicPanelState _controller.focusNode.unfocus(); } } else if (notification is ScrollEndNotification) { - widget.callback?.call(notification.metrics.pixels); + widget.onCachePos?.call(notification.metrics.pixels); } return false; }, diff --git a/lib/pages/dynamics_topic/view.dart b/lib/pages/dynamics_topic/view.dart index 47ded07ca..bf15e0570 100644 --- a/lib/pages/dynamics_topic/view.dart +++ b/lib/pages/dynamics_topic/view.dart @@ -161,7 +161,7 @@ class _DynTopicPageState extends State with DynMixin { Success(:var response) when (topState.dataOrNull != null) => DynamicSliverAppBarMedium( pinned: true, - callback: (value) => + afterCalc: (value) => _controller.appbarOffset = value - kToolbarHeight - padding.top, title: IgnorePointer(child: Text(response!.topicItem!.name)), flexibleSpace: Container( diff --git a/lib/pages/follow/child/child_view.dart b/lib/pages/follow/child/child_view.dart index 99ea35b23..22cffd4f7 100644 --- a/lib/pages/follow/child/child_view.dart +++ b/lib/pages/follow/child/child_view.dart @@ -119,7 +119,7 @@ class _FollowChildPageState extends State item: item, isOwner: widget.controller?.isOwner, onSelect: widget.onSelect, - callback: (attr) { + afterMod: (attr) { item.attribute = attr == 0 ? -1 : 0; _followController.loadingState.refresh(); }, diff --git a/lib/pages/follow/widgets/follow_item.dart b/lib/pages/follow/widgets/follow_item.dart index 2a93348b0..a83d05e0e 100644 --- a/lib/pages/follow/widgets/follow_item.dart +++ b/lib/pages/follow/widgets/follow_item.dart @@ -9,13 +9,13 @@ import 'package:get/get.dart'; class FollowItem extends StatelessWidget { final FollowItemModel item; final bool? isOwner; - final ValueChanged? callback; + final ValueChanged? afterMod; final ValueChanged? onSelect; const FollowItem({ super.key, required this.item, - this.callback, + this.afterMod, this.isOwner, this.onSelect, }); @@ -85,7 +85,7 @@ class FollowItem extends StatelessWidget { context: context, mid: item.mid, isFollow: item.attribute != -1, - callback: callback, + afterMod: afterMod, ), style: FilledButton.styleFrom( visualDensity: .compact, diff --git a/lib/pages/member/controller.dart b/lib/pages/member/controller.dart index f2ad29f8d..2405188fe 100644 --- a/lib/pages/member/controller.dart +++ b/lib/pages/member/controller.dart @@ -203,7 +203,7 @@ class MemberController extends CommonDataController context: context, mid: mid, isFollow: isFollow, - callback: (attribute) => relation.value = attribute, + afterMod: (attribute) => relation.value = attribute, ); } } diff --git a/lib/pages/member_opus/view.dart b/lib/pages/member_opus/view.dart index b2d6a2e4f..6ed40603e 100644 --- a/lib/pages/member_opus/view.dart +++ b/lib/pages/member_opus/view.dart @@ -123,7 +123,7 @@ class _MemberOpusState extends State maxCrossAxisExtent: Grid.smallCardWidth, mainAxisSpacing: StyleString.safeSpace, crossAxisSpacing: StyleString.safeSpace, - callback: (value) => _maxWidth = value, + afterCalc: (value) => _maxWidth = value, ); Widget _buildBody(LoadingState?> loadingState) { diff --git a/lib/pages/member_shop/view.dart b/lib/pages/member_shop/view.dart index 2c12702c6..ed853c96d 100644 --- a/lib/pages/member_shop/view.dart +++ b/lib/pages/member_shop/view.dart @@ -66,7 +66,7 @@ class _MemberShopState extends State maxCrossAxisExtent: Grid.smallCardWidth, mainAxisSpacing: StyleString.safeSpace, crossAxisSpacing: StyleString.safeSpace, - callback: (value) => _maxWidth = value, + afterCalc: (value) => _maxWidth = value, ); Widget _buildBody(LoadingState?> loadingState) { diff --git a/lib/pages/mine/view.dart b/lib/pages/mine/view.dart index 9178963d0..15772e358 100644 --- a/lib/pages/mine/view.dart +++ b/lib/pages/mine/view.dart @@ -550,7 +550,7 @@ class _MediaPageState extends CommonPageState return FavFolderItem( heroTag: Utils.generateRandomString(8), item: response.list[index], - callback: () => Future.delayed( + onPop: () => Future.delayed( const Duration(milliseconds: 150), controller.onRefresh, ), diff --git a/lib/pages/mine/widgets/item.dart b/lib/pages/mine/widgets/item.dart index b3b318f2c..e7ad75c2c 100644 --- a/lib/pages/mine/widgets/item.dart +++ b/lib/pages/mine/widgets/item.dart @@ -8,12 +8,12 @@ class FavFolderItem extends StatelessWidget { const FavFolderItem({ super.key, required this.item, - required this.callback, + required this.onPop, required this.heroTag, }); final FavFolderInfo item; - final VoidCallback callback; + final VoidCallback onPop; final String heroTag; @override @@ -30,7 +30,7 @@ class FavFolderItem extends StatelessWidget { 'mediaId': item.id.toString(), 'heroTag': heroTag, }, - )?.whenComplete(callback); + )?.whenComplete(onPop); }, behavior: HitTestBehavior.opaque, child: Column( diff --git a/lib/pages/setting/models/style_settings.dart b/lib/pages/setting/models/style_settings.dart index dbf72df9e..55d5f83c7 100644 --- a/lib/pages/setting/models/style_settings.dart +++ b/lib/pages/setting/models/style_settings.dart @@ -397,7 +397,7 @@ List get styleSettings => [ context: context, title: '图片质量', initValue: Pref.picQuality, - callback: (picQuality) async { + onChanged: (picQuality) async { GlobalData().imgQuality = picQuality; await GStorage.setting.put(SettingBoxKey.defaultPicQa, picQuality); setState(); @@ -422,7 +422,7 @@ List get styleSettings => [ context: context, title: '查看大图质量', initValue: Pref.previewQ, - callback: (picQuality) async { + onChanged: (picQuality) async { await GStorage.setting.put(SettingBoxKey.previewQuality, picQuality); setState(); }, @@ -450,7 +450,7 @@ List get styleSettings => [ title: const Text('Color Picker'), content: SlideColorPicker( color: reduceLuxColor ?? Colors.white, - callback: (Color? color) { + onChanged: (Color? color) { if (color != null && color != reduceLuxColor) { if (color == Colors.white) { NetworkImgLayer.reduceLuxColor = null; @@ -729,7 +729,7 @@ void _showQualityDialog({ required BuildContext context, required String title, required int initValue, - required ValueChanged callback, + required ValueChanged onChanged, }) { showDialog( context: context, @@ -745,7 +745,7 @@ void _showQualityDialog({ ).then((result) { if (result != null) { SmartDialog.showToast('设置成功'); - callback(result.toInt()); + onChanged(result.toInt()); } }); } diff --git a/lib/pages/setting/slide_color_picker.dart b/lib/pages/setting/slide_color_picker.dart index de03717ad..9893c2e9b 100644 --- a/lib/pages/setting/slide_color_picker.dart +++ b/lib/pages/setting/slide_color_picker.dart @@ -8,12 +8,12 @@ class SlideColorPicker extends StatefulWidget { const SlideColorPicker({ super.key, required this.color, - required this.callback, + required this.onChanged, this.showResetBtn = false, }); final Color color; - final Function(Color? color) callback; + final Function(Color? color) onChanged; final bool showResetBtn; @override @@ -150,7 +150,7 @@ class _SlideColorPickerState extends State { TextButton( onPressed: () { Get.back(); - widget.callback(null); + widget.onChanged(null); }, child: const Text('重置'), ), @@ -168,7 +168,7 @@ class _SlideColorPickerState extends State { TextButton( onPressed: () { Get.back(); - widget.callback(DmUtils.decimalToColor(_rgb)); + widget.onChanged(DmUtils.decimalToColor(_rgb)); }, child: const Text('确定'), ), diff --git a/lib/pages/sponsor_block/view.dart b/lib/pages/sponsor_block/view.dart index 4a62cf8f8..71a8034c2 100644 --- a/lib/pages/sponsor_block/view.dart +++ b/lib/pages/sponsor_block/view.dart @@ -445,7 +445,7 @@ class _SponsorBlockPageState extends State { content: SlideColorPicker( color: color, showResetBtn: true, - callback: (Color? color) { + onChanged: (Color? color) { _blockColor[index] = color ?? item.first.color; setting.put( SettingBoxKey.blockColor, diff --git a/lib/pages/video/controller.dart b/lib/pages/video/controller.dart index 5620314b5..b771a618e 100644 --- a/lib/pages/video/controller.dart +++ b/lib/pages/video/controller.dart @@ -1014,7 +1014,7 @@ class VideoDetailController extends GetxController } } - ({int mode, int fontsize, Color color})? dmConfig; + ({int mode, int fontSize, Color color})? dmConfig; String? savedDanmaku; /// 发送弹幕 @@ -1036,7 +1036,7 @@ class VideoDetailController extends GetxController progress: plPlayerController.position.value.inMilliseconds, initialValue: savedDanmaku, onSave: (danmaku) => savedDanmaku = danmaku, - callback: (danmakuModel) { + onSuccess: (danmakuModel) { savedDanmaku = null; plPlayerController.danmakuController?.addDanmaku(danmakuModel); }, @@ -1171,7 +1171,7 @@ class VideoDetailController extends GetxController seasonId: isUgc ? null : seasonId, pgcType: isUgc ? null : pgcType, videoType: videoType, - callback: () async { + onInit: () async { if (videoState.value is! Success) { videoState.value = const Success(null); } diff --git a/lib/pages/video/introduction/ugc/controller.dart b/lib/pages/video/introduction/ugc/controller.dart index 9b2f17f37..1068e2ef7 100644 --- a/lib/pages/video/introduction/ugc/controller.dart +++ b/lib/pages/video/introduction/ugc/controller.dart @@ -449,7 +449,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin { mid: mid, isFollow: attr != 0, followStatus: followStatus, - callback: (attribute) { + afterMod: (attribute) { followStatus['attribute'] = attribute; Future.delayed(const Duration(milliseconds: 500), queryFollowStatus); }, diff --git a/lib/pages/video/introduction/ugc/view.dart b/lib/pages/video/introduction/ugc/view.dart index fc0b686bc..42d0dc31c 100644 --- a/lib/pages/video/introduction/ugc/view.dart +++ b/lib/pages/video/introduction/ugc/view.dart @@ -829,7 +829,7 @@ class _UgcIntroPanelState extends State { context: context, mid: item.mid, isFollow: false, - callback: (val) { + afterMod: (val) { introController.staffRelations['${item.mid}'] = true; }, diff --git a/lib/pages/video/member/view.dart b/lib/pages/video/member/view.dart index 5205e80e8..95508fc06 100644 --- a/lib/pages/video/member/view.dart +++ b/lib/pages/video/member/view.dart @@ -306,7 +306,7 @@ class _HorizontalMemberPageState extends State { context: context, mid: widget.mid, isFollow: memberInfoModel.isFollowed ?? false, - callback: (attribute) { + afterMod: (attribute) { _controller ..userState.value.data.isFollowed = attribute != 0 ..userState.refresh(); diff --git a/lib/pages/video/send_danmaku/view.dart b/lib/pages/video/send_danmaku/view.dart index 32212cf7e..59bd5d922 100644 --- a/lib/pages/video/send_danmaku/view.dart +++ b/lib/pages/video/send_danmaku/view.dart @@ -23,12 +23,12 @@ class SendDanmakuPanel extends CommonTextPubPage { final dynamic bvid; final dynamic progress; - final ValueChanged> callback; + final ValueChanged> onSuccess; final bool darkVideoPage; // config - final ({int? mode, int? fontsize, Color? color})? dmConfig; - final ValueChanged<({int mode, int fontsize, Color color})>? onSaveDmConfig; + final ({int? mode, int? fontSize, Color? color})? dmConfig; + final ValueChanged<({int mode, int fontSize, Color color})>? onSaveDmConfig; const SendDanmakuPanel({ super.key, @@ -37,7 +37,7 @@ class SendDanmakuPanel extends CommonTextPubPage { this.cid, this.bvid, this.progress, - required this.callback, + required this.onSuccess, required this.darkVideoPage, this.dmConfig, this.onSaveDmConfig, @@ -49,7 +49,7 @@ class SendDanmakuPanel extends CommonTextPubPage { class _SendDanmakuPanelState extends CommonTextPubPageState { late final RxInt _mode; - late final RxInt _fontsize; + late final RxInt _fontSize; late final Rx _color; final List _colorList = [ @@ -73,7 +73,7 @@ class _SendDanmakuPanelState extends CommonTextPubPageState { void initState() { super.initState(); _mode = (widget.dmConfig?.mode ?? 1).obs; - _fontsize = (widget.dmConfig?.fontsize ?? 25).obs; + _fontSize = (widget.dmConfig?.fontSize ?? 25).obs; _color = (widget.dmConfig?.color ?? Colors.white).obs; if (Pref.userInfoCache?.vipStatus == 1) { _colorList.add(Colors.transparent); @@ -84,7 +84,7 @@ class _SendDanmakuPanelState extends CommonTextPubPageState { void dispose() { widget.onSaveDmConfig?.call(( mode: _mode.value, - fontsize: _fontsize.value, + fontSize: _fontSize.value, color: _color.value, )); super.dispose(); @@ -316,15 +316,15 @@ class _SendDanmakuPanelState extends CommonTextPubPageState { ); } - Widget _buildFontSizeItem(int fontsize, String title) { + Widget _buildFontSizeItem(int fontSize, String title) { return Obx( () => Expanded( child: GestureDetector( - onTap: () => _fontsize.value = fontsize, + onTap: () => _fontSize.value = fontSize, child: Container( alignment: Alignment.center, decoration: BoxDecoration( - color: _fontsize.value == fontsize + color: _fontSize.value == fontSize ? themeData.colorScheme.secondaryContainer : themeData.colorScheme.onInverseSurface, borderRadius: const BorderRadius.all(Radius.circular(8)), @@ -333,7 +333,7 @@ class _SendDanmakuPanelState extends CommonTextPubPageState { child: Text( title, style: TextStyle( - color: _fontsize.value == fontsize + color: _fontSize.value == fontSize ? themeData.colorScheme.onSecondaryContainer : themeData.colorScheme.outline, ), @@ -447,7 +447,7 @@ class _SendDanmakuPanelState extends CommonTextPubPageState { title: const Text('Color Picker'), content: SlideColorPicker( color: _color.value, - callback: (Color? color) { + onChanged: (Color? color) { if (color != null) { _color.value = color; } @@ -468,7 +468,7 @@ class _SendDanmakuPanelState extends CommonTextPubPageState { progress: widget.progress, msg: editController.text, mode: _mode.value, - fontsize: _fontsize.value, + fontSize: _fontSize.value, color: isColorful ? null : _color.value.toARGB32() & 0xFFFFFF, colorful: isColorful, ); @@ -484,7 +484,7 @@ class _SendDanmakuPanelState extends CommonTextPubPageState { mid: PlPlayerController.instance!.midHash, ); } - widget.callback( + widget.onSuccess( DanmakuContentItem( editController.text, color: isColorful ? Colors.white : _color.value, diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index ceb021e44..e1be3fa0b 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -615,7 +615,7 @@ class PlPlayerController { int? seasonId, int? pgcType, VideoType? videoType, - VoidCallback? callback, + VoidCallback? onInit, Volume? volume, String? dirPath, String? typeTag, @@ -680,7 +680,7 @@ class PlPlayerController { // listen the video player events startListeners(); await _initializePlayer(); - callback?.call(); + onInit?.call(); } catch (err, stackTrace) { dataStatus.status.value = DataStatus.error; if (kDebugMode) { diff --git a/lib/utils/request_utils.dart b/lib/utils/request_utils.dart index 9cf446213..eef4635b0 100644 --- a/lib/utils/request_utils.dart +++ b/lib/utils/request_utils.dart @@ -99,7 +99,7 @@ abstract final class RequestUtils { required BuildContext context, required dynamic mid, required bool isFollow, - required ValueChanged? callback, + required ValueChanged? afterMod, Map? followStatus, }) async { if (mid == null) { @@ -114,7 +114,7 @@ abstract final class RequestUtils { ); if (res.isSuccess) { SmartDialog.showToast('关注成功'); - callback?.call(2); + afterMod?.call(2); } else { res.toast(); } @@ -151,7 +151,7 @@ abstract final class RequestUtils { ); if (res.isSuccess) { SmartDialog.showToast('$text成功'); - callback?.call(isSpecialFollowed ? 2 : -10); + afterMod?.call(isSpecialFollowed ? 2 : -10); } else { res.toast(); } @@ -196,7 +196,7 @@ abstract final class RequestUtils { ); followStatus!['tag'] = result?.toList(); if (result != null) { - callback?.call(result.contains(-10) ? -10 : 2); + afterMod?.call(result.contains(-10) ? -10 : 2); } }, title: const Text( @@ -215,7 +215,7 @@ abstract final class RequestUtils { ); if (res.isSuccess) { SmartDialog.showToast('取消关注成功'); - callback?.call(0); + afterMod?.call(0); } else { res.toast(); } diff --git a/lib/utils/waterfall.dart b/lib/utils/waterfall.dart index d24ab2abf..b3fe0f3c2 100644 --- a/lib/utils/waterfall.dart +++ b/lib/utils/waterfall.dart @@ -14,7 +14,7 @@ mixin DynMixin { SliverWaterfallFlowDelegateWithMaxCrossAxisExtent( maxCrossAxisExtent: Grid.smallCardWidth * 2, crossAxisSpacing: 4, - callback: (value) => maxWidth = value, + afterCalc: (value) => maxWidth = value, ); Widget buildPage(Widget child) { @@ -79,7 +79,7 @@ class SliverWaterfallFlowDelegateWithMaxCrossAxisExtent super.collectGarbage, super.viewportBuilder, super.closeToTrailing, - this.callback, + this.afterCalc, }) : assert(maxCrossAxisExtent >= 0); /// The maximum extent of tiles in the cross axis. @@ -98,7 +98,7 @@ class SliverWaterfallFlowDelegateWithMaxCrossAxisExtent int? crossAxisCount; double? crossAxisExtent; - final ValueChanged? callback; + final ValueChanged? afterCalc; @override int getCrossAxisCount(SliverConstraints constraints) { @@ -109,7 +109,7 @@ class SliverWaterfallFlowDelegateWithMaxCrossAxisExtent this.crossAxisExtent = crossAxisExtent; crossAxisCount = (crossAxisExtent / (maxCrossAxisExtent + crossAxisSpacing)) .ceil(); - callback?.call( + afterCalc?.call( (crossAxisExtent - ((crossAxisCount! - 1) * crossAxisSpacing)) / crossAxisCount!, );