mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-05 18:20:10 +08:00
@@ -43,10 +43,10 @@ class DynamicSliverAppBarMedium extends StatefulWidget {
|
||||
this.forceMaterialTransparency = false,
|
||||
this.clipBehavior,
|
||||
this.appBarClipper,
|
||||
this.callback,
|
||||
this.afterCalc,
|
||||
});
|
||||
|
||||
final ValueChanged<double>? callback;
|
||||
final ValueChanged<double>? afterCalc;
|
||||
final Widget? flexibleSpace;
|
||||
final Widget? leading;
|
||||
final bool automaticallyImplyLeading;
|
||||
@@ -108,7 +108,7 @@ class _DynamicSliverAppBarMediumState extends State<DynamicSliverAppBarMedium> {
|
||||
_height = (_childKey.currentContext!.findRenderObject()! as RenderBox)
|
||||
.size
|
||||
.height;
|
||||
widget.callback?.call(_height);
|
||||
widget.afterCalc?.call(_height);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -597,7 +597,7 @@ class _ArticlePageState extends CommonDynPageState<ArticlePage> {
|
||||
pic: summary.cover,
|
||||
title: summary.title,
|
||||
uname: summary.author?.name,
|
||||
callback: () {
|
||||
onSuccess: () {
|
||||
if (forward != null) {
|
||||
int count = forward.count ?? 0;
|
||||
forward.count = count + 1;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -273,7 +273,7 @@ abstract class CommonRichTextPubPageState<T extends CommonRichTextPubPage>
|
||||
final res = await DynMentionPanel.onDynMention(
|
||||
context,
|
||||
offset: _mentionOffset,
|
||||
callback: (offset) => _mentionOffset = offset,
|
||||
onCachePos: (offset) => _mentionOffset = offset,
|
||||
);
|
||||
if (res != null) {
|
||||
if (res is MentionItem) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -18,12 +18,12 @@ import 'package:get/get.dart' hide ContextExtensionss;
|
||||
|
||||
class VotePanel extends StatefulWidget {
|
||||
final VoteInfo voteInfo;
|
||||
final FutureOr<LoadingState<VoteInfo>> Function(Set<int>, bool) callback;
|
||||
final FutureOr<LoadingState<VoteInfo>> Function(Set<int>, bool) onVote;
|
||||
|
||||
const VotePanel({
|
||||
super.key,
|
||||
required this.voteInfo,
|
||||
required this.callback,
|
||||
required this.onVote,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -112,7 +112,7 @@ class _VotePanelState extends State<VotePanel> {
|
||||
() => 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,
|
||||
|
||||
@@ -754,7 +754,7 @@ class _CreateDynPanelState extends CommonRichTextPubPageState<CreateDynPanel> {
|
||||
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);
|
||||
|
||||
@@ -278,7 +278,7 @@ class _DynamicDetailPageState extends CommonDynPageState<DynamicDetailPage> {
|
||||
useSafeArea: true,
|
||||
builder: (context) => RepostPanel(
|
||||
item: controller.dynItem,
|
||||
callback: () {
|
||||
onSuccess: () {
|
||||
if (forward != null) {
|
||||
int count = forward.count ?? 0;
|
||||
forward.count = count + 1;
|
||||
|
||||
@@ -21,16 +21,16 @@ class DynMentionPanel extends StatefulWidget {
|
||||
const DynMentionPanel({
|
||||
super.key,
|
||||
this.scrollController,
|
||||
this.callback,
|
||||
this.onCachePos,
|
||||
});
|
||||
|
||||
final ScrollController? scrollController;
|
||||
final ValueChanged<double>? callback;
|
||||
final ValueChanged<double>? onCachePos;
|
||||
|
||||
static Future onDynMention(
|
||||
BuildContext context, {
|
||||
double offset = 0,
|
||||
ValueChanged<double>? callback,
|
||||
ValueChanged<double>? 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;
|
||||
},
|
||||
|
||||
@@ -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<RepostPanel> createState() => _RepostPanelState();
|
||||
@@ -432,7 +432,7 @@ class _RepostPanelState extends CommonRichTextPubPageState<RepostPanel> {
|
||||
hasPub = true;
|
||||
Get.back();
|
||||
SmartDialog.showToast('转发成功');
|
||||
widget.callback?.call();
|
||||
widget.onSuccess?.call();
|
||||
var id = result['data']?['dyn_id'];
|
||||
RequestUtils.insertCreatedDyn(id);
|
||||
RequestUtils.checkCreatedDyn(
|
||||
|
||||
@@ -18,16 +18,16 @@ class SelectTopicPanel extends StatefulWidget {
|
||||
const SelectTopicPanel({
|
||||
super.key,
|
||||
this.scrollController,
|
||||
this.callback,
|
||||
this.onCachePos,
|
||||
});
|
||||
|
||||
final ScrollController? scrollController;
|
||||
final ValueChanged<double>? callback;
|
||||
final ValueChanged<double>? onCachePos;
|
||||
|
||||
static Future<TopicItem?> onSelectTopic(
|
||||
BuildContext context, {
|
||||
double offset = 0,
|
||||
ValueChanged<double>? callback,
|
||||
ValueChanged<double>? onCachePos,
|
||||
}) {
|
||||
return showModalBottomSheet<TopicItem?>(
|
||||
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;
|
||||
},
|
||||
|
||||
@@ -161,7 +161,7 @@ class _DynTopicPageState extends State<DynTopicPage> 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(
|
||||
|
||||
@@ -119,7 +119,7 @@ class _FollowChildPageState extends State<FollowChildPage>
|
||||
item: item,
|
||||
isOwner: widget.controller?.isOwner,
|
||||
onSelect: widget.onSelect,
|
||||
callback: (attr) {
|
||||
afterMod: (attr) {
|
||||
item.attribute = attr == 0 ? -1 : 0;
|
||||
_followController.loadingState.refresh();
|
||||
},
|
||||
|
||||
@@ -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<UserModel>? 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,
|
||||
|
||||
@@ -203,7 +203,7 @@ class MemberController extends CommonDataController<SpaceData, SpaceData?>
|
||||
context: context,
|
||||
mid: mid,
|
||||
isFollow: isFollow,
|
||||
callback: (attribute) => relation.value = attribute,
|
||||
afterMod: (attribute) => relation.value = attribute,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ class _MemberOpusState extends State<MemberOpus>
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
mainAxisSpacing: StyleString.safeSpace,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
callback: (value) => _maxWidth = value,
|
||||
afterCalc: (value) => _maxWidth = value,
|
||||
);
|
||||
|
||||
Widget _buildBody(LoadingState<List<SpaceOpusItemModel>?> loadingState) {
|
||||
|
||||
@@ -66,7 +66,7 @@ class _MemberShopState extends State<MemberShop>
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
mainAxisSpacing: StyleString.safeSpace,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
callback: (value) => _maxWidth = value,
|
||||
afterCalc: (value) => _maxWidth = value,
|
||||
);
|
||||
|
||||
Widget _buildBody(LoadingState<List<SpaceShopItem>?> loadingState) {
|
||||
|
||||
@@ -550,7 +550,7 @@ class _MediaPageState extends CommonPageState<MinePage, MineController>
|
||||
return FavFolderItem(
|
||||
heroTag: Utils.generateRandomString(8),
|
||||
item: response.list[index],
|
||||
callback: () => Future.delayed(
|
||||
onPop: () => Future.delayed(
|
||||
const Duration(milliseconds: 150),
|
||||
controller.onRefresh,
|
||||
),
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -397,7 +397,7 @@ List<SettingsModel> 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<SettingsModel> 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<SettingsModel> 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<int> callback,
|
||||
required ValueChanged<int> onChanged,
|
||||
}) {
|
||||
showDialog<double>(
|
||||
context: context,
|
||||
@@ -745,7 +745,7 @@ void _showQualityDialog({
|
||||
).then((result) {
|
||||
if (result != null) {
|
||||
SmartDialog.showToast('设置成功');
|
||||
callback(result.toInt());
|
||||
onChanged(result.toInt());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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<SlideColorPicker> {
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
widget.callback(null);
|
||||
widget.onChanged(null);
|
||||
},
|
||||
child: const Text('重置'),
|
||||
),
|
||||
@@ -168,7 +168,7 @@ class _SlideColorPickerState extends State<SlideColorPicker> {
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
widget.callback(DmUtils.decimalToColor(_rgb));
|
||||
widget.onChanged(DmUtils.decimalToColor(_rgb));
|
||||
},
|
||||
child: const Text('确定'),
|
||||
),
|
||||
|
||||
@@ -445,7 +445,7 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
|
||||
content: SlideColorPicker(
|
||||
color: color,
|
||||
showResetBtn: true,
|
||||
callback: (Color? color) {
|
||||
onChanged: (Color? color) {
|
||||
_blockColor[index] = color ?? item.first.color;
|
||||
setting.put(
|
||||
SettingBoxKey.blockColor,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
|
||||
@@ -829,7 +829,7 @@ class _UgcIntroPanelState extends State<UgcIntroPanel> {
|
||||
context: context,
|
||||
mid: item.mid,
|
||||
isFollow: false,
|
||||
callback: (val) {
|
||||
afterMod: (val) {
|
||||
introController.staffRelations['${item.mid}'] =
|
||||
true;
|
||||
},
|
||||
|
||||
@@ -306,7 +306,7 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
|
||||
context: context,
|
||||
mid: widget.mid,
|
||||
isFollow: memberInfoModel.isFollowed ?? false,
|
||||
callback: (attribute) {
|
||||
afterMod: (attribute) {
|
||||
_controller
|
||||
..userState.value.data.isFollowed = attribute != 0
|
||||
..userState.refresh();
|
||||
|
||||
@@ -23,12 +23,12 @@ class SendDanmakuPanel extends CommonTextPubPage {
|
||||
final dynamic bvid;
|
||||
final dynamic progress;
|
||||
|
||||
final ValueChanged<DanmakuContentItem<DanmakuExtra>> callback;
|
||||
final ValueChanged<DanmakuContentItem<DanmakuExtra>> 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<SendDanmakuPanel> {
|
||||
late final RxInt _mode;
|
||||
late final RxInt _fontsize;
|
||||
late final RxInt _fontSize;
|
||||
late final Rx<Color> _color;
|
||||
|
||||
final List<Color> _colorList = [
|
||||
@@ -73,7 +73,7 @@ class _SendDanmakuPanelState extends CommonTextPubPageState<SendDanmakuPanel> {
|
||||
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<SendDanmakuPanel> {
|
||||
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<SendDanmakuPanel> {
|
||||
);
|
||||
}
|
||||
|
||||
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<SendDanmakuPanel> {
|
||||
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<SendDanmakuPanel> {
|
||||
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<SendDanmakuPanel> {
|
||||
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<SendDanmakuPanel> {
|
||||
mid: PlPlayerController.instance!.midHash,
|
||||
);
|
||||
}
|
||||
widget.callback(
|
||||
widget.onSuccess(
|
||||
DanmakuContentItem(
|
||||
editController.text,
|
||||
color: isColorful ? Colors.white : _color.value,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -99,7 +99,7 @@ abstract final class RequestUtils {
|
||||
required BuildContext context,
|
||||
required dynamic mid,
|
||||
required bool isFollow,
|
||||
required ValueChanged<int>? callback,
|
||||
required ValueChanged<int>? 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();
|
||||
}
|
||||
|
||||
@@ -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<double>? callback;
|
||||
final ValueChanged<double>? 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!,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user