feat: 一键三连
This commit is contained in:
@ -23,7 +23,7 @@ PODS:
|
|||||||
- FMDB (2.7.5):
|
- FMDB (2.7.5):
|
||||||
- FMDB/standard (= 2.7.5)
|
- FMDB/standard (= 2.7.5)
|
||||||
- FMDB/standard (2.7.5)
|
- FMDB/standard (2.7.5)
|
||||||
- gt3_flutter_plugin (0.0.8):
|
- gt3_flutter_plugin (0.0.9):
|
||||||
- Flutter
|
- Flutter
|
||||||
- GT3Captcha-iOS
|
- GT3Captcha-iOS
|
||||||
- GT3Captcha-iOS (0.15.8.3)
|
- GT3Captcha-iOS (0.15.8.3)
|
||||||
@ -171,13 +171,13 @@ SPEC CHECKSUMS:
|
|||||||
flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529
|
flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529
|
||||||
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
|
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
|
||||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||||
gt3_flutter_plugin: bfa1f26e9a09dc00401514be5ed437f964cabf23
|
gt3_flutter_plugin: 5bd2c08d3c19cbb6ee3b08f4358439e54c8ab2ee
|
||||||
GT3Captcha-iOS: 5e3b1077834d8a9d6f4d64a447a30af3e14affe6
|
GT3Captcha-iOS: 5e3b1077834d8a9d6f4d64a447a30af3e14affe6
|
||||||
media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1
|
media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1
|
||||||
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
|
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
|
||||||
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
|
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
|
||||||
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
|
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
|
||||||
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
|
||||||
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
||||||
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
|
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
|
||||||
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
||||||
|
@ -11,7 +11,6 @@ enum ActionType {
|
|||||||
dislike,
|
dislike,
|
||||||
downloadCover,
|
downloadCover,
|
||||||
copyLink,
|
copyLink,
|
||||||
threeAction,
|
|
||||||
// backgroundPlay,
|
// backgroundPlay,
|
||||||
// listenVideo,
|
// listenVideo,
|
||||||
// downloadVideo,
|
// downloadVideo,
|
||||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/common/action_type.dart';
|
import 'package:pilipala/models/common/action_type.dart';
|
||||||
|
import 'package:pilipala/utils/global_data.dart';
|
||||||
import '../../../utils/storage.dart';
|
import '../../../utils/storage.dart';
|
||||||
|
|
||||||
class ActionMenuSetPage extends StatefulWidget {
|
class ActionMenuSetPage extends StatefulWidget {
|
||||||
@ -12,14 +13,14 @@ class ActionMenuSetPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ActionMenuSetPageState extends State<ActionMenuSetPage> {
|
class _ActionMenuSetPageState extends State<ActionMenuSetPage> {
|
||||||
Box settingStorage = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
late List<String> actionTypeSort;
|
late List<String> actionTypeSort;
|
||||||
late List<Map> allLabels;
|
late List<Map> allLabels;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
actionTypeSort = settingStorage.get(SettingBoxKey.actionTypeSort,
|
actionTypeSort = setting.get(SettingBoxKey.actionTypeSort,
|
||||||
defaultValue: ['like', 'coin', 'collect', 'watchLater', 'share']);
|
defaultValue: ['like', 'coin', 'collect', 'watchLater', 'share']);
|
||||||
allLabels = actionMenuConfig;
|
allLabels = actionMenuConfig;
|
||||||
allLabels.sort((a, b) {
|
allLabels.sort((a, b) {
|
||||||
@ -36,8 +37,9 @@ class _ActionMenuSetPageState extends State<ActionMenuSetPage> {
|
|||||||
.where((i) => actionTypeSort.contains((i['value'] as ActionType).value))
|
.where((i) => actionTypeSort.contains((i['value'] as ActionType).value))
|
||||||
.map<String>((i) => (i['value'] as ActionType).value)
|
.map<String>((i) => (i['value'] as ActionType).value)
|
||||||
.toList();
|
.toList();
|
||||||
settingStorage.put(SettingBoxKey.actionTypeSort, sortedTabbar);
|
setting.put(SettingBoxKey.actionTypeSort, sortedTabbar);
|
||||||
SmartDialog.showToast('保存成功,下次启动时生效');
|
GlobalData().actionTypeSort = sortedTabbar;
|
||||||
|
SmartDialog.showToast('操作成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
void onReorder(int oldIndex, int newIndex) {
|
void onReorder(int oldIndex, int newIndex) {
|
||||||
|
@ -289,11 +289,11 @@ class _StyleSettingState extends State<StyleSetting> {
|
|||||||
onTap: () => Get.toNamed('/navbarSetting'),
|
onTap: () => Get.toNamed('/navbarSetting'),
|
||||||
title: Text('底部导航栏设置', style: titleStyle),
|
title: Text('底部导航栏设置', style: titleStyle),
|
||||||
),
|
),
|
||||||
ListTile(
|
// ListTile(
|
||||||
dense: false,
|
// dense: false,
|
||||||
onTap: () => Get.toNamed('/actionMenuSet'),
|
// onTap: () => Get.toNamed('/actionMenuSet'),
|
||||||
title: Text('操作菜单设置', style: titleStyle),
|
// title: Text('操作菜单设置', style: titleStyle),
|
||||||
),
|
// ),
|
||||||
if (Platform.isAndroid)
|
if (Platform.isAndroid)
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
|
@ -38,6 +38,8 @@ class VideoIntroController extends GetxController {
|
|||||||
RxBool hasCoin = false.obs;
|
RxBool hasCoin = false.obs;
|
||||||
// 是否收藏
|
// 是否收藏
|
||||||
RxBool hasFav = false.obs;
|
RxBool hasFav = false.obs;
|
||||||
|
// 是否不喜欢
|
||||||
|
RxBool hasDisLike = false.obs;
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
bool userLogin = false;
|
bool userLogin = false;
|
||||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||||
@ -153,36 +155,16 @@ class VideoIntroController extends GetxController {
|
|||||||
SmartDialog.showToast('🙏 UP已经收到了~');
|
SmartDialog.showToast('🙏 UP已经收到了~');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SmartDialog.show(
|
var result = await VideoHttp.oneThree(bvid: bvid);
|
||||||
useSystem: true,
|
print('🤣🦴:${result["data"]}');
|
||||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
if (result['status']) {
|
||||||
builder: (BuildContext context) {
|
hasLike.value = result["data"]["like"];
|
||||||
return AlertDialog(
|
hasCoin.value = result["data"]["coin"];
|
||||||
title: const Text('提示'),
|
hasFav.value = result["data"]["fav"];
|
||||||
content: const Text('一键三连 给UP送温暖'),
|
SmartDialog.showToast('三连成功');
|
||||||
actions: [
|
} else {
|
||||||
TextButton(
|
SmartDialog.showToast(result['msg']);
|
||||||
onPressed: () => SmartDialog.dismiss(),
|
}
|
||||||
child: const Text('点错了')),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
var result = await VideoHttp.oneThree(bvid: bvid);
|
|
||||||
if (result['status']) {
|
|
||||||
hasLike.value = result["data"]["like"];
|
|
||||||
hasCoin.value = result["data"]["coin"];
|
|
||||||
hasFav.value = result["data"]["fav"];
|
|
||||||
SmartDialog.showToast('三连成功 🎉');
|
|
||||||
} else {
|
|
||||||
SmartDialog.showToast(result['msg']);
|
|
||||||
}
|
|
||||||
SmartDialog.dismiss();
|
|
||||||
},
|
|
||||||
child: const Text('确认'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// (取消)点赞
|
// (取消)点赞
|
||||||
@ -193,9 +175,8 @@ class VideoIntroController extends GetxController {
|
|||||||
}
|
}
|
||||||
var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value);
|
var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
// hasLike.value = result["data"] == 1 ? true : false;
|
|
||||||
if (!hasLike.value) {
|
if (!hasLike.value) {
|
||||||
SmartDialog.showToast('点赞成功 👍');
|
SmartDialog.showToast('点赞成功');
|
||||||
hasLike.value = true;
|
hasLike.value = true;
|
||||||
videoDetail.value.stat!.like = videoDetail.value.stat!.like! + 1;
|
videoDetail.value.stat!.like = videoDetail.value.stat!.like! + 1;
|
||||||
} else if (hasLike.value) {
|
} else if (hasLike.value) {
|
||||||
@ -215,6 +196,10 @@ class VideoIntroController extends GetxController {
|
|||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (hasCoin.value) {
|
||||||
|
SmartDialog.showToast('已投过币了');
|
||||||
|
return;
|
||||||
|
}
|
||||||
showDialog(
|
showDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
@ -236,7 +221,7 @@ class VideoIntroController extends GetxController {
|
|||||||
var res = await VideoHttp.coinVideo(
|
var res = await VideoHttp.coinVideo(
|
||||||
bvid: bvid, multiply: _tempThemeValue);
|
bvid: bvid, multiply: _tempThemeValue);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
SmartDialog.showToast('投币成功 👏');
|
SmartDialog.showToast('投币成功');
|
||||||
hasCoin.value = true;
|
hasCoin.value = true;
|
||||||
videoDetail.value.stat!.coin =
|
videoDetail.value.stat!.coin =
|
||||||
videoDetail.value.stat!.coin! + _tempThemeValue;
|
videoDetail.value.stat!.coin! + _tempThemeValue;
|
||||||
@ -269,7 +254,7 @@ class VideoIntroController extends GetxController {
|
|||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
// 重新获取收藏状态
|
// 重新获取收藏状态
|
||||||
await queryHasFavVideo();
|
await queryHasFavVideo();
|
||||||
SmartDialog.showToast('✅ 操作成功');
|
SmartDialog.showToast('操作成功');
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
}
|
}
|
||||||
@ -299,7 +284,7 @@ class VideoIntroController extends GetxController {
|
|||||||
Get.back();
|
Get.back();
|
||||||
// 重新获取收藏状态
|
// 重新获取收藏状态
|
||||||
await queryHasFavVideo();
|
await queryHasFavVideo();
|
||||||
SmartDialog.showToast('✅ 操作成功');
|
SmartDialog.showToast('操作成功');
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
import 'dart:ffi';
|
||||||
|
|
||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:expandable/expandable.dart';
|
import 'package:expandable/expandable.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
@ -15,6 +18,7 @@ import 'package:pilipala/models/video_detail_res.dart';
|
|||||||
import 'package:pilipala/pages/video/detail/introduction/controller.dart';
|
import 'package:pilipala/pages/video/detail/introduction/controller.dart';
|
||||||
import 'package:pilipala/pages/video/detail/widgets/ai_detail.dart';
|
import 'package:pilipala/pages/video/detail/widgets/ai_detail.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
import 'package:pilipala/utils/global_data.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
import '../../../../http/user.dart';
|
import '../../../../http/user.dart';
|
||||||
@ -146,13 +150,18 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
RxBool isExpand = false.obs;
|
RxBool isExpand = false.obs;
|
||||||
late ExpandableController _expandableCtr;
|
late ExpandableController _expandableCtr;
|
||||||
|
|
||||||
void Function()? handleState(Future Function() action) {
|
// 一键三连动画
|
||||||
|
late AnimationController _controller;
|
||||||
|
late Animation<double> _scaleTransition;
|
||||||
|
final RxDouble _progress = 0.0.obs;
|
||||||
|
|
||||||
|
void Function()? handleState(Future<dynamic> Function() action) {
|
||||||
return isProcessing
|
return isProcessing
|
||||||
? null
|
? null
|
||||||
: () async {
|
: () async {
|
||||||
setState(() => isProcessing = true);
|
isProcessing = true;
|
||||||
await action();
|
await action.call();
|
||||||
setState(() => isProcessing = false);
|
isProcessing = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,6 +178,25 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
follower = Utils.numFormat(videoIntroController.userStat['follower']);
|
follower = Utils.numFormat(videoIntroController.userStat['follower']);
|
||||||
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
|
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
|
||||||
_expandableCtr = ExpandableController(initialExpanded: false);
|
_expandableCtr = ExpandableController(initialExpanded: false);
|
||||||
|
|
||||||
|
/// 一键三连动画
|
||||||
|
_controller = AnimationController(
|
||||||
|
duration: const Duration(milliseconds: 1500),
|
||||||
|
reverseDuration: const Duration(milliseconds: 300),
|
||||||
|
vsync: this,
|
||||||
|
);
|
||||||
|
_scaleTransition = Tween<double>(begin: 0.5, end: 1.5).animate(_controller)
|
||||||
|
..addListener(() async {
|
||||||
|
_progress.value = _scaleTransition.value - 0.5;
|
||||||
|
if (_progress.value == 1) {
|
||||||
|
if (_controller.status == AnimationStatus.completed) {
|
||||||
|
await videoIntroController.actionOneThree();
|
||||||
|
}
|
||||||
|
_progress.value = 0;
|
||||||
|
_scaleTransition.removeListener(() {});
|
||||||
|
_controller.stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收藏
|
// 收藏
|
||||||
@ -249,6 +277,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_expandableCtr.dispose();
|
_expandableCtr.dispose();
|
||||||
|
_controller.dispose();
|
||||||
|
_scaleTransition.removeListener(() {});
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,6 +558,157 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget actionGrid(BuildContext context, videoIntroController) {
|
Widget actionGrid(BuildContext context, videoIntroController) {
|
||||||
|
final actionTypeSort = GlobalData().actionTypeSort;
|
||||||
|
|
||||||
|
Widget progressWidget(progress) {
|
||||||
|
return SizedBox(
|
||||||
|
width: 68,
|
||||||
|
height: 68,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
value: progress.value,
|
||||||
|
strokeWidth: 4,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Widget> menuListWidgets = {
|
||||||
|
'like': Obx(
|
||||||
|
() {
|
||||||
|
bool likeStatus = videoIntroController.hasLike.value;
|
||||||
|
ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||||
|
return Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
progressWidget(_progress),
|
||||||
|
InkWell(
|
||||||
|
onTapDown: (details) {
|
||||||
|
feedBack();
|
||||||
|
_controller.forward();
|
||||||
|
},
|
||||||
|
onTapUp: (TapUpDetails details) {
|
||||||
|
if (_progress.value == 0) {
|
||||||
|
feedBack();
|
||||||
|
EasyThrottle.throttle(
|
||||||
|
'my-throttler', const Duration(milliseconds: 200), () {
|
||||||
|
videoIntroController.actionLikeVideo();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_controller.reverse();
|
||||||
|
},
|
||||||
|
borderRadius: StyleString.mdRadius,
|
||||||
|
child: SizedBox(
|
||||||
|
width: (Get.size.width - 24) / 5,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
AnimatedSwitcher(
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
transitionBuilder:
|
||||||
|
(Widget child, Animation<double> animation) {
|
||||||
|
return ScaleTransition(
|
||||||
|
scale: animation, child: child);
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
key: ValueKey<bool>(likeStatus),
|
||||||
|
likeStatus
|
||||||
|
? Icons.thumb_up
|
||||||
|
: Icons.thumb_up_alt_outlined,
|
||||||
|
color: likeStatus
|
||||||
|
? colorScheme.primary
|
||||||
|
: colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
Text(
|
||||||
|
widget.videoDetail!.stat!.like!.toString(),
|
||||||
|
style: TextStyle(
|
||||||
|
color: likeStatus ? colorScheme.primary : null,
|
||||||
|
fontSize:
|
||||||
|
Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
'coin': Obx(
|
||||||
|
() => Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
progressWidget(_progress),
|
||||||
|
ActionItem(
|
||||||
|
icon: Image.asset('assets/images/coin.png', width: 30),
|
||||||
|
onTap: handleState(videoIntroController.actionCoinVideo),
|
||||||
|
selectStatus: videoIntroController.hasCoin.value,
|
||||||
|
text: widget.videoDetail!.stat!.coin!.toString(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'collect': Obx(
|
||||||
|
() => Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
progressWidget(_progress),
|
||||||
|
ActionItem(
|
||||||
|
icon: const Icon(Icons.star_border),
|
||||||
|
selectIcon: const Icon(Icons.star),
|
||||||
|
onTap: () => showFavBottomSheet(),
|
||||||
|
onLongPress: () => showFavBottomSheet(type: 'longPress'),
|
||||||
|
selectStatus: videoIntroController.hasFav.value,
|
||||||
|
text: widget.videoDetail!.stat!.favorite!.toString(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'watchLater': ActionItem(
|
||||||
|
icon: const Icon(Icons.watch_later_outlined),
|
||||||
|
onTap: () async {
|
||||||
|
final res =
|
||||||
|
await UserHttp.toViewLater(bvid: widget.videoDetail!.bvid);
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
},
|
||||||
|
selectStatus: false,
|
||||||
|
text: '稍后看',
|
||||||
|
),
|
||||||
|
'share': ActionItem(
|
||||||
|
icon: const Icon(Icons.share),
|
||||||
|
onTap: () => videoIntroController.actionShareVideo(),
|
||||||
|
selectStatus: false,
|
||||||
|
text: '分享',
|
||||||
|
),
|
||||||
|
'dislike': Obx(
|
||||||
|
() => ActionItem(
|
||||||
|
icon: const Icon(Icons.thumb_down_alt_outlined),
|
||||||
|
selectIcon: const Icon(Icons.thumb_down),
|
||||||
|
onTap: () {},
|
||||||
|
selectStatus: videoIntroController.hasDisLike.value,
|
||||||
|
text: '不喜欢',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'downloadCover': ActionItem(
|
||||||
|
icon: const Icon(Icons.image_outlined),
|
||||||
|
onTap: () {},
|
||||||
|
selectStatus: false,
|
||||||
|
text: '下载封面',
|
||||||
|
),
|
||||||
|
'copyLink': ActionItem(
|
||||||
|
icon: const Icon(Icons.link_outlined),
|
||||||
|
onTap: () {},
|
||||||
|
selectStatus: false,
|
||||||
|
text: '复制链接',
|
||||||
|
),
|
||||||
|
};
|
||||||
|
final List<Widget> list = [];
|
||||||
|
for (var i = 0; i < actionTypeSort.length; i++) {
|
||||||
|
list.add(menuListWidgets[actionTypeSort[i]]!);
|
||||||
|
}
|
||||||
|
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (BuildContext context, BoxConstraints constraints) {
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
return Container(
|
return Container(
|
||||||
@ -535,50 +716,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
height: constraints.maxWidth / 5,
|
height: constraints.maxWidth / 5,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
children: [
|
children: list,
|
||||||
Obx(
|
|
||||||
() => ActionItem(
|
|
||||||
icon: const Icon(Icons.thumb_up_alt_outlined),
|
|
||||||
selectIcon: const Icon(Icons.thumb_up),
|
|
||||||
onTap: handleState(videoIntroController.actionLikeVideo),
|
|
||||||
selectStatus: videoIntroController.hasLike.value,
|
|
||||||
text: widget.videoDetail!.stat!.like!.toString()),
|
|
||||||
),
|
|
||||||
Obx(
|
|
||||||
() => ActionItem(
|
|
||||||
icon: Image.asset('assets/images/coin.png', width: 30),
|
|
||||||
onTap: handleState(videoIntroController.actionCoinVideo),
|
|
||||||
selectStatus: videoIntroController.hasCoin.value,
|
|
||||||
text: widget.videoDetail!.stat!.coin!.toString(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Obx(
|
|
||||||
() => ActionItem(
|
|
||||||
icon: const Icon(Icons.star_border),
|
|
||||||
selectIcon: const Icon(Icons.star),
|
|
||||||
onTap: () => showFavBottomSheet(),
|
|
||||||
onLongPress: () => showFavBottomSheet(type: 'longPress'),
|
|
||||||
selectStatus: videoIntroController.hasFav.value,
|
|
||||||
text: widget.videoDetail!.stat!.favorite!.toString(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ActionItem(
|
|
||||||
icon: const Icon(Icons.watch_later_outlined),
|
|
||||||
onTap: () async {
|
|
||||||
final res =
|
|
||||||
await UserHttp.toViewLater(bvid: widget.videoDetail!.bvid);
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
},
|
|
||||||
selectStatus: false,
|
|
||||||
text: '稍后看',
|
|
||||||
),
|
|
||||||
ActionItem(
|
|
||||||
icon: const Icon(Icons.share),
|
|
||||||
onTap: () => videoIntroController.actionShareVideo(),
|
|
||||||
selectStatus: false,
|
|
||||||
text: '分享',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -38,20 +38,29 @@ class ActionItem extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
icon is Icon
|
AnimatedSwitcher(
|
||||||
? Icon(
|
duration: const Duration(milliseconds: 300),
|
||||||
selectStatus ? selectIcon!.icon ?? icon!.icon : icon!.icon,
|
transitionBuilder: (Widget child, Animation<double> animation) {
|
||||||
color: selectStatus
|
return ScaleTransition(scale: animation, child: child);
|
||||||
? Theme.of(context).colorScheme.primary
|
},
|
||||||
: Theme.of(context).colorScheme.outline,
|
child: icon is Icon
|
||||||
)
|
? Icon(
|
||||||
: Image.asset(
|
selectStatus
|
||||||
'assets/images/coin.png',
|
? selectIcon!.icon ?? icon!.icon
|
||||||
width: 25,
|
: icon!.icon,
|
||||||
color: selectStatus
|
color: selectStatus
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Theme.of(context).colorScheme.outline,
|
: Theme.of(context).colorScheme.outline,
|
||||||
),
|
)
|
||||||
|
: Image.asset(
|
||||||
|
key: ValueKey<bool>(selectStatus),
|
||||||
|
'assets/images/coin.png',
|
||||||
|
width: 25,
|
||||||
|
color: selectStatus
|
||||||
|
? Theme.of(context).colorScheme.primary
|
||||||
|
: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
Text(
|
Text(
|
||||||
text ?? '',
|
text ?? '',
|
||||||
@ -60,7 +69,7 @@ class ActionItem extends StatelessWidget {
|
|||||||
selectStatus ? Theme.of(context).colorScheme.primary : null,
|
selectStatus ? Theme.of(context).colorScheme.primary : null,
|
||||||
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -11,7 +11,8 @@ class GlobalData {
|
|||||||
bool enablePlayerControlAnimation = true;
|
bool enablePlayerControlAnimation = true;
|
||||||
final bool enableMYBar =
|
final bool enableMYBar =
|
||||||
setting.get(SettingBoxKey.enableMYBar, defaultValue: true);
|
setting.get(SettingBoxKey.enableMYBar, defaultValue: true);
|
||||||
|
List<String> actionTypeSort = setting.get(SettingBoxKey.actionTypeSort,
|
||||||
|
defaultValue: ['like', 'coin', 'collect', 'watchLater', 'share']);
|
||||||
// 私有构造函数
|
// 私有构造函数
|
||||||
GlobalData._();
|
GlobalData._();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user