diff --git a/lib/common/widgets/html_render.dart b/lib/common/widgets/html_render.dart index ea0b9f460..86c3b666e 100644 --- a/lib/common/widgets/html_render.dart +++ b/lib/common/widgets/html_render.dart @@ -36,15 +36,7 @@ Widget htmlRender({ if (isMall) { return const SizedBox.shrink(); } - // bool inTable = - // extensionContext.element!.previousElementSibling == null || - // extensionContext.element!.nextElementSibling == null; - // imgUrl = Utils().imageUrl(imgUrl!); - // return CachedNetworkImage( - // imageUrl: imgUrl, - // width: isEmote ? 22 : null, - // height: isEmote ? 22 : null, - // ); + String? clazz = attributes['class']; String? height = RegExp(r'max-height:(\d+)px') .firstMatch('${attributes['style']}') @@ -89,7 +81,6 @@ Widget htmlRender({ lineHeight: LineHeight.percent(160), letterSpacing: 0.3, ), - // 'br': Style(margin: Margins.zero, padding: HtmlPaddings.zero), 'body': Style(margin: Margins.zero, padding: HtmlPaddings.zero), 'a': Style( color: Theme.of(context).colorScheme.primary, @@ -100,7 +91,6 @@ Widget htmlRender({ ), 'p': Style( margin: Margins.only(bottom: 4), - // margin: Margins.zero, ), 'span': Style( fontSize: FontSize.large, @@ -128,7 +118,6 @@ Widget htmlRender({ 'figcaption': Style( fontSize: FontSize.large, textAlign: TextAlign.center, - // margin: Margins.only(top: 4), ), 'strong': Style(fontWeight: FontWeight.bold), 'figure': Style( diff --git a/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart b/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart index 6b00551c7..d846d7809 100644 --- a/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart +++ b/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart @@ -458,23 +458,6 @@ class _InteractiveviewerGalleryState extends State imageUrl: Utils.thumbnailImgUrl(widget.sources[index].url), ); }, - // fit: BoxFit.contain, - // progressIndicatorBuilder: (context, url, progress) { - // return Center( - // child: SizedBox( - // width: 150.0, - // child: - // LinearProgressIndicator(value: progress.progress ?? 0), - // ), - // ); - // }, - // errorListener: (value) { - // WidgetsBinding.instance.addPostFrameCallback((_) { - // setState(() { - // _thumbList[index] = false; - // }); - // }); - // }, ), SourceType.livePhoto => Obx(() => currentIndex.value == index ? IgnorePointer( diff --git a/lib/common/widgets/network_img_layer.dart b/lib/common/widgets/network_img_layer.dart index 3635811ac..8dbb861ba 100644 --- a/lib/common/widgets/network_img_layer.dart +++ b/lib/common/widgets/network_img_layer.dart @@ -106,7 +106,6 @@ class NetworkImgLayer extends StatelessWidget { width: width, height: height, cacheWidth: width.cacheSize(context), - // cacheHeight: height.cacheSize(context), ), ), ); diff --git a/lib/common/widgets/video_card_v.dart b/lib/common/widgets/video_card_v.dart index 077cd0370..ac92d0722 100644 --- a/lib/common/widgets/video_card_v.dart +++ b/lib/common/widgets/video_card_v.dart @@ -45,7 +45,6 @@ class VideoCardV extends StatelessWidget { PageUtils.toVideoPage( 'bvid=$bvid&cid=$cid', arguments: { - // 'videoItem': videoItem, 'pic': videoItem.pic, 'heroTag': heroTag, }, @@ -58,7 +57,6 @@ class VideoCardV extends StatelessWidget { String uri = videoItem.uri!; String id = ''; if (uri.startsWith('bilibili://article/')) { - // https://www.bilibili.com/read/cv27063554 dynamicType = 'read'; RegExp regex = RegExp(r'\d+'); Match match = regex.firstMatch(uri)!; diff --git a/lib/common/widgets/video_popup_menu.dart b/lib/common/widgets/video_popup_menu.dart index 2adb6a785..e7fa3faf3 100644 --- a/lib/common/widgets/video_popup_menu.dart +++ b/lib/common/widgets/video_popup_menu.dart @@ -60,7 +60,6 @@ class VideoCustomActions { Icon(MdiIcons.accountCircleOutline, size: 16), () async { Get.toNamed('/member?mid=${videoItem.owner.mid}', arguments: { - // 'face': videoItem.owner.face, 'heroTag': '${videoItem.owner.mid}', }); }, @@ -145,8 +144,6 @@ class VideoCustomActions { onPressed: () async { SmartDialog.showLoading(msg: '正在提交'); var res = await VideoHttp.feedDislikeCancel( - // reasonId: r?.id, - // feedbackId: f?.id, id: v.param!, goto: v.goto!, ); diff --git a/lib/http/msg.dart b/lib/http/msg.dart index 96acac1d1..185458aa2 100644 --- a/lib/http/msg.dart +++ b/lib/http/msg.dart @@ -556,36 +556,5 @@ class MsgHttp { static String getDevId() { return Uuid().v4(); - // final List b = [ - // '0', - // '1', - // '2', - // '3', - // '4', - // '5', - // '6', - // '7', - // '8', - // '9', - // 'A', - // 'B', - // 'C', - // 'D', - // 'E', - // 'F' - // ]; - // final List s = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split(''); - // for (int i = 0; i < s.length; i++) { - // if ('-' == s[i] || '4' == s[i]) { - // continue; - // } - // final int randomInt = Random().nextInt(16); - // if ('x' == s[i]) { - // s[i] = b[randomInt]; - // } else { - // s[i] = b[3 & randomInt | 8]; - // } - // } - // return s.join(); } } diff --git a/lib/http/user.dart b/lib/http/user.dart index 3476eef1f..75b5d1dd9 100644 --- a/lib/http/user.dart +++ b/lib/http/user.dart @@ -418,30 +418,6 @@ class UserHttp { return {'status': false, 'msg': res.data['message']}; } } - // // 相互关系查询 - // static Future relationSearch(int mid) async { - // Map params = await WbiSign.makSign({ - // 'mid': mid, - // 'token': '', - // 'platform': 'web', - // 'web_location': 1550101, - // }); - // var res = await Request().get( - // Api.relationSearch, - // data: { - // 'mid': mid, - // 'w_rid': params['w_rid'], - // 'wts': params['wts'], - // }, - // ); - // if (res.data['code'] == 0) { - // // relation 主动状态 - // // 被动状态 - // return {'status': true, 'data': res.data['data']}; - // } else { - // return {'status': false, 'msg': res.data['message']}; - // } - // } // 搜索历史记录 static Future> searchHistory( diff --git a/lib/http/video.dart b/lib/http/video.dart index b45d8de2b..f0f58c912 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -24,9 +24,6 @@ import 'api.dart'; import 'init.dart'; import 'login.dart'; -/// res.data['code'] == 0 请求正常返回结果 -/// res.data['data'] 为结果 -/// 返回{'status': bool, 'data': List} /// view层根据 status 判断渲染逻辑 class VideoHttp { static bool enableRcmdDynamic = @@ -374,28 +371,6 @@ class VideoHttp { } } - // 获取点赞状态 - // static Future hasLikeVideo({required String bvid}) async { - // var res = - // await Request().get(Api.hasLikeVideo, queryParameters: {'bvid': bvid}); - // if (res.data['code'] == 0) { - // return {'status': true, 'data': res.data['data']}; - // } else { - // return {'status': false, 'msg': res.data['message']}; - // } - // } - - // 获取投币状态 - // static Future hasCoinVideo({required String bvid}) async { - // var res = - // await Request().get(Api.hasCoinVideo, queryParameters: {'bvid': bvid}); - // if (res.data['code'] == 0) { - // return {'status': true, 'data': res.data['data']}; - // } else { - // return {'status': false, 'msg': res.data['message']}; - // } - // } - // 投币 static Future coinVideo({ required String bvid, @@ -420,17 +395,6 @@ class VideoHttp { } } - // 获取收藏状态 - // static Future hasFavVideo({required int aid}) async { - // var res = - // await Request().get(Api.hasFavVideo, queryParameters: {'aid': aid}); - // if (res.data['code'] == 0) { - // return {'status': true, 'data': res.data['data']}; - // } else { - // return {'status': false, 'msg': res.data['message']}; - // } - // } - // 一键三连 bangumi static Future triple({dynamic epId, required dynamic seasonId}) async { var res = await Request().post( @@ -492,11 +456,6 @@ class VideoHttp { 'like': type ? '0' : '1', }, options: Options(contentType: Headers.formUrlEncodedContentType), - // queryParameters: { - // 'bvid': bvid, - // 'like': type ? 1 : 2, - // 'csrf': Accounts.main.csrf, - // }, ); if (res.data['code'] == 0) { return {'status': true, 'data': res.data['data']}; @@ -541,7 +500,6 @@ class VideoHttp { var res = await Request().get(Api.feedDislike, queryParameters: { 'goto': goto, 'id': id, - // 'mid': mid, if (reasonId != null) 'reason_id': reasonId, if (feedbackId != null) 'feedback_id': feedbackId, 'build': '1', @@ -563,11 +521,9 @@ class VideoHttp { if (Accounts.get(AccountType.recommend).accessKey.isNullOrEmpty) { return {'status': false, 'msg': "请退出账号后重新登录"}; } - // assert ((reasonId != null) ^ (feedbackId != null)); var res = await Request().get(Api.feedDislikeCancel, queryParameters: { 'goto': goto, 'id': id, - // 'mid': mid, if (reasonId != null) 'reason_id': reasonId, if (feedbackId != null) 'feedback_id': feedbackId, 'build': '1', @@ -627,33 +583,6 @@ class VideoHttp { } } - // (取消)收藏 bangumi - // static Future favBangumi({ - // required dynamic epId, - // String? addIds, - // String? delIds, - // }) async { - // var res = await Request().post( - // Api.favBangumi, - // data: { - // 'resources': '$epId:24', - // 'add_media_ids': addIds ?? '', - // 'del_media_ids': delIds ?? '', - // 'csrf': Accounts.main.csrf, - // }, - // options: Options( - // headers: { - // 'Content-Type': Headers.formUrlEncodedContentType, - // }, - // ), - // ); - // if (res.data['code'] == 0) { - // return {'status': true, 'data': res.data['data']}; - // } else { - // return {'status': false, 'msg': res.data['message']}; - // } - // } - static Future copyOrMoveFav({ required bool isCopy, required bool isFav, @@ -853,7 +782,6 @@ class VideoHttp { subType, }) async { await Request().post(Api.heartBeat, queryParameters: { - // 'aid': aid, 'bvid': bvid, 'cid': cid, if (epid != null) 'epid': epid, @@ -989,26 +917,10 @@ class VideoHttp { ); if (res.data['code'] == 0) { dynamic data = res.data['data']; - /* - [ - { - "id": 1430455228267894300, - "lan": "ai-zh", - "lan_doc": "中文(自动生成)", - "is_lock": false, - "subtitle_url": "//aisubtitle.hdslb.com/bfs/ai_subtitle/prod/15508958271448462983dacf99a49f40ccdf91a4df8d925e2b58?auth_key=1708941835-aaa0e44844594386ad356795733983a2-0-89af73c6aad5a1fca43b02113fa9d485", - "type": 1, - "id_str": "1430455228267894272", - "ai_type": 0, - "ai_status": 2 - } - ] - */ return { 'status': true, 'subtitles': data['subtitle']['subtitles'], 'view_points': data['view_points'], - // 'last_play_time': data['last_play_time'], 'last_play_cid': data['last_play_cid'], 'interaction': data['interaction'], }; diff --git a/lib/models/user/fav_detail.dart b/lib/models/user/fav_detail.dart index ebef6c5bd..01a8f4306 100644 --- a/lib/models/user/fav_detail.dart +++ b/lib/models/user/fav_detail.dart @@ -62,7 +62,4 @@ class FavDetailItemData extends BaseVideoItemModel with MultiSelectData { static final _digitRegExp = RegExp(r'\d+'); String resolveEpId(String url) => _digitRegExp.firstMatch(url)!.group(0)!; - - // @override - // bool isFollowed; } diff --git a/lib/models/video/play/quality.dart b/lib/models/video/play/quality.dart index 34cb858d3..e41faa9c4 100644 --- a/lib/models/video/play/quality.dart +++ b/lib/models/video/play/quality.dart @@ -59,7 +59,6 @@ extension VideoQualityDesc on VideoQuality { String get description => _descList[index]; } -/// enum AudioQuality { k64, k132, k192, dolby, hiRes } extension AudioQualityCode on AudioQuality { diff --git a/lib/models/video/play/url.dart b/lib/models/video/play/url.dart index 4a6ed23f1..268e709b3 100644 --- a/lib/models/video/play/url.dart +++ b/lib/models/video/play/url.dart @@ -16,7 +16,6 @@ class PlayUrlModel { this.seekType, this.dash, this.supportFormats, - // this.highFormat, this.lastPlayTime, this.lastPlayCid, }); @@ -36,7 +35,6 @@ class PlayUrlModel { Dash? dash; List? durl; List? supportFormats; - // String? highFormat; int? lastPlayTime; int? lastPlayCid; @@ -175,8 +173,9 @@ class VideoItem { baseUrl = json['baseUrl']; var backupUrls = json['backupUrl']?.toList() ?? []; backupUrl = backupUrls.isNotEmpty - ? backupUrls.firstWhere((i) => !_isMCDNorPCDN(i), orElse: () => backupUrls.first) - : ''; + ? backupUrls.firstWhere((i) => !_isMCDNorPCDN(i), + orElse: () => backupUrls.first) + : ''; bandWidth = json['bandWidth']; mimeType = json['mime_type']; codecs = json['codecs']; @@ -248,8 +247,9 @@ class AudioItem { baseUrl = json['baseUrl']; var backupUrls = json['backupUrl']?.toList() ?? []; backupUrl = backupUrls.isNotEmpty - ? backupUrls.firstWhere((i) => !_isMCDNorPCDN(i), orElse: () => backupUrls.first) - : ''; + ? backupUrls.firstWhere((i) => !_isMCDNorPCDN(i), + orElse: () => backupUrls.first) + : ''; bandWidth = json['bandWidth']; mimeType = json['mime_type']; codecs = json['codecs']; diff --git a/lib/pages/about/index.dart b/lib/pages/about/view.dart similarity index 69% rename from lib/pages/about/index.dart rename to lib/pages/about/view.dart index d47315187..e7d601929 100644 --- a/lib/pages/about/index.dart +++ b/lib/pages/about/view.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:PiliPlus/build_config.dart'; +import 'package:PiliPlus/common/widgets/dialog.dart'; import 'package:PiliPlus/services/loggeer.dart'; import 'package:PiliPlus/utils/accounts/account.dart'; import 'package:PiliPlus/utils/login_utils.dart'; @@ -12,7 +13,6 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; import 'package:package_info_plus/package_info_plus.dart'; -import 'package:PiliPlus/models/github/latest.dart'; import 'package:PiliPlus/utils/storage.dart'; import 'package:PiliPlus/utils/utils.dart'; import '../../utils/cache_manage.dart'; @@ -28,16 +28,33 @@ class AboutPage extends StatefulWidget { } class _AboutPageState extends State { - final AboutController _aboutController = Get.put(AboutController()); final String _sourceCodeUrl = 'https://github.com/bggRGjQaUbCoE/PiliPlus'; - final String _originSourceCodeUrl = 'https://github.com/guozhigq/pilipala'; - final String _upstreamUrl = 'https://github.com/orz12/PiliPalaX'; + + RxString currentVersion = ''.obs; + RxString cacheSize = ''.obs; late int _pressCount = 0; late Color outline; late TextStyle subTitleStyle; + @override + void initState() { + super.initState(); + getCacheSize(); + getCurrentApp(); + } + + Future getCacheSize() async { + cacheSize.value = await CacheManage().loadApplicationCache(); + } + + Future getCurrentApp() async { + var currentInfo = await PackageInfo.fromPlatform(); + String buildNumber = currentInfo.buildNumber; + currentVersion.value = "${currentInfo.version}+$buildNumber"; + } + @override void didChangeDependencies() { super.didChangeDependencies(); @@ -46,18 +63,6 @@ class _AboutPageState extends State { TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.outline); } - @override - void initState() { - super.initState(); - // 读取缓存占用 - getCacheSize(); - } - - Future getCacheSize() async { - final res = await CacheManage().loadApplicationCache(); - _aboutController.cacheSize.value = res; - } - @override Widget build(BuildContext context) { return Scaffold( @@ -123,12 +128,11 @@ class _AboutPageState extends State { Obx( () => ListTile( onTap: () => Utils.checkUpdate(false), - onLongPress: () => - Utils.copyText(_aboutController.currentVersion.value), + onLongPress: () => Utils.copyText(currentVersion.value), title: const Text('当前版本'), leading: const Icon(Icons.commit_outlined), trailing: Text( - _aboutController.currentVersion.value, + currentVersion.value, style: subTitleStyle, ), ), @@ -156,24 +160,6 @@ Commit Hash: ${BuildConfig.commitHash}''', title: const Text('Source Code'), subtitle: Text(_sourceCodeUrl, style: subTitleStyle), ), - ListTile( - onTap: () => PageUtils.launchURL(_originSourceCodeUrl), - leading: const Icon(Icons.code), - title: const Text('Origin'), - subtitle: Text( - _originSourceCodeUrl, - style: subTitleStyle, - ), - ), - ListTile( - onTap: () => PageUtils.launchURL(_upstreamUrl), - leading: const Icon(Icons.code), - title: const Text('Upstream'), - subtitle: Text( - _upstreamUrl, - style: subTitleStyle, - ), - ), if (Platform.isAndroid) ListTile( onTap: () { @@ -189,22 +175,7 @@ Commit Hash: ${BuildConfig.commitHash}''', ), ListTile( onTap: () { - showDialog( - context: context, - builder: (context) { - return SimpleDialog( - clipBehavior: Clip.hardEdge, - title: const Text('问题反馈'), - children: [ - ListTile( - title: const Text('GitHub Issue'), - onTap: () => - PageUtils.launchURL('$_sourceCodeUrl/issues'), - ), - ], - ); - }, - ); + PageUtils.launchURL('$_sourceCodeUrl/issues'); }, leading: const Icon(Icons.feedback_outlined), title: const Text('问题反馈'), @@ -225,15 +196,30 @@ Commit Hash: ${BuildConfig.commitHash}''', trailing: Icon(Icons.arrow_forward, size: 16, color: outline), ), ListTile( - onTap: () async { - await CacheManage().clearCacheAll(context); - getCacheSize(); + onTap: () { + showConfirmDialog( + context: context, + title: '提示', + content: '该操作将清除图片及网络请求缓存数据,确认清除?', + onConfirm: () async { + SmartDialog.showLoading(msg: '正在清除...'); + try { + await CacheManage.clearLibraryCache(); + SmartDialog.showToast('清除成功'); + } catch (err) { + SmartDialog.showToast(err.toString()); + } finally { + SmartDialog.dismiss(); + } + getCacheSize(); + }, + ); }, leading: const Icon(Icons.delete_outline), title: const Text('清除缓存'), subtitle: Obx( () => Text( - '图片及网络缓存 ${_aboutController.cacheSize.value}', + '图片及网络缓存 ${cacheSize.value}', style: subTitleStyle, ), ), @@ -254,14 +240,6 @@ Commit Hash: ${BuildConfig.commitHash}''', Get.back(); String res = jsonEncode(Accounts.account.toMap()); Utils.copyText(res); - // if (context.mounted) { - // showDialog( - // context: context, - // builder: (context) => AlertDialog( - // content: SelectableText('$res'), - // ), - // ); - // } }, ), ListTile( @@ -328,78 +306,79 @@ Commit Hash: ${BuildConfig.commitHash}''', }, ), ListTile( - title: const Text('导入/导出设置'), - dense: false, - leading: const Icon(Icons.import_export_outlined), - onTap: () { - showDialog( - context: context, - builder: (context) { - return SimpleDialog( - clipBehavior: Clip.hardEdge, - title: const Text('导入/导出设置'), - children: [ - ListTile( - title: const Text('导出设置至剪贴板'), - onTap: () async { - Get.back(); - String data = await GStorage.exportAllSettings(); - Utils.copyText(data); - }, - ), - ListTile( - title: const Text('从剪贴板导入设置'), - onTap: () async { - Get.back(); - ClipboardData? data = - await Clipboard.getData('text/plain'); - if (data == null || - data.text == null || - data.text!.isEmpty) { - SmartDialog.showToast('剪贴板无数据'); - return; - } - if (!context.mounted) return; - await showDialog( - context: context, - builder: (context) { - return AlertDialog( - title: const Text('是否导入如下设置?'), - content: SingleChildScrollView( - child: Text(data.text!), + title: const Text('导入/导出设置'), + dense: false, + leading: const Icon(Icons.import_export_outlined), + onTap: () { + showDialog( + context: context, + builder: (context) { + return SimpleDialog( + clipBehavior: Clip.hardEdge, + title: const Text('导入/导出设置'), + children: [ + ListTile( + title: const Text('导出设置至剪贴板'), + onTap: () async { + Get.back(); + String data = await GStorage.exportAllSettings(); + Utils.copyText(data); + }, + ), + ListTile( + title: const Text('从剪贴板导入设置'), + onTap: () async { + Get.back(); + ClipboardData? data = + await Clipboard.getData('text/plain'); + if (data == null || + data.text == null || + data.text!.isEmpty) { + SmartDialog.showToast('剪贴板无数据'); + return; + } + if (!context.mounted) return; + showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: const Text('是否导入如下设置?'), + content: SingleChildScrollView( + child: Text(data.text!), + ), + actions: [ + TextButton( + onPressed: Get.back, + child: Text( + '取消', + style: TextStyle(color: outline), + ), ), - actions: [ - TextButton( - onPressed: Get.back, - child: Text( - '取消', - style: TextStyle(color: outline), - ), - ), - TextButton( - onPressed: () async { - Get.back(); - try { - await GStorage.importAllSettings( - data.text!); - SmartDialog.showToast('导入成功'); - } catch (e) { - SmartDialog.showToast('导入失败:$e'); - } - }, - child: const Text('确定'), - ), - ], - ); - }, - ); - }, - ), - ], - ); - }, - ); - }), + TextButton( + onPressed: () async { + Get.back(); + try { + await GStorage.importAllSettings( + data.text!); + SmartDialog.showToast('导入成功'); + } catch (e) { + SmartDialog.showToast('导入失败:$e'); + } + }, + child: const Text('确定'), + ), + ], + ); + }, + ); + }, + ), + ], + ); + }, + ); + }, + ), ListTile( title: const Text('重置所有设置'), leading: const Icon(Icons.settings_backup_restore_outlined), @@ -449,32 +428,9 @@ Commit Hash: ${BuildConfig.commitHash}''', ); }, ), - SizedBox(height: MediaQuery.paddingOf(context).bottom + 80), + const SizedBox(height: 80), ], ), ); } } - -class AboutController extends GetxController { - RxString currentVersion = ''.obs; - RxString remoteVersion = ''.obs; - LatestDataModel? remoteAppInfo; - RxBool isUpdate = true.obs; - RxBool isLoading = true.obs; - LatestDataModel? data; - RxString cacheSize = ''.obs; - - @override - void onInit() { - super.onInit(); - getCurrentApp(); - } - - // 获取当前版本 - Future getCurrentApp() async { - var currentInfo = await PackageInfo.fromPlatform(); - String buildNumber = currentInfo.buildNumber; - currentVersion.value = "${currentInfo.version}+$buildNumber"; - } -} diff --git a/lib/pages/bangumi/introduction/controller.dart b/lib/pages/bangumi/introduction/controller.dart index be172827b..3f2e98a74 100644 --- a/lib/pages/bangumi/introduction/controller.dart +++ b/lib/pages/bangumi/introduction/controller.dart @@ -103,7 +103,6 @@ class BangumiIntroController var result = await UserHttp.videoTags(bvid: bvid); if (result['status']) { videoTags = result['data']; - // debugPrint('tags: ${result['data']}'); } } @@ -562,10 +561,6 @@ class BangumiIntroController scriptContent['props']['pageProps']['followState']['isFollowed']; followStatus.value = scriptContent['props']['pageProps']['followState']['followStatus']; - // int progress = scriptContent['props']['pageProps']['dehydratedState'] - // ['queries'][0]['state']['data']['result'] - // ['play_view_business_info']['user_status']['watch_progress'] - // ['current_watch_progress']; } } catch (_) {} } diff --git a/lib/pages/bangumi/introduction/view.dart b/lib/pages/bangumi/introduction/view.dart index 26251ecfa..05e14aaaf 100644 --- a/lib/pages/bangumi/introduction/view.dart +++ b/lib/pages/bangumi/introduction/view.dart @@ -394,16 +394,6 @@ class _BangumiInfoState extends State { ], ), const SizedBox(height: 6), - // 点赞收藏转发 布局样式1 - // SingleChildScrollView( - // padding: const EdgeInsets.only(top: 7, bottom: 7), - // scrollDirection: Axis.horizontal, - // child: actionRow( - // context, - // bangumiIntroController, - // videoDetailCtr, - // ), - // ), // 点赞收藏转发 布局样式2 actionGrid(context, bangumiIntroController), // 番剧分p diff --git a/lib/pages/bangumi/widgets/bangumi_panel.dart b/lib/pages/bangumi/widgets/bangumi_panel.dart index 3d497db53..863abec71 100644 --- a/lib/pages/bangumi/widgets/bangumi_panel.dart +++ b/lib/pages/bangumi/widgets/bangumi_panel.dart @@ -68,24 +68,8 @@ class _BangumiPanelState extends State { super.dispose(); } - // void changeFucCall(item, i) async { - // if (item.badge != null && item.badge == '会员' && vipStatus != 1) { - // SmartDialog.showToast('需要大会员'); - // return; - // } - // await widget.changeFuc!( - // item.bvid, - // item.cid, - // item.aid, - // ); - // currentIndex = i; - // setState(() {}); - // scrollToIndex(); - // } - void scrollToIndex() { WidgetsBinding.instance.addPostFrameCallback((_) { - // 在回调函数中获取更新后的状态 listViewScrollCtr.animateTo( (currentIndex * 150.0).clamp(listViewScrollCtr.position.minScrollExtent, listViewScrollCtr.position.maxScrollExtent), @@ -148,11 +132,12 @@ class _BangumiPanelState extends State { scrollDirection: Axis.horizontal, itemCount: widget.pages.length, itemExtent: 150, - itemBuilder: (BuildContext context, int i) { + itemBuilder: (BuildContext context, int index) { + final item = widget.pages[index]; return Container( width: 150, margin: EdgeInsets.only( - right: i == widget.pages.length - 1 ? 0 : 10, + right: index == widget.pages.length - 1 ? 0 : 10, ), child: Material( color: Theme.of(context).colorScheme.onInverseSurface, @@ -160,24 +145,19 @@ class _BangumiPanelState extends State { clipBehavior: Clip.hardEdge, child: InkWell( onTap: () { - if (widget.pages[i].badge != null && - widget.pages[i].badge == '会员' && + if (item.badge != null && + item.badge == '会员' && vipStatus != 1) { SmartDialog.showToast('需要大会员'); - // return; } widget.changeFuc( - widget.pages[i].epId, - widget.pages[i].bvid, - widget.pages[i].cid, - widget.pages[i].aid, - widget.pages[i].cover, + item.epId, + item.bvid, + item.cid, + item.aid, + item.cover, ); - // currentIndex = i; - // setState(() {}); - // scrollToIndex(); }, - //changeFucCall(widget.pages[i], i), child: Padding( padding: const EdgeInsets.symmetric( vertical: 8, horizontal: 10), @@ -186,7 +166,7 @@ class _BangumiPanelState extends State { children: [ Row( children: [ - if (i == currentIndex) ...[ + if (index == currentIndex) ...[ Image.asset( 'assets/images/live.png', color: Theme.of(context).colorScheme.primary, @@ -197,32 +177,32 @@ class _BangumiPanelState extends State { ], Expanded( child: Text( - widget.pages[i].title ?? '第${i + 1}话', - maxLines: (widget.pages[i].longTitle != null && - widget.pages[i].longTitle != '') + item.title ?? '第${index + 1}话', + maxLines: (item.longTitle != null && + item.longTitle != '') ? 1 : 2, style: TextStyle( fontSize: 13, - color: i == currentIndex + color: index == currentIndex ? Theme.of(context).colorScheme.primary : Theme.of(context) .colorScheme .onSurface), )), const SizedBox(width: 2), - if (widget.pages[i].badge != null) ...[ + if (item.badge != null) ...[ const Spacer(), - if (widget.pages[i].badge == '会员') ...[ + if (item.badge == '会员') ...[ Image.asset( 'assets/images/big-vip.png', height: 16, semanticLabel: "大会员", ), ], - if (widget.pages[i].badge != '会员') ...[ + if (item.badge != '会员') ...[ Text( - widget.pages[i].badge!, + item.badge!, style: TextStyle( fontSize: 11, color: @@ -233,15 +213,15 @@ class _BangumiPanelState extends State { ] ], ), - if (widget.pages[i].longTitle != null && - widget.pages[i].longTitle != '') ...[ + if (item.longTitle != null && + item.longTitle != '') ...[ const SizedBox(height: 3), Text( - widget.pages[i].longTitle!, + item.longTitle!, maxLines: 1, style: TextStyle( fontSize: 13, - color: i == currentIndex + color: index == currentIndex ? Theme.of(context).colorScheme.primary : Theme.of(context) .colorScheme diff --git a/lib/pages/danmaku_block/view.dart b/lib/pages/danmaku_block/view.dart index 545da3fcf..27a88d607 100644 --- a/lib/pages/danmaku_block/view.dart +++ b/lib/pages/danmaku_block/view.dart @@ -70,7 +70,6 @@ class _DanmakuBlockPageState extends State { TextField( controller: textController, autofocus: true, - //decoration: InputDecoration(hintText: hintText), ) ]), actions: [ diff --git a/lib/pages/dynamics/controller.dart b/lib/pages/dynamics/controller.dart index 12dc339cf..5d89c16bc 100644 --- a/lib/pages/dynamics/controller.dart +++ b/lib/pages/dynamics/controller.dart @@ -70,7 +70,6 @@ class DynamicsController extends GetxController Future queryFollowing2() async { if (upData.value.upList != null && upData.value.upList!.length >= allFollowedUpsTotal) { - // SmartDialog.showToast('没有更多了'); return; } var res = await FollowHttp.followings( @@ -187,7 +186,6 @@ class DynamicsController extends GetxController await controller.onRefresh(); } - // 返回顶部并刷新 @override void animateToTop() async { controller.animateToTop(); diff --git a/lib/pages/dynamics/detail/view.dart b/lib/pages/dynamics/detail/view.dart index 5a8d18320..839f63e85 100644 --- a/lib/pages/dynamics/detail/view.dart +++ b/lib/pages/dynamics/detail/view.dart @@ -31,7 +31,6 @@ import '../../../utils/grid.dart'; import '../widgets/dynamic_panel.dart'; class DynamicDetailPage extends StatefulWidget { - // const DynamicDetailPage({super.key}); const DynamicDetailPage({super.key}); @override @@ -43,7 +42,6 @@ class _DynamicDetailPageState extends State late DynamicDetailController _dynamicDetailController; AnimationController? _fabAnimationCtr; final RxBool _visibleTitle = false.obs; - // String? action; // 回复类型 late int replyType; bool _isFabVisible = true; @@ -124,8 +122,6 @@ class _DynamicDetailPageState extends State Map args = Get.arguments; // 楼层 int floor = args['floor']; - // 从action栏点击进入 - // action = args.containsKey('action') ? args['action'] : null; // 评论类型 int commentType = args['item'].basic!['comment_type'] ?? 11; replyType = (commentType == 0) ? 11 : commentType; diff --git a/lib/pages/dynamics/tab/view.dart b/lib/pages/dynamics/tab/view.dart index 629785a1a..402a66489 100644 --- a/lib/pages/dynamics/tab/view.dart +++ b/lib/pages/dynamics/tab/view.dart @@ -144,10 +144,7 @@ class _DynamicsTabPageState sliver: dynamicsWaterfallFlow ? SliverWaterfallFlow.extent( maxCrossAxisExtent: Grid.smallCardWidth * 2, - //cacheExtent: 0.0, crossAxisSpacing: StyleString.cardSpace / 2, - // mainAxisSpacing: StyleString.cardSpace / 2, - lastChildLayoutTypeBuilder: (index) { if (index == loadingState.response!.length - 1) { controller.onLoadMore(); @@ -163,7 +160,6 @@ class _DynamicsTabPageState DynamicPanel( item: i, onRemove: controller.onRemove, - // onSetTop: controller.onSetTop, ), ] else ...[ for (var i in loadingState.response!) @@ -172,7 +168,6 @@ class _DynamicsTabPageState DynamicPanel( item: i, onRemove: controller.onRemove, - // onSetTop: controller.onSetTop, ), ] ], @@ -198,7 +193,6 @@ class _DynamicsTabPageState return DynamicPanel( item: item, onRemove: controller.onRemove, - // onSetTop: controller.onSetTop, ); } return const SizedBox.shrink(); diff --git a/lib/pages/dynamics/widgets/additional_panel.dart b/lib/pages/dynamics/widgets/additional_panel.dart index 9c7147b8c..4a6d9d8c6 100644 --- a/lib/pages/dynamics/widgets/additional_panel.dart +++ b/lib/pages/dynamics/widgets/additional_panel.dart @@ -131,7 +131,6 @@ Widget addWidget(item, context, type, {floor = 1}) { ) ], ), - // TextButton(onPressed: () {}, child: Text('123')) ), ), ) @@ -140,60 +139,6 @@ Widget addWidget(item, context, type, {floor = 1}) { case 'ADDITIONAL_TYPE_GOODS': // 商品 return const SizedBox(); - // return Padding( - // padding: const EdgeInsets.only(top: 6), - // child: InkWell( - // onTap: () {}, - // child: Container( - // padding: - // const EdgeInsets.only(left: 12, top: 8, right: 12, bottom: 8), - // decoration: BoxDecoration( - // color: bgColor, - // borderRadius: const BorderRadius.all(Radius.circular(6)), - // ), - // child: Row( - // children: [ - // NetworkImgLayer( - // width: 75, - // height: 75, - // src: dynamicProperty[type].items.first.cover, - // ), - // const SizedBox(width: 10), - // Expanded( - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Text( - // dynamicProperty[type].items.first.name, - // maxLines: 1, - // overflow: TextOverflow.ellipsis, - // ), - // Text( - // dynamicProperty[type].items.first.brief, - // maxLines: 1, - // style: TextStyle( - // color: Theme.of(context).colorScheme.outline, - // fontSize: Theme.of(context) - // .textTheme - // .labelMedium! - // .fontSize, - // ), - // ), - // const SizedBox(height: 2), - // Text( - // dynamicProperty[type].items.first.price, - // style: TextStyle( - // color: Theme.of(context).colorScheme.primary, - // ), - // ), - // ], - // ), - // ), - // ], - // ), - // ), - // ),); case 'ADDITIONAL_TYPE_MATCH': return const SizedBox(); case 'ADDITIONAL_TYPE_COMMON': diff --git a/lib/pages/dynamics/widgets/author_panel.dart b/lib/pages/dynamics/widgets/author_panel.dart index 40699cf80..639fbf949 100644 --- a/lib/pages/dynamics/widgets/author_panel.dart +++ b/lib/pages/dynamics/widgets/author_panel.dart @@ -94,7 +94,6 @@ class AuthorPanel extends StatelessWidget { children: [ Text( item.modules.moduleAuthor.name, - // semanticsLabel: "UP主:${item.modules.moduleAuthor.name}", style: TextStyle( color: item.modules.moduleAuthor!.vip != null && item.modules.moduleAuthor!.vip['status'] > 0 && @@ -157,20 +156,6 @@ class AuthorPanel extends StatelessWidget { ? Row( mainAxisSize: MainAxisSize.min, children: [ - // GestureDetector( - // onTap: - // item.modules.moduleAuthor.decorate['jump_url'] != null - // ? () { - // Get.toNamed( - // '/webview', - // parameters: { - // 'url': - // '${item.modules.moduleAuthor.decorate['jump_url']}' - // }, - // ); - // } - // : null, - // child: Stack( clipBehavior: Clip.none, alignment: Alignment.centerRight, @@ -210,7 +195,6 @@ class AuthorPanel extends StatelessWidget { ), ], ), - // ), _moreWidget(context), ], ) @@ -294,7 +278,6 @@ class AuthorPanel extends StatelessWidget { } }, minLeadingWidth: 0, - // dense: true, leading: const Icon(Icons.watch_later_outlined, size: 19), title: Text( '稍后再看', diff --git a/lib/pages/dynamics/widgets/content_panel.dart b/lib/pages/dynamics/widgets/content_panel.dart index ef123e4d5..e9a5ae950 100644 --- a/lib/pages/dynamics/widgets/content_panel.dart +++ b/lib/pages/dynamics/widgets/content_panel.dart @@ -66,7 +66,6 @@ Widget content(bool isSave, BuildContext context, item, source, callback) { item.modules.moduleDynamic.major.opus.pics.isNotEmpty) Text.rich( picsNodes(), - // semanticsLabel: '动态图片', ), ], ), diff --git a/lib/pages/dynamics/widgets/dynamic_panel.dart b/lib/pages/dynamics/widgets/dynamic_panel.dart index cf82019f1..84c457184 100644 --- a/lib/pages/dynamics/widgets/dynamic_panel.dart +++ b/lib/pages/dynamics/widgets/dynamic_panel.dart @@ -30,9 +30,6 @@ class DynamicPanel extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - // padding: source == 'detail' - // ? const EdgeInsets.only(bottom: 12) - // : EdgeInsets.zero, decoration: isSave || (source == 'detail' && Get.context!.orientation == Orientation.landscape) @@ -47,11 +44,7 @@ class DynamicPanel extends StatelessWidget { ), child: Material( elevation: 0, - // clipBehavior: Clip.hardEdge, color: Colors.transparent, - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(5), - // ), child: InkWell( onTap: source == 'detail' && [ diff --git a/lib/pages/dynamics/widgets/forward_panel.dart b/lib/pages/dynamics/widgets/forward_panel.dart index 6756f88ae..89ad61651 100644 --- a/lib/pages/dynamics/widgets/forward_panel.dart +++ b/lib/pages/dynamics/widgets/forward_panel.dart @@ -106,22 +106,6 @@ Widget forWard(bool isSave, item, BuildContext context, source, callback, ], ), const SizedBox(height: 2), - - /// fix #话题跟content重复 - // if (item.modules.moduleDynamic.topic != null) ...[ - // Padding( - // padding: floor == 2 - // ? EdgeInsets.zero - // : const EdgeInsets.only(left: 12, right: 12), - // child: GestureDetector( - // child: Text( - // '#${item.modules.moduleDynamic.topic.name}', - // style: authorStyle, - // ), - // ), - // ), - // ], - if (richNodes != null) Text.rich( richNodes, @@ -140,10 +124,7 @@ Widget forWard(bool isSave, item, BuildContext context, source, callback, if (hasPics) ...[ Text.rich( picsNodes(item.modules.moduleDynamic.major.opus.pics, callback), - // semanticsLabel: '动态图片', ), - // if (item.modules.moduleDynamic.additional != null) - // const SizedBox(height: 4), ], const SizedBox(height: 4), ], @@ -206,11 +187,6 @@ Widget forWard(bool isSave, item, BuildContext context, source, callback, : const SizedBox.shrink(), _ => const SizedBox.shrink(), }; - // return Container( - // padding: - // const EdgeInsets.only(left: 10, top: 12, right: 10, bottom: 10), - // color: Theme.of(context).dividerColor.withOpacity(0.08), - // child: articlePanel(item, context, floor: floor)); // 转发 case 'DYNAMIC_TYPE_FORWARD': return InkWell( diff --git a/lib/pages/dynamics/widgets/rich_node_panel.dart b/lib/pages/dynamics/widgets/rich_node_panel.dart index ef6acd2c8..607ff74fe 100644 --- a/lib/pages/dynamics/widgets/rich_node_panel.dart +++ b/lib/pages/dynamics/widgets/rich_node_panel.dart @@ -40,9 +40,6 @@ InlineSpan? richNode(item, BuildContext context) { return null; } else { for (var i in richTextNodes) { - /// fix 渲染专栏时内容会重复 - // if (item.modules.moduleDynamic.major.opus.title == null && - // i.type == 'RICH_TEXT_NODE_TYPE_TEXT') { if (i.type == 'RICH_TEXT_NODE_TYPE_TEXT') { spanChildren.add( TextSpan(text: i.origText, style: const TextStyle(height: 1.65))); @@ -289,121 +286,7 @@ InlineSpan? richNode(item, BuildContext context) { } } - // if (contentType == 'major' && - // item.modules.moduleDynamic.major.opus.pics.isNotEmpty) { - // // 图片可能跟其他widget重复渲染 - // List pics = item.modules.moduleDynamic.major.opus.pics; - // int len = pics.length; - // List picList = []; - - // if (len == 1) { - // OpusPicsModel pictureItem = pics.first; - // picList.add(pictureItem.url!); - // spanChildren.add(const TextSpan(text: '\n')); - // spanChildren.add( - // WidgetSpan( - // child: LayoutBuilder( - // builder: (context, BoxConstraints box) { - // return GestureDetector( - // onTap: () { - // showDialog( - // useSafeArea: false, - // context: context, - // builder: (context) { - // return ImagePreview(initialPage: 0, imgList: picList); - // }, - // ); - // }, - // child: Padding( - // padding: const EdgeInsets.only(top: 4), - // child: NetworkImgLayer( - // src: pictureItem.url, - // width: box.maxWidth / 2, - // height: box.maxWidth * - // 0.5 * - // (pictureItem.height != null && - // pictureItem.width != null - // ? pictureItem.height! / pictureItem.width! - // : 1), - // ), - // ), - // ); - // }, - // ), - // ), - // ); - // } - // if (len > 1) { - // List list = []; - // for (var i = 0; i < len; i++) { - // picList.add(pics[i].url!); - // list.add( - // LayoutBuilder( - // builder: (context, BoxConstraints box) { - // return GestureDetector( - // onTap: () { - // showDialog( - // useSafeArea: false, - // context: context, - // builder: (context) { - // return ImagePreview(initialPage: i, imgList: picList); - // }, - // ); - // }, - // child: NetworkImgLayer( - // src: pics[i].url, - // width: box.maxWidth, - // height: box.maxWidth, - // ), - // ); - // }, - // ), - // ); - // } - // spanChildren.add( - // WidgetSpan( - // child: LayoutBuilder( - // builder: (context, BoxConstraints box) { - // double maxWidth = box.maxWidth; - // double crossCount = len < 3 ? 2 : 3; - // double height = maxWidth / - // crossCount * - // (len % crossCount == 0 - // ? len ~/ crossCount - // : len ~/ crossCount + 1) + - // 6; - // return Container( - // padding: const EdgeInsets.only(top: 6), - // height: height, - // child: GridView.count( - // padding: EdgeInsets.zero, - // physics: const NeverScrollableScrollPhysics(), - // crossAxisCount: crossCount.toInt(), - // mainAxisSpacing: 4.0, - // crossAxisSpacing: 4.0, - // childAspectRatio: 1, - // children: list, - // ), - // ); - // }, - // ), - // ), - // ); - // } - // spanChildren.add( - // WidgetSpan( - // child: NetworkImgLayer( - // src: pics.first.url, - // type: 'emote', - // width: 100, - // height: 200, - // ), - // ), - // ); - // } - return TextSpan( - children: spanChildren, - ); + return TextSpan(children: spanChildren); } } catch (err) { debugPrint('❌rich_node_panel err: $err'); diff --git a/lib/pages/dynamics/widgets/up_panel.dart b/lib/pages/dynamics/widgets/up_panel.dart index 0d376f2dc..41b11396c 100644 --- a/lib/pages/dynamics/widgets/up_panel.dart +++ b/lib/pages/dynamics/widgets/up_panel.dart @@ -109,36 +109,14 @@ class _UpPanelState extends State { feedBack(); if (data.type == 'up') { widget.dynamicsController.currentMid = data.mid; - // dynamicsController.mid.value = data.mid; widget.dynamicsController ..upInfo.value = data ..onSelectUp(data.mid); - // int liveLen = liveList.length; - // int upLen = upList.length; - // double itemWidth = contentWidth + itemPadding.horizontal; - // double screenWidth = MediaQuery.sizeOf(context).width; - // double moveDistance = 0.0; - // if (itemWidth * (upList.length + liveList.length) <= screenWidth) { - // } else if ((upLen - i - 0.5) * itemWidth > screenWidth / 2) { - // moveDistance = - // (i + liveLen + 0.5) * itemWidth + 46 - screenWidth / 2; - // } else { - // moveDistance = (upLen + liveLen) * itemWidth + 46 - screenWidth; - // } + data.hasUpdate = false; - // scrollController.animateTo( - // moveDistance, - // duration: const Duration(milliseconds: 500), - // curve: Curves.easeInOut, - // ); + setState(() {}); } else if (data.type == 'live') { - // LiveItemModel liveItem = LiveItemModel.fromJson({ - // 'title': data.title, - // 'uname': data.uname, - // 'face': data.face, - // 'roomid': data.roomId, - // }); Get.toNamed('/liveRoom?roomid=${data.roomId}'); } }, @@ -224,29 +202,6 @@ class _UpPanelState extends State { } } -// class _SliverHeaderDelegate extends SliverPersistentHeaderDelegate { -// _SliverHeaderDelegate({required this.height, required this.child}); - -// final double height; -// final Widget child; - -// @override -// Widget build( -// BuildContext context, double shrinkOffset, bool overlapsContent) { -// return child; -// } - -// @override -// double get maxExtent => height; - -// @override -// double get minExtent => height; - -// @override -// bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) => -// true; -// } - class UpPanelSkeleton extends StatelessWidget { const UpPanelSkeleton({super.key}); diff --git a/lib/pages/dynamics/widgets/video_panel.dart b/lib/pages/dynamics/widgets/video_panel.dart index a68ccd963..56bbb040c 100644 --- a/lib/pages/dynamics/widgets/video_panel.dart +++ b/lib/pages/dynamics/widgets/video_panel.dart @@ -55,16 +55,12 @@ Widget videoSeasonWidget(source, item, context, type, {floor = 1}) { double width = box.maxWidth; return Stack( children: [ - // Hero( - // tag: content.bvid, - // child: NetworkImgLayer( width: width, height: width / StyleString.aspectRatio, src: content.cover, semanticsLabel: content.title, ), - // ), if (content?.badge?['text'] != null) PBadge( text: content.badge['text'], @@ -161,22 +157,6 @@ Widget videoSeasonWidget(source, item, context, type, {floor = 1}) { ), const SizedBox(height: 6), ], - // const SizedBox(height: 4), - /// fix #话题跟content重复 - // if (item.modules.moduleDynamic.topic != null) ...[ - // Padding( - // padding: floor == 2 - // ? EdgeInsets.zero - // : const EdgeInsets.only(left: 12, right: 12), - // child: GestureDetector( - // child: Text( - // '#${item.modules.moduleDynamic.topic.name}', - // style: authorStyle, - // ), - // ), - // ), - // const SizedBox(height: 6), - // ], if (floor == 2 && item.modules.moduleDynamic.desc != null) ...[ if (richNodes != null) Text.rich(richNodes), const SizedBox(height: 6), diff --git a/lib/pages/fav/video/fav_folder_sort_page.dart b/lib/pages/fav/video/fav_folder_sort_page.dart index 1a996d7d5..26e88d93f 100644 --- a/lib/pages/fav/video/fav_folder_sort_page.dart +++ b/lib/pages/fav/video/fav_folder_sort_page.dart @@ -121,15 +121,18 @@ class _FavFolderSortPageState extends State { (index) { final item = sortList[index]; final key = item.id.toString(); - return FavItem( + return SizedBox( key: Key(key), - heroTag: key, - favFolderItem: item, - onLongPress: index == 0 - ? () { - SmartDialog.showToast('默认收藏夹不支持排序'); - } - : null, + height: 98, + child: FavItem( + heroTag: key, + favFolderItem: item, + onLongPress: index == 0 + ? () { + SmartDialog.showToast('默认收藏夹不支持排序'); + } + : null, + ), ); }, ), diff --git a/lib/pages/fav_detail/controller.dart b/lib/pages/fav_detail/controller.dart index 3447468f4..33668b1d5 100644 --- a/lib/pages/fav_detail/controller.dart +++ b/lib/pages/fav_detail/controller.dart @@ -24,7 +24,6 @@ class FavDetailController @override void onInit() { - // item = Get.arguments; if (Get.parameters.keys.isNotEmpty) { mediaId = int.parse(Get.parameters['mediaId']!); heroTag = Get.parameters['heroTag']!; diff --git a/lib/pages/fav_detail/fav_sort_page.dart b/lib/pages/fav_detail/fav_sort_page.dart index 7d728efd5..feaa9e6cd 100644 --- a/lib/pages/fav_detail/fav_sort_page.dart +++ b/lib/pages/fav_detail/fav_sort_page.dart @@ -1,4 +1,3 @@ -import 'package:PiliPlus/build_config.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/user.dart'; import 'package:PiliPlus/models/user/fav_detail.dart'; @@ -126,20 +125,13 @@ class _FavSortPageState extends State { ), children: sortList .map( - (item) => Stack( + (item) => SizedBox( key: Key(item.id.toString()), - children: [ - FavVideoCardH( - isSort: true, - videoItem: item, - ), - if (BuildConfig.isDebug) - Positioned( - top: 35, - right: 10, - child: Text(item.id.toString()), - ) - ], + height: 98, + child: FavVideoCardH( + isSort: true, + videoItem: item, + ), ), ) .toList(), diff --git a/lib/pages/follow/view.dart b/lib/pages/follow/view.dart index 0883917b8..d94c7d404 100644 --- a/lib/pages/follow/view.dart +++ b/lib/pages/follow/view.dart @@ -6,6 +6,7 @@ import 'widgets/follow_list.dart'; import 'widgets/owner_follow_list.dart'; import 'package:PiliPlus/common/widgets/scroll_physics.dart'; +// TODO: refactor class FollowPage extends StatefulWidget { const FollowPage({super.key}); diff --git a/lib/pages/follow/widgets/follow_list.dart b/lib/pages/follow/widgets/follow_list.dart index 55b652a3e..f73dd6a8d 100644 --- a/lib/pages/follow/widgets/follow_list.dart +++ b/lib/pages/follow/widgets/follow_list.dart @@ -8,6 +8,7 @@ import 'package:PiliPlus/pages/follow/index.dart'; import 'follow_item.dart'; +// TODO: refactor class FollowList extends StatefulWidget { final FollowController ctr; const FollowList({ diff --git a/lib/pages/follow/widgets/owner_follow_list.dart b/lib/pages/follow/widgets/owner_follow_list.dart index 462048c66..cd33a1dc6 100644 --- a/lib/pages/follow/widgets/owner_follow_list.dart +++ b/lib/pages/follow/widgets/owner_follow_list.dart @@ -9,6 +9,7 @@ import 'package:PiliPlus/models/member/tags.dart'; import 'package:PiliPlus/pages/follow/index.dart'; import 'follow_item.dart'; +// TODO: refactor class OwnerFollowList extends StatefulWidget { final FollowController ctr; final MemberTagItemModel? tagItem; diff --git a/lib/pages/home/view.dart b/lib/pages/home/view.dart index 0e40fa44a..5a74f6311 100644 --- a/lib/pages/home/view.dart +++ b/lib/pages/home/view.dart @@ -30,6 +30,7 @@ class _HomePageState extends State Widget build(BuildContext context) { super.build(context); return Scaffold( + resizeToAvoidBottomInset: false, appBar: AppBar(toolbarHeight: 0), body: Column( children: [ diff --git a/lib/pages/hot/controller.dart b/lib/pages/hot/controller.dart index f054616da..4b5c62a9d 100644 --- a/lib/pages/hot/controller.dart +++ b/lib/pages/hot/controller.dart @@ -7,8 +7,6 @@ import 'package:get/get.dart'; class HotController extends CommonListController, HotVideoItemModel> { - // int idx = 0; - late RxBool showHotRcmd = GStorage.showHotRcmd.obs; @override @@ -17,24 +15,10 @@ class HotController queryData(); } - // @override - // Future onRefresh() { - // idx = 0; - // return super.onRefresh(); - // } - @override Future>> customGetData() => VideoHttp.hotVideoList( pn: currentPage, ps: 20, ); - - // @override - // void handleSuccess(List currentList, List dataList) { - // idx = (dataList.last as Card?)?.smallCoverV5.base.idx.toInt() ?? 0; - // } - - // @override - // Future customGetData() => VideoHttp.hotVideoListGrpc(idx: idx); } diff --git a/lib/pages/html/view.dart b/lib/pages/html/view.dart index 0baf5234c..26776a66f 100644 --- a/lib/pages/html/view.dart +++ b/lib/pages/html/view.dart @@ -127,16 +127,6 @@ class _HtmlRenderPageState extends State } void listener() { - // 标题 - // if (scrollController.offset > 55 && !_visibleTitle) { - // _visibleTitle = true; - // titleStreamC.add(true); - // } else if (scrollController.offset <= 55 && _visibleTitle) { - // _visibleTitle = false; - // titleStreamC.add(false); - // } - - // fab按钮 final ScrollDirection direction1 = _htmlRenderCtr.scrollController.positions.first.userScrollDirection; late final ScrollDirection direction2 = diff --git a/lib/pages/live_room/send_dm_panel.dart b/lib/pages/live_room/send_dm_panel.dart index 137dacd8d..e324bf705 100644 --- a/lib/pages/live_room/send_dm_panel.dart +++ b/lib/pages/live_room/send_dm_panel.dart @@ -230,13 +230,6 @@ class _ReplyPageState extends CommonPublishPageState { Get.back(); liveRoomController.savedDanmaku = null; SmartDialog.showToast('发送成功'); - // liveRoomController.plPlayerController.danmakuController?.addDanmaku( - // DanmakuContentItem( - // emoticonUnique ?? message, - // type: DanmakuItemType.scroll, - // selfSend: true, - // ), - // ); } else { SmartDialog.showToast(res['msg']); } diff --git a/lib/pages/live_room/view.dart b/lib/pages/live_room/view.dart index 70c8e8b33..f1a2ff05a 100644 --- a/lib/pages/live_room/view.dart +++ b/lib/pages/live_room/view.dart @@ -126,7 +126,6 @@ class _LiveRoomPageState extends State ScreenBrightness().resetApplicationScreenBrightness(); PlPlayerController.setPlayCallBack(null); _liveRoomController.msgStream?.close(); - // floating?.dispose(); plPlayerController.removeStatusLister(playerListener); plPlayerController.dispose(); super.dispose(); @@ -423,17 +422,14 @@ class _LiveRoomPageState extends State ), ), ), - //刷新 IconButton( tooltip: '刷新', onPressed: () { _futureBuilderFuture = _liveRoomController.queryLiveInfo(); - // videoSourceInit(); }, icon: const Icon(Icons.refresh), ), - //内置浏览器打开 IconButton( tooltip: '浏览器打开', onPressed: () { diff --git a/lib/pages/live_room/widgets/bottom_control.dart b/lib/pages/live_room/widgets/bottom_control.dart index 0c6626b24..5f57920ec 100644 --- a/lib/pages/live_room/widgets/bottom_control.dart +++ b/lib/pages/live_room/widgets/bottom_control.dart @@ -46,38 +46,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget { ), onTap: onRefresh, ), - // // ComBtn( - // icon: const Icon( - // Icons.subtitles_outlined, - // size: 18, - // color: Colors.white, - // ), - // fuc: () => Get.back(), - // ), const Spacer(), - // ComBtn( - // icon: const Icon( - // Icons.hd_outlined, - // size: 18, - // color: Colors.white, - // ), - // fuc: () => {}, - // ), - // const SizedBox(width: 4), - // Obx( - // () => ComBtn( - // icon: Icon( - // widget.liveRoomCtr!.volumeOff.value - // ? Icons.volume_off_outlined - // : Icons.volume_up_outlined, - // size: 18, - // color: Colors.white, - // ), - // fuc: () => {}, - // ), - // ), - // const SizedBox(width: 4), - Obx( () => IconButton( onPressed: () { @@ -175,21 +144,3 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget { ); } } - -// class MSliderTrackShape extends RoundedRectSliderTrackShape { -// @override -// Rect getPreferredRect({ -// required RenderBox parentBox, -// Offset offset = Offset.zero, -// SliderThemeData? sliderTheme, -// bool isEnabled = false, -// bool isDiscrete = false, -// }) { -// const double trackHeight = 3; -// final double trackLeft = offset.dx; -// final double trackTop = -// offset.dy + (parentBox.size.height - trackHeight) / 2 + 4; -// final double trackWidth = parentBox.size.width; -// return Rect.fromLTWH(trackLeft, trackTop, trackWidth, trackHeight); -// } -// } diff --git a/lib/pages/live_room/widgets/chat.dart b/lib/pages/live_room/widgets/chat.dart index 9c426e43c..d31315778 100644 --- a/lib/pages/live_room/widgets/chat.dart +++ b/lib/pages/live_room/widgets/chat.dart @@ -65,7 +65,6 @@ class LiveRoomChat extends StatelessWidget { ); } catch (err) { debugPrint(err.toString()); - // SmartDialog.showToast(err.toString()); } }, ), diff --git a/lib/pages/login/controller.dart b/lib/pages/login/controller.dart index e86265a48..68f207c92 100644 --- a/lib/pages/login/controller.dart +++ b/lib/pages/login/controller.dart @@ -628,11 +628,9 @@ class LoginPageController extends GetxController break; default: SmartDialog.showToast(res['msg']); - // login failed break; } } - // }); } bool isGeeArgumentValid(String? geeGt, String? geeChallenge) { @@ -644,11 +642,7 @@ class LoginPageController extends GetxController Future setAccount(Map tokenInfo, List cookieInfo) async { final account = LoginAccount(BiliCookieJar.fromList(cookieInfo), tokenInfo['access_token'], tokenInfo['refresh_token']); - await Future.wait([ - account.onChange(), - AnonymousAccount().delete() - // .then((_) => Request.buvidActive(AnonymousAccount())) - ]); + await Future.wait([account.onChange(), AnonymousAccount().delete()]); Accounts.accountMode.updateAll((_, a) => a == account ? account : a); if (Accounts.main.isLogin) { SmartDialog.showToast('登录成功'); diff --git a/lib/pages/login/view.dart b/lib/pages/login/view.dart index 6819c5771..2659914d3 100644 --- a/lib/pages/login/view.dart +++ b/lib/pages/login/view.dart @@ -22,7 +22,6 @@ class LoginPage extends StatefulWidget { class _LoginPageState extends State { final LoginPageController _loginPageCtr = Get.put(LoginPageController()); - // late Future> codeFuture; // 二维码生成时间 bool showPassword = false; GlobalKey globalKey = GlobalKey(); @@ -41,7 +40,6 @@ class _LoginPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - // const SizedBox(width: 20), TextButton.icon( onPressed: _loginPageCtr.refreshQRCode, icon: const Icon(Icons.refresh), @@ -64,7 +62,6 @@ class _LoginPageState extends State { Uint8List.fromList(pngBytes), fileName: picName, extension: 'png', - // 保存到 PiliPlus文件夹 androidRelativePath: "Pictures/PiliPlus", skipIfExists: false, ); @@ -108,20 +105,6 @@ class _LoginPageState extends State { ), ), ); - // return QrImageView( - // backgroundColor: Colors.white, - // eyeStyle: QrEyeStyle( - // eyeShape: QrEyeShape.square, - // color: Colors.black87, - // ), - // dataModuleStyle: QrDataModuleStyle( - // dataModuleShape: QrDataModuleShape.square, - // color: Colors.black87, - // ), - // data: _loginPageCtr.codeInfo.value['data']!['url']!, - // size: 200, - // semanticsLabel: '二维码', - // ); }), ), const SizedBox(height: 10), @@ -132,10 +115,6 @@ class _LoginPageState extends State { )), Obx(() => GestureDetector( onTap: () { - //以外部方式打开此链接 - // launchUrlString( - // _loginPageCtr.codeInfo.value['data']?['url'] ?? "", - // mode: LaunchMode.externalApplication); // 复制到剪贴板 Utils.copyText( _loginPageCtr.codeInfo.value['data']?['url'] ?? '', @@ -387,7 +366,6 @@ class _LoginPageState extends State { }); }, value: item, - // height: menuItemHeight, child: Row(children: [ Text(item['cname']), const Spacer(), @@ -400,7 +378,7 @@ class _LoginPageState extends State { ), const SizedBox(width: 6), SizedBox( - height: 24, // 这里设置固定高度 + height: 24, child: VerticalDivider( color: Theme.of(context) .colorScheme diff --git a/lib/pages/main/controller.dart b/lib/pages/main/controller.dart index e8d2d5c9e..0d8a07e39 100644 --- a/lib/pages/main/controller.dart +++ b/lib/pages/main/controller.dart @@ -97,17 +97,24 @@ class MainController extends GetxController { if ((shouldCheckPM.not && res.firstOrNull?['status'] == true) || (shouldCheckPM && res.getOrNull(1)?['status'] == true)) { int index = shouldCheckPM.not ? 0 : 1; - if (msgUnReadTypes.contains(MsgUnReadType.reply)) { - count += (res[index]['data']['reply'] as int?) ?? 0; - } - if (msgUnReadTypes.contains(MsgUnReadType.at)) { - count += (res[index]['data']['at'] as int?) ?? 0; - } - if (msgUnReadTypes.contains(MsgUnReadType.like)) { - count += (res[index]['data']['like'] as int?) ?? 0; - } - if (msgUnReadTypes.contains(MsgUnReadType.sysMsg)) { - count += (res[index]['data']['sys_msg'] as int?) ?? 0; + dynamic data = res[index]['data']; + for (final item in msgUnReadTypes) { + switch (item) { + case MsgUnReadType.pm: + break; + case MsgUnReadType.reply: + count += (data['reply'] as int?) ?? 0; + break; + case MsgUnReadType.at: + count += (data['at'] as int?) ?? 0; + break; + case MsgUnReadType.like: + count += (data['like'] as int?) ?? 0; + break; + case MsgUnReadType.sysMsg: + count += (data['sys_msg'] as int?) ?? 0; + break; + } } } count = count == 0 @@ -176,7 +183,7 @@ class MainController extends GetxController { void setCount([int count = 0]) async { if (dynIndex == -1 || navigationBars[dynIndex]['count'] == count) return; - navigationBars[dynIndex]['count'] = count; // 修改 count 属性为新的值 + navigationBars[dynIndex]['count'] = count; navigationBars.refresh(); } diff --git a/lib/pages/main/view.dart b/lib/pages/main/view.dart index 966ee2c3b..b3276bac4 100644 --- a/lib/pages/main/view.dart +++ b/lib/pages/main/view.dart @@ -36,7 +36,7 @@ class _MainAppState extends State late final _homeController = Get.put(HomeController()); late final _dynamicController = Get.put(DynamicsController()); - late int _lastSelectTime = 0; //上次点击时间 + late int _lastSelectTime = 0; late bool enableMYBar; late bool useSideBar; @@ -192,7 +192,7 @@ class _MainAppState extends State value: SystemUiOverlayStyle( systemNavigationBarColor: Colors.transparent, systemNavigationBarIconBrightness: - Theme.of(context).brightness.reverse, // 设置虚拟按键图标颜色 + Theme.of(context).brightness.reverse, ), child: Scaffold( resizeToAvoidBottomInset: false, @@ -412,11 +412,6 @@ class _MainAppState extends State ? Text(count.toString()) : null, padding: const EdgeInsets.fromLTRB(6, 0, 6, 0), - // isLabelVisible: - // _mainController.dynamicBadgeType != DynamicBadgeMode.hidden && - // count > 0, - // backgroundColor: Theme.of(context).colorScheme.primary, - // textColor: Theme.of(context).colorScheme.onInverseSurface, child: icon, ) : icon; diff --git a/lib/pages/media/controller.dart b/lib/pages/media/controller.dart index 26026c200..a421d2272 100644 --- a/lib/pages/media/controller.dart +++ b/lib/pages/media/controller.dart @@ -34,14 +34,15 @@ class MediaController { 'icon': Icons.create_outlined, 'title': '创作中心', - 'onTap': () => Get.toNamed('/webview', parameters: { - 'url': 'https://member.bilibili.com/platform/home', - 'type': 'url', - 'pageTitle': "创作中心(建议浏览器打开)", - }), + 'onTap': () => Get.toNamed( + '/webview', + parameters: { + 'url': 'https://member.bilibili.com/platform/home', + }, + ), }, ]; - dynamic mid; + int? mid; RxInt count = (-1).obs; @override diff --git a/lib/pages/media/view.dart b/lib/pages/media/view.dart index 6b2f8f34b..b108fbe83 100644 --- a/lib/pages/media/view.dart +++ b/lib/pages/media/view.dart @@ -45,61 +45,58 @@ class _MediaPageState extends CommonPageState appBar: AppBar( toolbarHeight: 30, ), - body: SingleChildScrollView( - physics: const AlwaysScrollableScrollPhysics(), + body: ListView( controller: controller.scrollController, - child: Column( - children: [ - ListTile( - leading: null, - title: Padding( - padding: const EdgeInsets.only(left: 20), - child: Text( - '媒体库', - style: TextStyle( - fontSize: - Theme.of(context).textTheme.titleLarge!.fontSize, - fontWeight: FontWeight.bold, - ), - ), - ), - trailing: IconButton( - tooltip: '设置', - onPressed: () { - Get.toNamed('/setting'); - }, - icon: const Icon( - Icons.settings_outlined, - size: 20, - ), - )), - for (var i in controller.list) ...[ - ListTile( - onTap: () => i['onTap'](), - dense: true, - leading: Padding( - padding: const EdgeInsets.only(left: 15), - child: Icon( - i['icon'], - color: primary, - ), - ), - contentPadding: - const EdgeInsets.only(left: 15, top: 2, bottom: 2), - minLeadingWidth: 0, - title: Text( - i['title'], - style: const TextStyle(fontSize: 15), + physics: const AlwaysScrollableScrollPhysics(), + children: [ + ListTile( + leading: null, + title: Padding( + padding: const EdgeInsets.only(left: 20), + child: Text( + '媒体库', + style: TextStyle( + fontSize: Theme.of(context).textTheme.titleLarge!.fontSize, + fontWeight: FontWeight.bold, ), ), - ], - Obx( - () => controller.loadingState.value is Loading - ? const SizedBox.shrink() - : favFolder(), - ) - ], - ), + ), + trailing: IconButton( + tooltip: '设置', + onPressed: () { + Get.toNamed('/setting'); + }, + icon: const Icon( + Icons.settings_outlined, + size: 20, + ), + ), + ), + for (var item in controller.list) + ListTile( + onTap: item['onTap'], + dense: true, + leading: Padding( + padding: const EdgeInsets.only(left: 15), + child: Icon( + item['icon'], + color: primary, + ), + ), + contentPadding: + const EdgeInsets.only(left: 15, top: 2, bottom: 2), + minLeadingWidth: 0, + title: Text( + item['title'], + style: const TextStyle(fontSize: 15), + ), + ), + Obx( + () => controller.loadingState.value is Loading + ? const SizedBox.shrink() + : favFolder(), + ) + ], ), ); } @@ -118,7 +115,6 @@ class _MediaPageState extends CommonPageState controller.onRefresh(); }); }, - leading: null, dense: true, title: Padding( padding: const EdgeInsets.only(left: 10), @@ -143,11 +139,12 @@ class _MediaPageState extends CommonPageState ), ), WidgetSpan( - child: Icon( - Icons.arrow_forward_ios, - size: 18, - color: Theme.of(context).colorScheme.primary, - )), + child: Icon( + Icons.arrow_forward_ios, + size: 18, + color: Theme.of(context).colorScheme.primary, + ), + ), ], ), ), @@ -156,21 +153,15 @@ class _MediaPageState extends CommonPageState trailing: IconButton( tooltip: '刷新', onPressed: controller.onRefresh, - icon: const Icon( - Icons.refresh, - size: 20, - ), + icon: const Icon(Icons.refresh, size: 20), ), ), - // const SizedBox(height: 10), SizedBox( width: double.infinity, - height: MediaQuery.textScalerOf(context).scale(200), + height: 200, child: Obx(() => _buildBody(controller.loadingState.value)), ), - SizedBox( - height: MediaQuery.paddingOf(context).bottom + 100, - ), + const SizedBox(height: 100), ], ); } @@ -251,7 +242,7 @@ class _MediaPageState extends CommonPageState ), ); } - return const SizedBox(); + return const SizedBox.shrink(); } } @@ -297,9 +288,9 @@ class FavFolderItem extends StatelessWidget { .colorScheme .onInverseSurface .withOpacity(0.4), - offset: const Offset(4, -12), // 阴影与容器的距离 - blurRadius: 0.0, // 高斯的标准偏差与盒子的形状卷积。 - spreadRadius: 0.0, // 在应用模糊之前,框应该膨胀的量。 + offset: const Offset(4, -12), + blurRadius: 0.0, + spreadRadius: 0.0, ), ], ), diff --git a/lib/pages/member/member_page.dart b/lib/pages/member/member_page.dart index dd2154749..81b8602c8 100644 --- a/lib/pages/member/member_page.dart +++ b/lib/pages/member/member_page.dart @@ -128,7 +128,6 @@ class _MemberPageNewState extends State { children: _userController.tab2!.map((item) { return switch (item.param!) { 'home' => MemberHome(heroTag: _heroTag), - // 'dynamic' => MemberDynamic(mid: _mid ?? -1), 'dynamic' => MemberDynamicsPage(mid: _mid), 'contribute' => Obx( () => MemberContribute( diff --git a/lib/pages/member/widget/edit_profile_page.dart b/lib/pages/member/widget/edit_profile_page.dart index 0d1aed821..2e231b745 100644 --- a/lib/pages/member/widget/edit_profile_page.dart +++ b/lib/pages/member/widget/edit_profile_page.dart @@ -189,15 +189,6 @@ class _EditProfilePageState extends State { onTap: () => Utils.copyText(loadingState.response['mid'].toString()), ), - // _divider, - // _item( - // title: '二维码名片', - // widget: Icon( - // Icons.qr_code, - // color: Theme.of(context).colorScheme.outline, - // ), - // onTap: () {}, - // ), _divider1, _item( title: '哔哩哔哩认证', diff --git a/lib/pages/member/widget/user_info_card.dart b/lib/pages/member/widget/user_info_card.dart index e9b64892c..3d00202ed 100644 --- a/lib/pages/member/widget/user_info_card.dart +++ b/lib/pages/member/widget/user_info_card.dart @@ -135,44 +135,19 @@ class UserInfoCard extends StatelessWidget { ), if (card.vip?.vipStatus == 1) ...[ const SizedBox(width: 8), - Image.network( - card.vip!.label!.image!.http2https, + CachedNetworkImage( + imageUrl: Utils.thumbnailImgUrl( + card.vip!.label!.image!.http2https), height: 20, ), ], if (card.nameplate?.image?.isNotEmpty == true) ...[ const SizedBox(width: 8), - Image.network( - card.nameplate!.image!.http2https, + CachedNetworkImage( + imageUrl: Utils.thumbnailImgUrl(card.nameplate!.image!), height: 20, ), ], - // GestureDetector( - // onTap: () { - // Utils.copyText(card.mid.toString()); - // }, - // child: Container( - // padding: - // const EdgeInsets.symmetric(horizontal: 8, vertical: 2.5), - // decoration: BoxDecoration( - // color: Theme.of(context).colorScheme.secondaryContainer, - // borderRadius: const BorderRadius.all(Radius.circular(12)), - // ), - // child: Text( - // 'uid: ${card.mid}', - // style: TextStyle( - // height: 1, - // fontSize: 12, - // color: Theme.of(context).colorScheme.onSecondaryContainer, - // ), - // strutStyle: const StrutStyle( - // height: 1, - // leading: 0, - // fontSize: 12, - // ), - // ), - // ), - // ), ], ), ), diff --git a/lib/pages/member_search/view.dart b/lib/pages/member_search/view.dart index dd25e7c6d..28666e060 100644 --- a/lib/pages/member_search/view.dart +++ b/lib/pages/member_search/view.dart @@ -55,18 +55,22 @@ class _MemberSearchPageState extends State { () => _memberSearchCtr.hasData.value ? Column( children: [ - Obx( - () => TabBar( - controller: _memberSearchCtr.tabController, - tabs: [ - Tab( - text: - '视频 ${_memberSearchCtr.archiveCount.value != -1 ? '${_memberSearchCtr.archiveCount.value}' : ''}'), - Tab( - text: - '动态 ${_memberSearchCtr.dynamicCount.value != -1 ? '${_memberSearchCtr.dynamicCount.value}' : ''}'), - ], - ), + TabBar( + controller: _memberSearchCtr.tabController, + tabs: [ + Obx( + () => Tab( + text: + '视频 ${_memberSearchCtr.archiveCount.value != -1 ? '${_memberSearchCtr.archiveCount.value}' : ''}', + ), + ), + Obx( + () => Tab( + text: + '动态 ${_memberSearchCtr.dynamicCount.value != -1 ? '${_memberSearchCtr.dynamicCount.value}' : ''}', + ), + ), + ], ), Expanded( child: tabBarView( diff --git a/lib/pages/mine/controller.dart b/lib/pages/mine/controller.dart index 2d6d9334f..2d0732a10 100644 --- a/lib/pages/mine/controller.dart +++ b/lib/pages/mine/controller.dart @@ -154,8 +154,6 @@ class MineController extends GetxController { ], ), ), - // duration: const Duration(seconds: 2), - // showCloseIcon: true, ); }, ).then((res) { @@ -200,6 +198,9 @@ class MineController extends GetxController { onChangeTheme() { themeType.value = nextThemeType; + try { + Get.find().themeType.value = themeType.value; + } catch (_) {} setting.put(SettingBoxKey.themeMode, themeType.value.code); Get.changeThemeMode(themeType.value.toThemeMode); } diff --git a/lib/pages/mine/view.dart b/lib/pages/mine/view.dart index fe7563673..c67adcbb4 100644 --- a/lib/pages/mine/view.dart +++ b/lib/pages/mine/view.dart @@ -1,4 +1,3 @@ -import 'package:PiliPlus/utils/storage.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:PiliPlus/common/constants.dart'; @@ -17,7 +16,6 @@ class MinePage extends StatefulWidget { class _MinePageState extends State { final MineController _mineController = Get.put(MineController()) - ..themeType.value = ThemeType.values[GStorage.themeTypeInt] ..queryUserInfo(); Widget get _header => FittedBox( @@ -40,8 +38,7 @@ class _MinePageState extends State { iconSize: 40.0, padding: const EdgeInsets.all(8), style: const ButtonStyle( - tapTargetSize: - MaterialTapTargetSize.shrinkWrap, // the '2023' part + tapTargetSize: MaterialTapTargetSize.shrinkWrap, ), tooltip: "${MineController.anonymity.value ? '退出' : '进入'}无痕模式", onPressed: () { @@ -61,8 +58,7 @@ class _MinePageState extends State { iconSize: 40.0, padding: const EdgeInsets.all(8), style: const ButtonStyle( - tapTargetSize: - MaterialTapTargetSize.shrinkWrap, // the '2023' part + tapTargetSize: MaterialTapTargetSize.shrinkWrap, ), tooltip: '切换至${_mineController.nextThemeType.description}主题', onPressed: _mineController.onChangeTheme, @@ -77,8 +73,7 @@ class _MinePageState extends State { iconSize: 40.0, padding: const EdgeInsets.all(8), style: const ButtonStyle( - tapTargetSize: - MaterialTapTargetSize.shrinkWrap, // the '2023' part + tapTargetSize: MaterialTapTargetSize.shrinkWrap, ), tooltip: '设置', onPressed: () => { diff --git a/lib/pages/msg_feed_top/sys_msg/view.dart b/lib/pages/msg_feed_top/sys_msg/view.dart index 15342166d..cadf80877 100644 --- a/lib/pages/msg_feed_top/sys_msg/view.dart +++ b/lib/pages/msg_feed_top/sys_msg/view.dart @@ -159,7 +159,6 @@ class _SysMsgPageState extends State { } else if (matchStr.startsWith('【')) { try { bool isBV = match[3]?.startsWith('BV') == true; - // validate if (isBV) { IdUtils.bv2av(match[3]!); } else { diff --git a/lib/pages/search/controller.dart b/lib/pages/search/controller.dart index 361d85d56..0638a86cd 100644 --- a/lib/pages/search/controller.dart +++ b/lib/pages/search/controller.dart @@ -9,6 +9,9 @@ import 'package:PiliPlus/utils/storage.dart'; import 'package:get/get_rx/src/rx_workers/utils/debouncer.dart'; class SSearchController extends GetxController { + SSearchController(this.tag); + final String tag; + final searchFocusNode = FocusNode(); final controller = TextEditingController(); @@ -115,6 +118,7 @@ class SSearchController extends GetxController { await Get.toNamed( '/searchResult', parameters: { + 'tag': tag, 'keyword': controller.text, }, arguments: { diff --git a/lib/pages/search/view.dart b/lib/pages/search/view.dart index 95121e573..bfed6180d 100644 --- a/lib/pages/search/view.dart +++ b/lib/pages/search/view.dart @@ -21,7 +21,7 @@ class SearchPage extends StatefulWidget { class _SearchPageState extends State { final _tag = Utils.generateRandomString(6); late final SSearchController _searchController = Get.put( - SSearchController(), + SSearchController(_tag), tag: _tag, ); @@ -67,7 +67,6 @@ class _SearchPageState extends State { controller: _searchController.controller, textInputAction: TextInputAction.search, onChanged: _searchController.onChange, - // textAlignVertical: TextAlignVertical.center, decoration: InputDecoration( hintText: _searchController.hintText, border: InputBorder.none, diff --git a/lib/pages/search_result/view.dart b/lib/pages/search_result/view.dart index a932422e6..413020004 100644 --- a/lib/pages/search_result/view.dart +++ b/lib/pages/search_result/view.dart @@ -24,6 +24,7 @@ class _SearchResultPageState extends State late TabController _tabController; final String _tag = DateTime.now().millisecondsSinceEpoch.toString(); final bool? _isFromSearch = Get.arguments?['fromSearch']; + SSearchController? sSearchController; @override void initState() { @@ -35,21 +36,21 @@ class _SearchResultPageState extends State _tabController = TabController( vsync: this, - initialIndex: Get.arguments?['initIndex'] != null - ? (Get.arguments?['initIndex'] as int) - : 0, + initialIndex: Get.arguments?['initIndex'] ?? 0, length: SearchType.values.length, ); - if (Get.arguments is int) { + if (_isFromSearch == true) { + try { + sSearchController = + Get.find(tag: Get.parameters['tag']); + } catch (_) {} _tabController.addListener(listener); } } void listener() { - if (Get.isRegistered()) { - Get.find().initIndex = _tabController.index; - } + sSearchController?.initIndex = _tabController.index; } @override diff --git a/lib/pages/setting/pages/color_select.dart b/lib/pages/setting/pages/color_select.dart index 779bb7110..67f86266b 100644 --- a/lib/pages/setting/pages/color_select.dart +++ b/lib/pages/setting/pages/color_select.dart @@ -1,6 +1,7 @@ import 'package:PiliPlus/models/common/nav_bar_config.dart'; import 'package:PiliPlus/models/common/theme_type.dart'; import 'package:PiliPlus/pages/home/index.dart'; +import 'package:PiliPlus/pages/mine/controller.dart'; import 'package:PiliPlus/pages/setting/widgets/select_dialog.dart'; import 'package:flex_seed_scheme/flex_seed_scheme.dart'; import 'package:flutter/material.dart'; @@ -67,6 +68,9 @@ class _ColorSelectPageState extends State { }, ); if (result != null) { + try { + Get.find().themeType.value = result; + } catch (_) {} ctr.themeType.value = result; GStorage.setting.put(SettingBoxKey.themeMode, result.index); Get.changeThemeMode(result.toThemeMode); diff --git a/lib/pages/setting/pages/font_size_select.dart b/lib/pages/setting/pages/font_size_select.dart index e7f4139e8..7f8f3ce67 100644 --- a/lib/pages/setting/pages/font_size_select.dart +++ b/lib/pages/setting/pages/font_size_select.dart @@ -12,7 +12,6 @@ class FontSizeSelectPage extends StatefulWidget { class _FontSizeSelectPageState extends State { List list = List.generate(16, (index) => 0.85 + index * 0.05); - //[0.85, 0.9, 0.95, 1.0, 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35]; late double minSize; late double maxSize; late double currentSize; diff --git a/lib/pages/setting/pages/logs.dart b/lib/pages/setting/pages/logs.dart index 5674a47f2..0d3ebb4c7 100644 --- a/lib/pages/setting/pages/logs.dart +++ b/lib/pages/setting/pages/logs.dart @@ -63,7 +63,7 @@ class _LogsPageState extends State { if (l.startsWith("Crash occurred on")) { try { date = DateTime.parse( - l.split("Crash occurred on")[1].trim(), //.split('.')[0], + l.split("Crash occurred on")[1].trim(), ); } catch (e) { debugPrint(e.toString()); @@ -111,7 +111,6 @@ class _LogsPageState extends State { actions: [ PopupMenuButton( onSelected: (String type) { - // 处理菜单项选择的逻辑 switch (type) { case 'copy': copyLogs(); diff --git a/lib/pages/setting/pages/play_speed_set.dart b/lib/pages/setting/pages/play_speed_set.dart index 53cccfa4d..47d439d7a 100644 --- a/lib/pages/setting/pages/play_speed_set.dart +++ b/lib/pages/setting/pages/play_speed_set.dart @@ -82,7 +82,6 @@ class _PlaySpeedPageState extends State { content: Column( mainAxisSize: MainAxisSize.min, children: [ - // const Text('输入你想要的视频倍速,例如:1.0'), const SizedBox(height: 12), TextField( autofocus: true, diff --git a/lib/pages/setting/view.dart b/lib/pages/setting/view.dart index e21dcaed2..3e9b74332 100644 --- a/lib/pages/setting/view.dart +++ b/lib/pages/setting/view.dart @@ -1,5 +1,5 @@ import 'package:PiliPlus/http/login.dart'; -import 'package:PiliPlus/pages/about/index.dart'; +import 'package:PiliPlus/pages/about/view.dart'; import 'package:PiliPlus/pages/login/controller.dart'; import 'package:PiliPlus/pages/setting/extra_setting.dart'; import 'package:PiliPlus/pages/setting/play_setting.dart'; diff --git a/lib/pages/setting/widgets/model.dart b/lib/pages/setting/widgets/model.dart index e52a032cd..1e4a996b3 100644 --- a/lib/pages/setting/widgets/model.dart +++ b/lib/pages/setting/widgets/model.dart @@ -131,10 +131,8 @@ List get styleSettings => [ onChanged: (value) { if (value) { autoScreen(); - // SmartDialog.showToast('已开启横屏适配'); } else { AutoOrientation.portraitUpMode(); - // SmartDialog.showToast('已关闭横屏适配'); } }), SettingsModel( @@ -536,6 +534,9 @@ List get styleSettings => [ }, ); if (result != null) { + try { + Get.find().themeType.value = result; + } catch (_) {} GStorage.setting.put(SettingBoxKey.themeMode, result.index); Get.put(ColorSelectController()).themeType.value = result; Get.changeThemeMode(result.toThemeMode); diff --git a/lib/pages/setting/widgets/switch_item.dart b/lib/pages/setting/widgets/switch_item.dart index 4d7c263d4..e29ef8d73 100644 --- a/lib/pages/setting/widgets/switch_item.dart +++ b/lib/pages/setting/widgets/switch_item.dart @@ -133,7 +133,7 @@ class _SetSwitchItemState extends State { : null, leading: widget.leading, trailing: Transform.scale( - alignment: Alignment.centerRight, // 缩放Switch的大小后保持右侧对齐, 避免右侧空隙过大 + alignment: Alignment.centerRight, scale: 0.8, child: Switch( thumbIcon: @@ -141,7 +141,7 @@ class _SetSwitchItemState extends State { if (states.isNotEmpty && states.first == WidgetState.selected) { return const Icon(Icons.done); } - return null; // All other states will use the default thumbIcon. + return null; }), value: val, onChanged: switchChange, diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index a2353d84a..9112e5937 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -102,7 +102,6 @@ class VideoDetailController extends GetxController Box get setting => GStorage.setting; - // late bool enableCDN; int? cacheVideoQa; late String cacheDecode; late String cacheSecondDecode; @@ -285,14 +284,10 @@ class VideoDetailController extends GetxController } danmakuCid.value = cid.value; - /// if (Platform.isAndroid) { floating = Floating(); } - // CDN优化 - // enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true); - // 预设的解码格式 cacheDecode = setting.get(SettingBoxKey.defaultDecode, defaultValue: VideoDecodeFormats.values.last.code); @@ -1003,7 +998,6 @@ class VideoDetailController extends GetxController } /// 更新画质、音质 - /// TODO 继续进度播放 updatePlayer() { isShowCover.value = false; playedTime = plPlayerController.position.value; @@ -1280,9 +1274,6 @@ class VideoDetailController extends GetxController orElse: () => videosList.first); setVideoHeight(); - // videoUrl = enableCDN - // ? VideoUtils.getCdnUrl(firstVideo) - // : (firstVideo.backupUrl ?? firstVideo.baseUrl!); videoUrl = VideoUtils.getCdnUrl(firstVideo); /// 优先顺序 设置中指定质量 -> 当前可选的最高质量 @@ -1308,9 +1299,6 @@ class VideoDetailController extends GetxController } firstAudio = audiosList.firstWhere((e) => e.id == closestNumber, orElse: () => audiosList.first); - // audioUrl = enableCDN - // ? VideoUtils.getCdnUrl(firstAudio) - // : (firstAudio.backupUrl ?? firstAudio.baseUrl!); audioUrl = VideoUtils.getCdnUrl(firstAudio); if (firstAudio.id != null) { currentAudioQa = AudioQualityCode.fromCode(firstAudio.id!)!; @@ -1470,9 +1458,6 @@ class VideoDetailController extends GetxController Future _querySubtitles() async { var res = await VideoHttp.subtitlesJson(bvid: bvid, cid: cid.value); - // if (!res["status"]) { - // SmartDialog.showToast('查询字幕错误,${res["msg"]}'); - // } if (res['status']) { // interactive video if (graphVersion == null) { diff --git a/lib/pages/video/detail/introduction/controller.dart b/lib/pages/video/detail/introduction/controller.dart index 120835d0a..2837311c7 100644 --- a/lib/pages/video/detail/introduction/controller.dart +++ b/lib/pages/video/detail/introduction/controller.dart @@ -176,11 +176,6 @@ class VideoIntroController extends GetxController { lastPlayCid.value == 0) { lastPlayCid.value = videoDetail.value.pages!.first.cid!; } - // Get.find(tag: heroTag).tabs.value = [ - // '简介', - // '评论 ${result['data']!.stat!.reply}' - // ]; - // 获取到粉丝数再返回 queryUserStat(); } else { SmartDialog.showToast( @@ -274,12 +269,10 @@ class VideoIntroController extends GetxController { return; } if (videoDetail.value.stat?.like == null) { - // not init return; } var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value); if (result['status']) { - // hasLike.value = result["data"] == 1 ? true : false; if (!hasLike.value) { SmartDialog.showToast(result['data']['toast']); hasLike.value = true; @@ -303,7 +296,6 @@ class VideoIntroController extends GetxController { var result = await VideoHttp.dislikeVideo(bvid: bvid, type: !hasDislike.value); if (result['status']) { - // hasLike.value = result["data"] == 1 ? true : false; if (!hasDislike.value) { SmartDialog.showToast('点踩成功'); hasDislike.value = true; @@ -312,7 +304,6 @@ class VideoIntroController extends GetxController { SmartDialog.showToast('取消踩'); hasDislike.value = false; } - // hasDislike.refresh(); } else { SmartDialog.showToast(result['msg']); } @@ -435,8 +426,6 @@ class VideoIntroController extends GetxController { Get.back(); hasFav.value = addMediaIdsNew.isNotEmpty || favIds?.length != delMediaIdsNew.length; - // 重新获取收藏状态 - // await queryHasFavVideo(); SmartDialog.showToast('操作成功'); } else { SmartDialog.showToast(result['msg']); @@ -581,14 +570,6 @@ class VideoIntroController extends GetxController { }, ); } - - // MemberController _ = Get.put(MemberController(mid: mid), - // tag: mid.toString()); - // await _.getInfo(); - // if (context.mounted) await _.actionRelationMod(context); - // followStatus['attribute'] = _.attribute.value; - // followStatus.refresh(); - // Get.delete(tag: mid.toString()); } // 修改分P或番剧分集 @@ -678,10 +659,6 @@ class VideoIntroController extends GetxController { bvid: bvid, cid: lastPlayCid.value, ); - // dynamic result = await GrpcRepo.playerOnline( - // aid: IdUtils.bv2av(bvid), - // cid: lastPlayCid.value, - // ); if (result['status']) { total.value = result['data']; } diff --git a/lib/pages/video/detail/introduction/view.dart b/lib/pages/video/detail/introduction/view.dart index 3a99b4e4a..e9268fd3b 100644 --- a/lib/pages/video/detail/introduction/view.dart +++ b/lib/pages/video/detail/introduction/view.dart @@ -53,7 +53,6 @@ class _VideoIntroPanelState extends State with AutomaticKeepAliveClientMixin { late VideoIntroController videoIntroController; - // 添加页面缓存 @override bool get wantKeepAlive => true; @@ -240,7 +239,6 @@ class _VideoInfoState extends State { return; } feedBack(); - // widget.showIntroDetail(); videoIntroController.expandableCtr?.toggle(); } @@ -255,16 +253,8 @@ class _VideoInfoState extends State { _horizontalMemberPage) { widget.onShowMemberPage(mid); } else { - // memberHeroTag = Utils.makeHeroTag(mid); - // String face = !loadingStatus - // ? videoDetail.owner!.face - // : videoItem['owner'].face; Get.toNamed( '/member?mid=$mid&from_view_aid=${videoDetailCtr.oid.value}', - // arguments: { - // 'face': face, - // 'heroTag': memberHeroTag, - // }, ); } } @@ -272,7 +262,7 @@ class _VideoInfoState extends State { @override Widget build(BuildContext context) { - final ThemeData t = Theme.of(context); + final ThemeData themeData = Theme.of(context); return SliverLayoutBuilder( builder: (BuildContext context, SliverConstraints constraints) { bool isHorizontal = context.orientation == Orientation.landscape && @@ -296,298 +286,271 @@ class _VideoInfoState extends State { onTap: () {}, child: Row( children: [ - Expanded( - child: videoItem['staff'] == null - ? Row( - mainAxisAlignment: MainAxisAlignment.center, + if (videoItem['staff'] == null) ...[ + Expanded( + child: Align( + alignment: Alignment.centerLeft, + child: GestureDetector( + onTap: onPushMember, + behavior: HitTestBehavior.opaque, + child: Row( mainAxisSize: MainAxisSize.min, children: [ - GestureDetector( - onTap: onPushMember, - behavior: HitTestBehavior.opaque, - child: Row( - mainAxisAlignment: - MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, + Obx( + () => Stack( + clipBehavior: Clip.none, children: [ - Obx( - () => Stack( - clipBehavior: Clip.none, - children: [ - NetworkImgLayer( - type: 'avatar', - src: videoIntroController - .userStat + NetworkImgLayer( + type: 'avatar', + src: videoIntroController.userStat + .value['card']?['face'] ?? + '', + width: 35, + height: 35, + fadeInDuration: Duration.zero, + fadeOutDuration: Duration.zero, + ), + if ((videoIntroController.userStat .value['card'] - ?['face'] ?? - '', - width: 35, - height: 35, - fadeInDuration: Duration.zero, - fadeOutDuration: - Duration.zero, + ?['official_verify'] + ?['type'] ?? + -1) != + -1) + Positioned( + right: -2, + bottom: -2, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Theme.of(context) + .colorScheme + .surface, ), - if ((videoIntroController - .userStat - .value['card'] - ?[ - 'official_verify'] - ?['type'] ?? - -1) != - -1) - Positioned( - right: -2, - bottom: -2, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Theme.of(context) - .colorScheme - .surface, - ), - child: Icon( - Icons.offline_bolt, - color: videoIntroController - .userStat - .value['card'] - ?[ - 'official_verify'] - ?['type'] == - 0 - ? Colors.yellow - : Colors - .lightBlueAccent, - size: 14, - ), - ), - ), - ], + child: Icon( + Icons.offline_bolt, + color: videoIntroController + .userStat + .value['card'] + ?[ + 'official_verify'] + ?['type'] == + 0 + ? Colors.yellow + : Colors.lightBlueAccent, + size: 14, + ), + ), ), - ), - const SizedBox(width: 10), - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Obx( - () => Text( - videoIntroController.userStat - .value['card'] - ?['name'] ?? - "", - maxLines: 1, - overflow: - TextOverflow.ellipsis, - style: TextStyle( - fontSize: 13, - color: (videoIntroController - .userStat - .value['card']?['vip'] - ?[ - 'status'] ?? - -1) > - 0 && - videoIntroController - .userStat - .value['card'] - ?[ - 'vip']?['type'] == - 2 - ? context.vipColor - : null, - ), - ), - ), - const SizedBox(height: 0), - Obx( - () => Text( - '${Utils.numFormat(videoIntroController.userStat.value['follower'])}粉丝 ${videoIntroController.userStat.value['archive_count'] != null ? '${Utils.numFormat(videoIntroController.userStat.value['archive_count'])}视频' : ''}', - style: TextStyle( - fontSize: 12, - color: - t.colorScheme.outline, - ), - ), - ), - ], - ), ], ), ), - const Spacer(), - followButton(context, t), - ], - ) - : SelfSizedHorizontalList( - gapSize: 25, - itemCount: videoItem['staff'].length, - childBuilder: (index) => GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - int? ownerMid = !widget.loadingStatus - ? videoDetail.owner?.mid - : videoItem['owner']?.mid; - if (videoItem['staff'][index].mid == - ownerMid && - context.orientation == - Orientation.landscape && - _horizontalMemberPage) { - widget.onShowMemberPage(ownerMid); - } else { - Get.toNamed( - '/member?mid=${videoItem['staff'][index].mid}&from_view_aid=${videoDetailCtr.oid.value}', - // arguments: { - // 'face': - // videoItem['staff'][index].face, - // 'heroTag': Utils.makeHeroTag( - // videoItem['staff'][index].mid), - // }, - ); - } - }, - child: Row( + const SizedBox(width: 10), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - Stack( - clipBehavior: Clip.none, - children: [ - NetworkImgLayer( - type: 'avatar', - src: videoItem['staff'][index] - .face, - width: 35, - height: 35, - fadeInDuration: Duration.zero, - fadeOutDuration: Duration.zero, - ), - if ((videoItem['staff'][index] - .official?['type'] ?? - -1) != - -1) - Positioned( - right: -2, - bottom: -2, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Theme.of(context) - .colorScheme - .surface, - ), - child: Icon( - Icons.offline_bolt, - color: videoItem['staff'] - [index] - .official?[ - 'type'] == - 0 - ? Colors.yellow - : Colors - .lightBlueAccent, - size: 14, - ), - ), - ), - Positioned( - top: 0, - right: -6, - child: Obx(() => videoIntroController - .staffRelations[ - 'status'] == - true && + Obx( + () => Text( + videoIntroController.userStat + .value['card']?['name'] ?? + "", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 13, + color: (videoIntroController.userStat + .value[ + 'card']?['vip'] + ?['status'] ?? + -1) > + 0 && videoIntroController - .staffRelations[ - '${videoItem['staff'][index].mid}'] == - null - ? Material( - color: Colors.transparent, - child: InkWell( - customBorder: - const CircleBorder(), - onTap: () { - RequestUtils - .actionRelationMod( - context: context, - mid: videoItem[ - 'staff'] - [index] - .mid, - isFollow: false, - callback: (val) { - videoIntroController - .staffRelations[ - '${videoItem['staff'][index].mid}'] = true; - }, - ); - }, - child: Ink( - padding: - const EdgeInsets - .all(2), - decoration: - BoxDecoration( - color: Theme.of( - context) - .colorScheme - .secondaryContainer, - shape: - BoxShape.circle, - ), - child: Icon( - MdiIcons.plus, - size: 16, - color: Theme.of( - context) - .colorScheme - .onSecondaryContainer, - ), - ), - ), - ) - : const SizedBox.shrink()), + .userStat + .value['card'] + ?[ + 'vip']?['type'] == + 2 + ? context.vipColor + : null, ), - ], + ), ), - const SizedBox(width: 8), - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - videoItem['staff'][index].name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 13, - color: videoItem['staff'][index] - .vip - .status > - 0 && - videoItem['staff'] - [index] - .vip - .type == - 2 - ? context.vipColor - : null, - ), + const SizedBox(height: 0), + Obx( + () => Text( + '${Utils.numFormat(videoIntroController.userStat.value['follower'])}粉丝 ${videoIntroController.userStat.value['archive_count'] != null ? '${Utils.numFormat(videoIntroController.userStat.value['archive_count'])}视频' : ''}', + style: TextStyle( + fontSize: 12, + color: + themeData.colorScheme.outline, ), - Text( - videoItem['staff'][index].title, - style: TextStyle( - fontSize: 12, - color: Theme.of(context) - .colorScheme - .outline, - ), - ), - ], + ), ), ], ), - ), + ], ), - ), + ), + ), + ), + followButton(context, themeData), + ] else + Expanded( + child: SelfSizedHorizontalList( + gapSize: 25, + itemCount: videoItem['staff'].length, + childBuilder: (index) => GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + int? ownerMid = !widget.loadingStatus + ? videoDetail.owner?.mid + : videoItem['owner']?.mid; + if (videoItem['staff'][index].mid == + ownerMid && + context.orientation == + Orientation.landscape && + _horizontalMemberPage) { + widget.onShowMemberPage(ownerMid); + } else { + Get.toNamed( + '/member?mid=${videoItem['staff'][index].mid}&from_view_aid=${videoDetailCtr.oid.value}', + ); + } + }, + child: Row( + children: [ + Stack( + clipBehavior: Clip.none, + children: [ + NetworkImgLayer( + type: 'avatar', + src: videoItem['staff'][index].face, + width: 35, + height: 35, + fadeInDuration: Duration.zero, + fadeOutDuration: Duration.zero, + ), + if ((videoItem['staff'][index] + .official?['type'] ?? + -1) != + -1) + Positioned( + right: -2, + bottom: -2, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Theme.of(context) + .colorScheme + .surface, + ), + child: Icon( + Icons.offline_bolt, + color: videoItem['staff'][index] + .official?[ + 'type'] == + 0 + ? Colors.yellow + : Colors.lightBlueAccent, + size: 14, + ), + ), + ), + Positioned( + top: 0, + right: -6, + child: Obx(() => videoIntroController + .staffRelations[ + 'status'] == + true && + videoIntroController + .staffRelations[ + '${videoItem['staff'][index].mid}'] == + null + ? Material( + color: Colors.transparent, + child: InkWell( + customBorder: + const CircleBorder(), + onTap: () { + RequestUtils + .actionRelationMod( + context: context, + mid: videoItem['staff'] + [index] + .mid, + isFollow: false, + callback: (val) { + videoIntroController + .staffRelations[ + '${videoItem['staff'][index].mid}'] = true; + }, + ); + }, + child: Ink( + padding: + const EdgeInsets.all( + 2), + decoration: BoxDecoration( + color: Theme.of(context) + .colorScheme + .secondaryContainer, + shape: BoxShape.circle, + ), + child: Icon( + MdiIcons.plus, + size: 16, + color: Theme.of(context) + .colorScheme + .onSecondaryContainer, + ), + ), + ), + ) + : const SizedBox.shrink()), + ), + ], + ), + const SizedBox(width: 8), + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + videoItem['staff'][index].name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 13, + color: videoItem['staff'][index] + .vip + .status > + 0 && + videoItem['staff'][index] + .vip + .type == + 2 + ? context.vipColor + : null, + ), + ), + Text( + videoItem['staff'][index].title, + style: TextStyle( + fontSize: 12, + color: Theme.of(context) + .colorScheme + .outline, + ), + ), + ], + ), + ], + ), + ), + ), + ), if (isHorizontal) ...[ const SizedBox(width: 10), Expanded( @@ -634,7 +597,7 @@ class _VideoInfoState extends State { value: Utils.numFormat(!widget.loadingStatus ? videoDetail.stat?.view ?? '-' : videoItem['stat']?.view ?? '-'), - textColor: t.colorScheme.outline, + textColor: themeData.colorScheme.outline, ), const SizedBox(width: 10), StatDanMu( @@ -643,7 +606,7 @@ class _VideoInfoState extends State { value: Utils.numFormat(!widget.loadingStatus ? videoDetail.stat?.danmaku ?? '-' : videoItem['stat']?.danmu ?? '-'), - textColor: t.colorScheme.outline, + textColor: themeData.colorScheme.outline, ), const SizedBox(width: 10), Text( @@ -654,7 +617,7 @@ class _VideoInfoState extends State { formatType: 'detail'), style: TextStyle( fontSize: 12, - color: t.colorScheme.outline, + color: themeData.colorScheme.outline, ), ), if (MineController.anonymity.value) ...[ @@ -662,7 +625,7 @@ class _VideoInfoState extends State { Icon( MdiIcons.incognito, size: 15, - color: t.colorScheme.outline, + color: themeData.colorScheme.outline, semanticLabel: '无痕', ), ], @@ -673,7 +636,7 @@ class _VideoInfoState extends State { '${videoIntroController.total.value}人在看', style: TextStyle( fontSize: 12, - color: t.colorScheme.outline, + color: themeData.colorScheme.outline, ), ), ), @@ -767,7 +730,6 @@ class _VideoInfoState extends State { SelectableText.rich( style: const TextStyle( height: 1.4, - // fontSize: 13, ), TextSpan( children: [ @@ -829,16 +791,6 @@ class _VideoInfoState extends State { ), ), ), - // 点赞收藏转发 布局样式1 - // SingleChildScrollView( - // padding: const EdgeInsets.only(top: 7, bottom: 7), - // scrollDirection: Axis.horizontal, - // child: actionRow( - // context, - // videoIntroController, - // videoDetailCtr, - // ), - // ), // 点赞收藏转发 布局样式2 if (!isHorizontal) ...[ const SizedBox(height: 8), @@ -917,112 +869,108 @@ class _VideoInfoState extends State { Widget actionGrid( BuildContext context, VideoIntroController videoIntroController) { - return LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { - return Container( - margin: const EdgeInsets.only(top: 1), - height: 48, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Obx( - () => ActionItem( - icon: const Icon(FontAwesomeIcons.thumbsUp), - selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp), - onTap: () => handleState(videoIntroController.actionLikeVideo), - onLongPress: () => - handleState(videoIntroController.actionOneThree), - selectStatus: videoIntroController.hasLike.value, - loadingStatus: widget.loadingStatus, - semanticsLabel: '点赞', - text: !widget.loadingStatus - ? Utils.numFormat(videoDetail.stat!.like!) - : '-', - needAnim: true, - hasTriple: videoIntroController.hasLike.value && - videoIntroController.hasCoin && - videoIntroController.hasFav.value, - callBack: (start) { - if (start) { - HapticFeedback.lightImpact(); - _coinKey.currentState?.controller?.forward(); - _favKey.currentState?.controller?.forward(); - } else { - _coinKey.currentState?.controller?.reverse(); - _favKey.currentState?.controller?.reverse(); - } - }, - ), - ), - Obx( - () => ActionItem( - icon: const Icon(FontAwesomeIcons.thumbsDown), - selectIcon: const Icon(FontAwesomeIcons.solidThumbsDown), - onTap: () => - handleState(videoIntroController.actionDislikeVideo), - selectStatus: videoIntroController.hasDislike.value, - loadingStatus: widget.loadingStatus, - semanticsLabel: '点踩', - text: "点踩", - ), - ), - Obx( - () => ActionItem( - key: _coinKey, - icon: const Icon(FontAwesomeIcons.b), - selectIcon: const Icon(FontAwesomeIcons.b), - onTap: () => handleState(videoIntroController.actionCoinVideo), - selectStatus: videoIntroController.hasCoin, - loadingStatus: widget.loadingStatus, - semanticsLabel: '投币', - text: !widget.loadingStatus - ? Utils.numFormat(videoDetail.stat!.coin!) - : '-', - needAnim: true, - ), - ), - Obx( - () => ActionItem( - key: _favKey, - icon: const Icon(FontAwesomeIcons.star), - selectIcon: const Icon(FontAwesomeIcons.solidStar), - onTap: () => videoIntroController.showFavBottomSheet(context), - onLongPress: () => videoIntroController - .showFavBottomSheet(context, type: 'longPress'), - selectStatus: videoIntroController.hasFav.value, - loadingStatus: widget.loadingStatus, - semanticsLabel: '收藏', - text: !widget.loadingStatus - ? Utils.numFormat(videoDetail.stat!.favorite!) - : '-', - needAnim: true, - ), - ), - Obx( - () => ActionItem( - icon: const Icon(FontAwesomeIcons.clock), - selectIcon: const Icon(FontAwesomeIcons.solidClock), - onTap: () => handleState(videoIntroController.viewLater), - selectStatus: videoIntroController.hasLater.value, - loadingStatus: widget.loadingStatus, - semanticsLabel: '再看', - text: '再看', - ), - ), - ActionItem( - icon: const Icon(FontAwesomeIcons.shareFromSquare), - onTap: () => videoIntroController.actionShareVideo(context), - selectStatus: false, + return Container( + margin: const EdgeInsets.only(top: 1), + height: 48, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Obx( + () => ActionItem( + icon: const Icon(FontAwesomeIcons.thumbsUp), + selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp), + onTap: () => handleState(videoIntroController.actionLikeVideo), + onLongPress: () => + handleState(videoIntroController.actionOneThree), + selectStatus: videoIntroController.hasLike.value, loadingStatus: widget.loadingStatus, - semanticsLabel: '分享', + semanticsLabel: '点赞', text: !widget.loadingStatus - ? Utils.numFormat(videoDetail.stat!.share!) - : '分享', + ? Utils.numFormat(videoDetail.stat!.like!) + : '-', + needAnim: true, + hasTriple: videoIntroController.hasLike.value && + videoIntroController.hasCoin && + videoIntroController.hasFav.value, + callBack: (start) { + if (start) { + HapticFeedback.lightImpact(); + _coinKey.currentState?.controller?.forward(); + _favKey.currentState?.controller?.forward(); + } else { + _coinKey.currentState?.controller?.reverse(); + _favKey.currentState?.controller?.reverse(); + } + }, ), - ], - ), - ); - }); + ), + Obx( + () => ActionItem( + icon: const Icon(FontAwesomeIcons.thumbsDown), + selectIcon: const Icon(FontAwesomeIcons.solidThumbsDown), + onTap: () => handleState(videoIntroController.actionDislikeVideo), + selectStatus: videoIntroController.hasDislike.value, + loadingStatus: widget.loadingStatus, + semanticsLabel: '点踩', + text: "点踩", + ), + ), + Obx( + () => ActionItem( + key: _coinKey, + icon: const Icon(FontAwesomeIcons.b), + selectIcon: const Icon(FontAwesomeIcons.b), + onTap: () => handleState(videoIntroController.actionCoinVideo), + selectStatus: videoIntroController.hasCoin, + loadingStatus: widget.loadingStatus, + semanticsLabel: '投币', + text: !widget.loadingStatus + ? Utils.numFormat(videoDetail.stat!.coin!) + : '-', + needAnim: true, + ), + ), + Obx( + () => ActionItem( + key: _favKey, + icon: const Icon(FontAwesomeIcons.star), + selectIcon: const Icon(FontAwesomeIcons.solidStar), + onTap: () => videoIntroController.showFavBottomSheet(context), + onLongPress: () => videoIntroController + .showFavBottomSheet(context, type: 'longPress'), + selectStatus: videoIntroController.hasFav.value, + loadingStatus: widget.loadingStatus, + semanticsLabel: '收藏', + text: !widget.loadingStatus + ? Utils.numFormat(videoDetail.stat!.favorite!) + : '-', + needAnim: true, + ), + ), + Obx( + () => ActionItem( + icon: const Icon(FontAwesomeIcons.clock), + selectIcon: const Icon(FontAwesomeIcons.solidClock), + onTap: () => handleState(videoIntroController.viewLater), + selectStatus: videoIntroController.hasLater.value, + loadingStatus: widget.loadingStatus, + semanticsLabel: '再看', + text: '再看', + ), + ), + ActionItem( + icon: const Icon(FontAwesomeIcons.shareFromSquare), + onTap: () => videoIntroController.actionShareVideo(context), + selectStatus: false, + loadingStatus: widget.loadingStatus, + semanticsLabel: '分享', + text: !widget.loadingStatus + ? Utils.numFormat(videoDetail.stat!.share!) + : '分享', + ), + ], + ), + ); } Widget actionRow( @@ -1078,14 +1026,12 @@ class _VideoInfoState extends State { ), const SizedBox(width: 8), ActionRowItem( - icon: const Icon(FontAwesomeIcons.share), - onTap: () => videoIntroController.actionShareVideo(context), - selectStatus: false, - loadingStatus: widget.loadingStatus, - // text: !loadingStatus - // ? videoDetail.stat!.share!.toString() - // : '-', - text: '转发'), + icon: const Icon(FontAwesomeIcons.share), + onTap: () => videoIntroController.actionShareVideo(context), + selectStatus: false, + loadingStatus: widget.loadingStatus, + text: '转发', + ), ]); } @@ -1110,7 +1056,6 @@ class _VideoInfoState extends State { String matchStr = match[0]!; if (RegExp(r'^av\d+$', caseSensitive: false).hasMatch(matchStr)) { try { - // validate int aid = int.parse(matchStr.substring(2)); IdUtils.av2bv(aid); spanChildren.add( @@ -1130,7 +1075,6 @@ class _VideoInfoState extends State { } else if (RegExp(r'^bv[a-z\d]{10}$', caseSensitive: false) .hasMatch(matchStr)) { try { - // validate IdUtils.bv2av(matchStr); spanChildren.add( TextSpan( diff --git a/lib/pages/video/detail/introduction/widgets/action_item.dart b/lib/pages/video/detail/introduction/widgets/action_item.dart index 1f7a73950..8f1facf71 100644 --- a/lib/pages/video/detail/introduction/widgets/action_item.dart +++ b/lib/pages/video/detail/introduction/widgets/action_item.dart @@ -150,11 +150,9 @@ class ActionItemState extends State onTapDown: (details) => _isThumbsUp ? _startLongPress() : null, onTapUp: (details) => _isThumbsUp ? _cancelLongPress() : null, onTapCancel: () => _isThumbsUp ? _cancelLongPress(true) : null, - // borderRadius: StyleString.mdRadius, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - // const SizedBox(height: 2), Stack( alignment: Alignment.center, children: [ @@ -231,7 +229,6 @@ class _ArcPainter extends CustomPainter { ); const startAngle = -pi / 2; - // const sweepAngle = -2 * pi; canvas.drawArc(rect, startAngle, sweepAngle, false, paint); } diff --git a/lib/pages/video/detail/introduction/widgets/fav_panel.dart b/lib/pages/video/detail/introduction/widgets/fav_panel.dart index 9e12ad575..4a3627603 100644 --- a/lib/pages/video/detail/introduction/widgets/fav_panel.dart +++ b/lib/pages/video/detail/introduction/widgets/fav_panel.dart @@ -147,7 +147,6 @@ class _FavPanelState extends State { ); } } else { - // 骨架屏 return const Center( child: CircularProgressIndicator(), ); diff --git a/lib/pages/video/detail/introduction/widgets/group_panel.dart b/lib/pages/video/detail/introduction/widgets/group_panel.dart index 448ff4056..bd11a49ab 100644 --- a/lib/pages/video/detail/introduction/widgets/group_panel.dart +++ b/lib/pages/video/detail/introduction/widgets/group_panel.dart @@ -152,7 +152,6 @@ class _GroupPanelState extends State { ); } } else { - // 骨架屏 return const Center( child: CircularProgressIndicator(), ); diff --git a/lib/pages/video/detail/introduction/widgets/page.dart b/lib/pages/video/detail/introduction/widgets/page.dart index 24ab57799..3873e6442 100644 --- a/lib/pages/video/detail/introduction/widgets/page.dart +++ b/lib/pages/video/detail/introduction/widgets/page.dart @@ -67,15 +67,14 @@ class _PagesPanelState extends State { if (!_scrollController.hasClients || pages.isEmpty) { return; } - const double itemWidth = 150; // 每个列表项的宽度 + const double itemWidth = 150; final double targetOffset = (pageIndex * itemWidth - itemWidth / 2).clamp( _scrollController.position.minScrollExtent, _scrollController.position.maxScrollExtent); - // 滑动至目标位置 _scrollController.animateTo( targetOffset, - duration: const Duration(milliseconds: 300), // 滑动动画持续时间 - curve: Curves.easeInOut, // 滑动动画曲线 + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, ); } diff --git a/lib/pages/video/detail/introduction/widgets/season.dart b/lib/pages/video/detail/introduction/widgets/season.dart index 95ae5d603..e15197735 100644 --- a/lib/pages/video/detail/introduction/widgets/season.dart +++ b/lib/pages/video/detail/introduction/widgets/season.dart @@ -61,9 +61,6 @@ class _SeasonPanelState extends State { } /// 取对应 season_id 的 episodes - // episodes = widget.ugcSeason.sections! - // .firstWhere((e) => e.seasonId == widget.ugcSeason.id) - // .episodes; currentIndex.value = episodes.indexWhere( (EpisodeItem e) => e.cid == _videoDetailController.seasonCid); _listener = _videoDetailController.cid.listen((int cid) { @@ -86,17 +83,6 @@ class _SeasonPanelState extends State { super.dispose(); } - // void changeFucCall(item, int i) async { - // await widget.changeFuc!( - // IdUtils.av2bv(item.aid), - // item.cid, - // item.aid, - // ); - // currentIndex = i; - // Get.back(); - // setState(() {}); - // } - @override Widget build(BuildContext context) { if (episodes.isEmpty) { diff --git a/lib/pages/video/detail/reply/view.dart b/lib/pages/video/detail/reply/view.dart index 13de64ba7..ce68bd9cd 100644 --- a/lib/pages/video/detail/reply/view.dart +++ b/lib/pages/video/detail/reply/view.dart @@ -50,7 +50,6 @@ class _VideoReplyPanelState extends State String get heroTag => widget.heroTag; - // 添加页面缓存 @override bool get wantKeepAlive => true; diff --git a/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart b/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart index ed4714433..72b8d756a 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart @@ -65,19 +65,12 @@ class ReplyItemGrpc extends StatelessWidget { return Material( color: Colors.transparent, child: InkWell( - // 点击整个评论区 评论详情/回复 onTap: () { feedBack(); replyReply?.call(replyItem, null); }, onLongPress: () { feedBack(); - // showDialog( - // context: context, - // builder: (context) => AlertDialog( - // content: SelectableText(jsonEncode(replyItem.toProto3Json())), - // ), - // ); showModalBottomSheet( context: context, useSafeArea: true, @@ -118,17 +111,6 @@ class ReplyItemGrpc extends StatelessWidget { Positioned( top: 8, right: 12, - // child: GestureDetector( - // onTap: replyItem.member.garbCardJumpUrl.isNotEmpty - // ? () { - // Get.toNamed( - // 'webview', - // parameters: { - // 'url': replyItem.member.garbCardJumpUrl - // }, - // ); - // } - // : null, child: Stack( alignment: Alignment.centerRight, children: [ @@ -155,7 +137,6 @@ class ReplyItemGrpc extends StatelessWidget { ], ), ), - // ), SizedBox( width: double.infinity, child: _buildAuthorPanel(context), @@ -214,7 +195,6 @@ class ReplyItemGrpc extends StatelessWidget { bottom: 0, child: Container( decoration: BoxDecoration( - //borderRadius: BorderRadius.circular(7), shape: BoxShape.circle, color: Theme.of(context).colorScheme.surface, ), @@ -225,14 +205,12 @@ class ReplyItemGrpc extends StatelessWidget { ), ), ), - //https://www.bilibili.com/blackboard/activity-whPrHsYJ2.html if (replyItem.member.officialVerifyType == 0) Positioned( left: 0, bottom: 0, child: Container( decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(8), shape: BoxShape.circle, color: Theme.of(context).colorScheme.surface, ), @@ -250,7 +228,6 @@ class ReplyItemGrpc extends StatelessWidget { bottom: 0, child: Container( decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(8), shape: BoxShape.circle, color: Theme.of(context).colorScheme.surface, ), @@ -270,8 +247,7 @@ class ReplyItemGrpc extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, - children: [ - /// fix Stack内GestureDetector onTap无效 + children: [ GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { @@ -281,7 +257,7 @@ class ReplyItemGrpc extends StatelessWidget { child: Row( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, - children: [ + children: [ lfAvtar(context), const SizedBox(width: 12), Column( @@ -415,9 +391,8 @@ class ReplyItemGrpc extends StatelessWidget { if (replyLevel != '') buttonAction(context, replyItem.replyControl), // 一楼的评论 if (replyLevel == '1' && - ( //replyItem.replyControl!.isShow! || - replyItem.replies.isNotEmpty || - replyItem.replyControl.subReplyEntryText.isNotEmpty)) ...[ + (replyItem.replies.isNotEmpty || + replyItem.replyControl.subReplyEntryText.isNotEmpty)) ...[ Padding( padding: const EdgeInsets.only(top: 5, bottom: 12), child: replyItemRow( @@ -699,21 +674,14 @@ class ReplyItemGrpc extends StatelessWidget { final textSize = textPainter.size; final double maxHeight = textPainter.preferredLineHeight * 6; var position = textPainter.getPositionForOffset( - Offset( - textSize.width, - maxHeight, // textSize.height, - ), + Offset(textSize.width, maxHeight), ); - // final endOffset = textPainter.getOffsetBefore(position.offset); message = message.substring(0, position.offset); } - // return TextSpan(text: message); - // 投票 if (content.hasVote()) { message.splitMapJoin(RegExp(r"\{vote:\d+?\}"), onMatch: (Match match) { - // String matchStr = match[0]!; spanChildren.add( TextSpan( text: '投票: ${content.vote.title}', @@ -739,12 +707,6 @@ class ReplyItemGrpc extends StatelessWidget { message = message.replaceAll(RegExp(r"\{vote:\d+?\}"), ""); } message = parse(message).body?.text ?? message; - // .replaceAll('&', '&') - // .replaceAll('<', '<') - // .replaceAll('>', '>') - // .replaceAll('"', '"') - // .replaceAll(''', "'") - // .replaceAll(' ', ' '); // 构建正则表达式 final List specialTokens = [ ...content.emote.keys, @@ -770,12 +732,6 @@ class ReplyItemGrpc extends StatelessWidget { spanChildren.add(TextSpan( text: str, )); - // TextSpan( - // - // text: str, - // recognizer: TapGestureRecognizer() - // ..onTap = () => replyReply - // ?.call(replyItem.root == 0 ? replyItem : fReplyItem))))); } late final bool enableWordRe = @@ -883,7 +839,7 @@ class ReplyItemGrpc extends StatelessWidget { if (content.url[matchStr]?.hasPrefixIcon() == true) ...[ WidgetSpan( child: Image.network( - content.url[matchStr]!.prefixIcon.http2https, + Utils.thumbnailImgUrl(content.url[matchStr]!.prefixIcon), height: 19, color: Theme.of(context).colorScheme.primary, ), @@ -998,7 +954,7 @@ class ReplyItemGrpc extends StatelessWidget { if (content.url[patternStr]?.hasPrefixIcon() == true) ...[ WidgetSpan( child: Image.network( - content.url[patternStr]!.prefixIcon.http2https, + Utils.thumbnailImgUrl(content.url[patternStr]!.prefixIcon), height: 19, color: Theme.of(context).colorScheme.primary, ), @@ -1084,7 +1040,6 @@ class ReplyItemGrpc extends StatelessWidget { ), ); } - // spanChildren.add(TextSpan(text: matchMember)); return TextSpan(children: spanChildren); } diff --git a/lib/pages/video/detail/reply/widgets/zan_grpc.dart b/lib/pages/video/detail/reply/widgets/zan_grpc.dart index 7abe7f37d..62eab522d 100644 --- a/lib/pages/video/detail/reply/widgets/zan_grpc.dart +++ b/lib/pages/video/detail/reply/widgets/zan_grpc.dart @@ -23,7 +23,6 @@ class ZanButtonGrpc extends StatefulWidget { class _ZanButtonGrpcState extends State { Future onHateReply() async { feedBack(); - // SmartDialog.showLoading(msg: 'piliplus ...'); final int oid = widget.replyItem.oid.toInt(); final int rpid = widget.replyItem.id.toInt(); // 1 已点赞 2 不喜欢 0 未操作 @@ -46,7 +45,6 @@ class _ZanButtonGrpcState extends State { } widget.replyItem.replyControl.action = $fixnum.Int64(2); } else { - // replyItem.like = replyItem.like! - 1; widget.replyItem.replyControl.action = $fixnum.Int64(0); } setState(() {}); @@ -58,7 +56,6 @@ class _ZanButtonGrpcState extends State { // 评论点赞 Future onLikeReply() async { feedBack(); - // SmartDialog.showLoading(msg: 'piliplus ...'); final int oid = widget.replyItem.oid.toInt(); final int rpid = widget.replyItem.id.toInt(); // 1 已点赞 2 不喜欢 0 未操作 @@ -70,7 +67,6 @@ class _ZanButtonGrpcState extends State { rpid: rpid, action: action, ); - // SmartDialog.dismiss(); if (res['status']) { SmartDialog.showToast( widget.replyItem.replyControl.action.toInt() != 1 ? '点赞成功' : '取消赞'); diff --git a/lib/pages/video/detail/view_v.dart b/lib/pages/video/detail/view_v.dart index bcb6ac99c..2e9c96f30 100644 --- a/lib/pages/video/detail/view_v.dart +++ b/lib/pages/video/detail/view_v.dart @@ -70,14 +70,11 @@ class _VideoDetailPageVState extends State late VideoDetailController videoDetailController; late VideoReplyController _videoReplyController; PlPlayerController? plPlayerController; - late StreamController appbarStream; late VideoIntroController videoIntroController; late BangumiIntroController bangumiIntroController; late final _introController = ScrollController(); late String heroTag; - double doubleOffset = 0; - // 自动退出全屏 late bool autoExitFullscreen; late bool autoPlayEnable; @@ -86,12 +83,7 @@ class _VideoDetailPageVState extends State late bool autoPiP; late bool pipNoDanmaku; late bool removeSafeArea; - // late bool showStatusBarBackgroundColor; - // final Floating floating = Floating(); - // 生命周期监听 - // late final AppLifecycleListener _lifecycleListener; bool isShowing = true; - // StreamSubscription? _bufferedListener; bool get isFullScreen => plPlayerController?.isFullScreen.value ?? false; bool get _shouldShowSeasonPanel => @@ -169,13 +161,8 @@ class _VideoDetailPageVState extends State setting.get(SettingBoxKey.enableVerticalExpand, defaultValue: false); removeSafeArea = setting.get(SettingBoxKey.videoPlayerRemoveSafeArea, defaultValue: false); - // showStatusBarBackgroundColor = setting.get( - // SettingBoxKey.videoPlayerShowStatusBarBackgroundColor, - // defaultValue: false); if (removeSafeArea) hideStatusBar(); videoSourceInit(); - appbarStreamListen(); - // lifecycleListener(); autoScreen(); if (Platform.isAndroid) { Utils.channel.setMethodCallHandler((call) async { @@ -236,11 +223,6 @@ class _VideoDetailPageVState extends State plPlayerController?.play(); } - // 流 - appbarStreamListen() { - appbarStream = StreamController(); - } - // 播放器状态监听 void playerListener(PlayerStatus? status) async { try { @@ -348,27 +330,6 @@ class _VideoDetailPageVState extends State await plPlayerController!.autoEnterFullscreen(); } - // // 生命周期监听 - // void lifecycleListener() { - // _lifecycleListener = AppLifecycleListener( - // onResume: () => _handleTransition('resume'), - // // 后台 - // onInactive: () => _handleTransition('inactive'), - // // 在Android和iOS端不生效 - // onHide: () => _handleTransition('hide'), - // onShow: () => _handleTransition('show'), - // onPause: () => _handleTransition('pause'), - // onRestart: () => _handleTransition('restart'), - // onDetach: () => _handleTransition('detach'), - // // 只作用于桌面端 - // onExitRequested: () { - // ScaffoldMessenger.maybeOf(context) - // ?.showSnackBar(const SnackBar(content: Text("拦截应用退出"))); - // return Future.value(AppExitResponse.cancel); - // }, - // ); - // } - @override void dispose() { _listenerDetail?.cancel(); @@ -396,16 +357,12 @@ class _VideoDetailPageVState extends State } videoDetailController.positionSubscription?.cancel(); videoIntroController.canelTimer(); - appbarStream.close(); - // floating.dispose(); - // videoDetailController.floating?.dispose(); videoIntroController.videoDetail.close(); videoDetailController.cid.close(); if (!horizontalScreen) { AutoOrientation.portraitUpMode(); } shutdownTimerService.handleWaitingFinished(); - // _bufferedListener?.cancel(); if (videoDetailController.plPlayerController.backToHome != true) { videoPlayerServiceHandler.onVideoDetailDispose(heroTag); } @@ -418,16 +375,13 @@ class _VideoDetailPageVState extends State PlPlayerController.updatePlayCount(); } VideoDetailPageV.routeObserver.unsubscribe(this); - // _lifecycleListener.dispose(); showStatusBar(); - // _animationController.dispose(); super.dispose(); } @override // 离开当前页面时 void didPushNext() async { - // _bufferedListener?.cancel(); if (videoDetailController.imageStatus) { return; } @@ -442,11 +396,7 @@ class _VideoDetailPageVState extends State videoDetailController.playerStatus = plPlayerController?.playerStatus.status.value; - /// 开启 - // if (setting.get(SettingBoxKey.enableAutoBrightness, defaultValue: true) - // as bool) { videoDetailController.brightness = plPlayerController?.brightness.value; - // } if (plPlayerController != null) { videoDetailController.makeHeartBeat(); videoDetailController.showVP = plPlayerController!.showVP.value; @@ -491,7 +441,6 @@ class _VideoDetailPageVState extends State } } super.didPopNext(); - // final bool autoplay = autoPlayEnable; videoDetailController.autoPlay.value = !videoDetailController.isShowCover.value; if (videoDetailController.isShowCover.value.not) { @@ -504,29 +453,6 @@ class _VideoDetailPageVState extends State await videoDetailController.playerInit(); } - // if (videoDetailController.playerStatus == PlayerStatus.playing) { - // plPlayerController?.play(); - // } - - /// 未开启自动播放时,未播放跳转下一页返回/播放后跳转下一页返回 - // if (autoplay) { - // // await Future.delayed(const Duration(milliseconds: 300)); - // debugPrint(plPlayerController); - // if (plPlayerController?.buffered.value == Duration.zero) { - // _bufferedListener = plPlayerController?.buffered.listen((p0) { - // debugPrint("p0"); - // debugPrint(p0); - // if (p0 > Duration.zero) { - // _bufferedListener!.cancel(); - // plPlayerController?.seekTo(videoDetailController.defaultST); - // plPlayerController?.play(); - // } - // }); - // } else { - // plPlayerController?.seekTo(videoDetailController.defaultST); - // plPlayerController?.play(); - // } - // } Future.delayed(const Duration(milliseconds: 600), () { AutoOrientation.fullAutoMode(); }); @@ -544,17 +470,6 @@ class _VideoDetailPageVState extends State : Theme.of(context); } - // void _handleTransition(String name) { - // switch (name) { - // case 'inactive': - // if (plPlayerController != null && - // playerStatus == PlayerStatus.playing) { - // autoEnterPip(); - // } - // break; - // } - // } - void enterPip() { if (Get.currentRoute.startsWith('/video') && videoDetailController.floating != null) { @@ -624,8 +539,8 @@ class _VideoDetailPageVState extends State bottom: !removeSafeArea && MediaQuery.of(context).orientation == Orientation.portrait && isFullScreen, - left: false, //!isFullScreen, - right: false, //!isFullScreen, + left: false, + right: false, child: Scaffold( resizeToAvoidBottomInset: false, key: videoDetailController.scaffoldKey, @@ -1181,41 +1096,6 @@ class _VideoDetailPageVState extends State ), ), ), - // Expanded( - // child: TabBarView( - // physics: const ClampingScrollPhysics(), - // controller: videoDetailController.tabCtr, - // children: [ - // CustomScrollView( - // key: const PageStorageKey('简介'), - // slivers: [ - // if (videoDetailController.videoType == - // SearchType.video) ...[ - // const VideoIntroPanel(), - // ] else if (videoDetailController.videoType == - // SearchType.media_bangumi) ...[ - // Obx(() => BangumiIntroPanel( - // cid: videoDetailController.cid.value)), - // ], - // SliverToBoxAdapter( - // child: Divider( - // indent: 12, - // endIndent: 12, - // color: themeData.dividerColor.withOpacity(0.06), - // ), - // ), - // const RelatedVideoPanel(), - // ], - // ), - // Obx( - // () => VideoReplyPanel( - // bvid: videoDetailController.bvid, - // oid: videoDetailController.oid.value, - // ), - // ) - // ], - // ), - // ), ], ); } @@ -1319,7 +1199,7 @@ class _VideoDetailPageVState extends State left: !removeSafeArea && !isFullScreen, right: !removeSafeArea && !isFullScreen, top: !removeSafeArea, - bottom: false, //!removeSafeArea, + bottom: false, child: childWhenDisabledLandscapeInner, ), ), @@ -1339,7 +1219,7 @@ class _VideoDetailPageVState extends State left: !removeSafeArea && !isFullScreen, right: !removeSafeArea && !isFullScreen, top: !removeSafeArea, - bottom: false, //!removeSafeArea, + bottom: false, child: childWhenDisabledAlmostSquareInner, ), ); @@ -1580,53 +1460,14 @@ class _VideoDetailPageVState extends State return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { - // if (!isShowing) { - // return ColoredBox(color: themeData.colorScheme.surface); - // } if (constraints.maxWidth > constraints.maxHeight * 1.25) { -// hideStatusBar(); -// videoDetailController.hiddenReplyReplyPanel(); return autoChoose(childWhenDisabledLandscape); } else if (constraints.maxWidth * (9 / 16) < (2 / 5) * constraints.maxHeight) { - // if (!isFullScreen) { - // if (!removeSafeArea) showStatusBar(); - // } return autoChoose(childWhenDisabled); } else { - // if (!isFullScreen) { - // if (!removeSafeArea) showStatusBar(); - // } return autoChoose(childWhenDisabledAlmostSquare); } - // - // final Orientation orientation = - // constraints.maxWidth > constraints.maxHeight * 1.25 - // ? Orientation.landscape - // : Orientation.portrait; - // if (orientation == Orientation.landscape) { - // if (!horizontalScreen) { - // hideStatusBar(); - // videoDetailController.hiddenReplyReplyPanel(); - // } - // } else { - // if (!isFullScreen) { - // showStatusBar(); - // } - // } - // if (Platform.isAndroid) { - // return PiPSwitcher( - // childWhenDisabled: - // !horizontalScreen || orientation == Orientation.portrait - // ? childWhenDisabled - // : childWhenDisabledLandscape, - // childWhenEnabled: childWhenEnabled, - // floating: floating, - // ); - // } - // return !horizontalScreen || orientation == Orientation.portrait - // ? childWhenDisabled - // : childWhenDisabledLandscape; }, ); } @@ -1671,8 +1512,7 @@ class _VideoDetailPageVState extends State labelStyle: TabBarTheme.of(context).labelStyle?.copyWith(fontSize: 13) ?? const TextStyle(fontSize: 13), - labelPadding: - const EdgeInsets.symmetric(horizontal: 10.0), // 设置每个标签的宽度 + labelPadding: const EdgeInsets.symmetric(horizontal: 10.0), dividerColor: Colors.transparent, dividerHeight: 0, onTap: (value) { @@ -2094,8 +1934,6 @@ class _VideoDetailPageVState extends State bvid: videoDetailController.bvid, aid: IdUtils.bv2av(videoDetailController.bvid), cid: videoDetailController.cid.value, - // count: videoIntroController.videoDetail.value.pages!.length, - // name: videoIntroController.videoDetail.value.pages!, isReversed: videoIntroController.videoDetail.value.isPageReversed, changeFucCall: videoDetailController.videoType == @@ -2146,10 +1984,6 @@ class _VideoDetailPageVState extends State videoIntroController.videoDetail.value.ugcSeason!.id, list: videoIntroController .videoDetail.value.ugcSeason!.sections!, - // count: videoIntroController - // .videoDetail.value.ugcSeason!.epCount!, - // name: - // videoIntroController.videoDetail.value.ugcSeason!.title!, bvid: videoDetailController.bvid, aid: IdUtils.bv2av(videoDetailController.bvid), cid: videoDetailController.seasonCid ?? 0, diff --git a/lib/pages/video/detail/widgets/ai_detail.dart b/lib/pages/video/detail/widgets/ai_detail.dart index 8551f90b2..14a470b4d 100644 --- a/lib/pages/video/detail/widgets/ai_detail.dart +++ b/lib/pages/video/detail/widgets/ai_detail.dart @@ -45,11 +45,9 @@ class _AiDetailState extends CommonCollapseSlidePageState { spanChildren.add( TextSpan( text: match.group(0), - style: TextStyle( - color: Theme.of(context).colorScheme.primary), // 设置颜色为蓝色 + style: TextStyle(color: Theme.of(context).colorScheme.primary), recognizer: TapGestureRecognizer() ..onTap = () { - // 处理点击事件 try { PageUtils.handleWebview(match.group(0)!); } catch (err) { diff --git a/lib/pages/video/detail/widgets/app_bar.dart b/lib/pages/video/detail/widgets/app_bar.dart index 187292397..ca475093d 100644 --- a/lib/pages/video/detail/widgets/app_bar.dart +++ b/lib/pages/video/detail/widgets/app_bar.dart @@ -50,15 +50,6 @@ class ScrollAppBar extends StatelessWidget { ], ), ), - // actions: [ - // IconButton( - // onPressed: () {}, - // icon: const Icon( - // Icons.share, - // size: 20, - // )), - // const SizedBox(width: 12) - // ], ), ), ), diff --git a/lib/pages/video/detail/widgets/expandable_section.dart b/lib/pages/video/detail/widgets/expandable_section.dart deleted file mode 100644 index 8d8b2c422..000000000 --- a/lib/pages/video/detail/widgets/expandable_section.dart +++ /dev/null @@ -1,75 +0,0 @@ -import 'package:flutter/material.dart'; - -class ExpandedSection extends StatefulWidget { - final Widget? child; - final bool expand; - final double begin; - final double end; - - const ExpandedSection({ - super.key, - this.expand = false, - this.child, - this.begin = 0.0, - this.end = 1.0, - }); - - @override - State createState() => _ExpandedSectionState(); -} - -class _ExpandedSectionState extends State - with SingleTickerProviderStateMixin { - late AnimationController expandController; - late Animation animation; - - @override - void initState() { - super.initState(); - prepareAnimations(); - _runExpandCheck(); - } - - void prepareAnimations() { - expandController = AnimationController( - vsync: this, duration: const Duration(milliseconds: 400)); - Animation curve = CurvedAnimation( - parent: expandController, - curve: Curves.fastOutSlowIn, - ); - animation = Tween(begin: widget.begin, end: widget.end).animate(curve); - // animation = CurvedAnimation( - // parent: expandController, - // curve: Curves.fastOutSlowIn, - // ); - } - - void _runExpandCheck() { - if (widget.expand) { - expandController.forward(); - } else { - expandController.reverse(); - } - } - - @override - void didUpdateWidget(ExpandedSection oldWidget) { - super.didUpdateWidget(oldWidget); - _runExpandCheck(); - } - - @override - void dispose() { - expandController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return SizeTransition( - axisAlignment: -1.0, - sizeFactor: animation, - child: widget.child, - ); - } -} diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index d46fe29b0..1b49f9193 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -131,31 +131,6 @@ class HeaderControlState extends State { padding: EdgeInsets.zero, children: [ const SizedBox(height: 14), - // ListTile( - // onTap: () {}, - // dense: true, - // enabled: false, - // leading: - // const Icon(Icons.network_cell_outlined, size: 20), - // title: Text('省流模式', style: titleStyle), - // subtitle: Text('低画质 | 减少视频缓存', style: subTitleStyle), - // trailing: Transform.scale( - // scale: 0.75, - // child: Switch( - // thumbIcon: WidgetStateProperty.resolveWith( - // (Set states) { - // if (states.isNotEmpty && - // states.first == WidgetState.selected) { - // return const Icon(Icons.done); - // } - // return null; // All other states will use the default thumbIcon. - // }), - // value: false, - // onChanged: (value) => {}, - // ), - // ), - // ), - // if (videoDetailCtr.userInfo != null) ListTile( dense: true, onTap: () { @@ -364,7 +339,6 @@ class HeaderControlState extends State { }; }, ), - ListTile( dense: true, onTap: () => {Get.back(), showSetVideoQa()}, @@ -1253,7 +1227,6 @@ class HeaderControlState extends State { min: 0, max: 1, value: subtitleBgOpaticy, - // label: '${(subtitleBgOpaticy * 100).toInt()}%', onChanged: (double val) { updateOpacity(val.toPrecision(2)); }, @@ -1291,13 +1264,6 @@ class HeaderControlState extends State { {'value': 6, 'label': '彩色'}, ]; final List blockTypes = widget.controller.blockTypes; - // 显示区域 - // final List> showAreas = [ - // {'value': 0.25, 'label': '1/4屏'}, - // {'value': 0.5, 'label': '半屏'}, - // {'value': 0.75, 'label': '3/4屏'}, - // {'value': 1.0, 'label': '满屏'}, - // ]; // 智能云屏蔽 int danmakuWeight = widget.controller.danmakuWeight; // 显示区域 @@ -1814,7 +1780,6 @@ class HeaderControlState extends State { min: 1.0, max: 3.0, value: danmakuLineHeight, - // label: '$danmakuLineHeight', onChanged: (double val) { updateLineHeight(val.toPrecision(1)); }, @@ -2052,14 +2017,6 @@ class HeaderControlState extends State { return SizedBox.shrink(); }, ), - // ComBtn( - // icon: const Icon( - // FontAwesomeIcons.cropSimple, - // size: 15, - // color: Colors.white, - // ), - // fuc: () => _.screenshot(), - // ), if (videoDetailCtr.enableSponsorBlock == true) SizedBox( width: 42, @@ -2139,9 +2096,6 @@ class HeaderControlState extends State { !plPlayerController.isOpenDanmu.value; setting.put(SettingBoxKey.enableShowDanmaku, plPlayerController.isOpenDanmu.value); - // SmartDialog.showToast( - // "已${plPlayerController.isOpenDanmu.value ? '开启' : '关闭'}弹幕", - // displayTime: const Duration(seconds: 1)); }, icon: Icon( plPlayerController.isOpenDanmu.value @@ -2171,9 +2125,6 @@ class HeaderControlState extends State { SettingBoxKey.enableBackgroundPlay, defaultValue: true); if (!enableBackgroundPlay && mounted) { - // SmartDialog.showToast('建议开启【后台播放】功能\n避免画中画没有暂停按钮'); - // await Future.delayed(const Duration(seconds: 2), () { - // }); ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Column( @@ -2211,7 +2162,6 @@ class HeaderControlState extends State { plPlayerController .setBackgroundPlay(true); SmartDialog.showToast("请重新载入本页面刷新"); - // Get.back(); }, child: const Text('启用后台音频服务')), const SizedBox(width: 10), @@ -2510,9 +2460,6 @@ class HeaderControlState extends State { @override Widget build(BuildContext context) { - // final bool isLandscape = - // MediaQuery.of(context).orientation == Orientation.landscape; - return plPlayerController.showFSActionItem ? Obx(() => _buildHeader(true)) : _buildHeader(false); diff --git a/lib/pages/webdav/webdav.dart b/lib/pages/webdav/webdav.dart index f1a8e6d7a..cefd038b2 100644 --- a/lib/pages/webdav/webdav.dart +++ b/lib/pages/webdav/webdav.dart @@ -6,9 +6,6 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:webdav_client/webdav_client.dart' as webdav; class WebDav { - late String _webDavUri; - late String _webDavUsername; - late String _webDavPassword; late String _webdavDirectory; webdav.Client? _client; @@ -18,9 +15,9 @@ class WebDav { factory WebDav() => _instance; Future> init() async { - _webDavUri = GStorage.webdavUri; - _webDavUsername = GStorage.webdavUsername; - _webDavPassword = GStorage.webdavPassword; + final webDavUri = GStorage.webdavUri; + final webDavUsername = GStorage.webdavUsername; + final webDavPassword = GStorage.webdavPassword; _webdavDirectory = GStorage.webdavDirectory; if (_webdavDirectory.endsWith('/').not) { _webdavDirectory += '/'; @@ -30,9 +27,9 @@ class WebDav { try { _client = null; final client = webdav.newClient( - _webDavUri, - user: _webDavUsername, - password: _webDavPassword, + webDavUri, + user: webDavUsername, + password: webDavPassword, ) ..setHeaders({'accept-charset': 'utf-8'}) ..setConnectTimeout(4000) diff --git a/lib/pages/whisper_detail/view.dart b/lib/pages/whisper_detail/view.dart index 3b1f9cc4b..567ae8d96 100644 --- a/lib/pages/whisper_detail/view.dart +++ b/lib/pages/whisper_detail/view.dart @@ -160,14 +160,6 @@ class _WhisperDetailPageState style: TextStyle(fontSize: 14), ), ), - // ListTile( - // onTap: () { - // Get.back(); - // }, - // dense: true, - // title: const Text('删除', - // style: TextStyle(fontSize: 14)), - // ), ], ), ); diff --git a/lib/pages/whisper_detail/widget/chat_item.dart b/lib/pages/whisper_detail/widget/chat_item.dart index 92d5d08f5..9c0682da4 100644 --- a/lib/pages/whisper_detail/widget/chat_item.dart +++ b/lib/pages/whisper_detail/widget/chat_item.dart @@ -397,10 +397,9 @@ class ChatItem extends StatelessWidget { onTap: () async { Get.toNamed('/htmlRender', parameters: { 'url': "https://www.bilibili.com/read/cv${content['rid']}/", - // 'url': url.startsWith('//') ? url.split('//').last : url, 'title': content['title'] ?? "", 'id': "cv${content['rid']}", - 'dynamicType': "read" //content['template_id'] ?? "", + 'dynamicType': "read" }); }, child: Column( diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 217a69356..19c969635 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -1074,20 +1074,7 @@ class PlPlayerController { _playbackSpeed.value = speed; } - /// 设置倍速 - // Future togglePlaybackSpeed() async { - // List allowedSpeeds = - // PlaySpeed.values.map((e) => e.value).toList(); - // int index = allowedSpeeds.indexOf(_playbackSpeed.value); - // if (index < allowedSpeeds.length - 1) { - // setPlaybackSpeed(allowedSpeeds[index + 1]); - // } else { - // setPlaybackSpeed(allowedSpeeds[0]); - // } - // } - /// 播放视频 - /// TODO _duration.value丢失 Future play({bool repeat = false, bool hideControls = true}) async { if (_playerCount.value == 0) return; // 播放时自动隐藏控制条 @@ -1104,14 +1091,6 @@ class PlPlayerController { // screenManager.setOverlays(false); audioSessionHandler.setActive(true); - - // Future.delayed(const Duration(milliseconds: 100), () { - // getCurrentVolume(); - // if (setting.get(SettingBoxKey.enableAutoBrightness, defaultValue: true) - // as bool) { - // getCurrentBrightness(); - // } - // }); } /// 暂停播放 @@ -1246,46 +1225,6 @@ class PlPlayerController { _videoFitDesc.value = videoFitType[value.index]['desc']; setVideoFit(); getPlayerKey?.call().currentState?.update(fit: value); - // showDialog( - // context: Get.context!, - // builder: (context) { - // return AlertDialog( - // title: const Text('视频尺寸'), - // content: StatefulBuilder(builder: (context, StateSetter setState) { - // return Wrap( - // alignment: WrapAlignment.start, - // spacing: 8, - // runSpacing: 2, - // children: [ - // for (var i in videoFitType) ...[ - // if (_videoFit.value == i['attr']) ...[ - // FilledButton( - // onPressed: () async { - // _videoFit.value = i['attr']; - // _videoFitDesc.value = i['desc']; - // setVideoFit(); - // Get.back(); - // }, - // child: Text(i['desc']), - // ), - // ] else ...[ - // FilledButton.tonal( - // onPressed: () async { - // _videoFit.value = i['attr']; - // _videoFitDesc.value = i['desc']; - // setVideoFit(); - // Get.back(); - // }, - // child: Text(i['desc']), - // ), - // ] - // ] - // ], - // ); - // }), - // ); - // }, - // ); } /// 缓存fit diff --git a/lib/plugin/pl_player/models/play_speed.dart b/lib/plugin/pl_player/models/play_speed.dart index 66337e833..39a8898b3 100644 --- a/lib/plugin/pl_player/models/play_speed.dart +++ b/lib/plugin/pl_player/models/play_speed.dart @@ -1,5 +1,4 @@ enum PlaySpeed { - // pointTwoFive, pointFive, pointSevenFive, @@ -14,7 +13,6 @@ enum PlaySpeed { extension PlaySpeedExtension on PlaySpeed { static final List _descList = [ - // '0.25', '0.5', '0.75', '正常', @@ -27,7 +25,6 @@ extension PlaySpeedExtension on PlaySpeed { String get description => _descList[index]; static final List _valueList = [ - // 0.25, 0.5, 0.75, 1.0, diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 0f859f274..04e1234eb 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -1645,7 +1645,7 @@ class _PLVideoPlayerState extends State ), ), ), - // + Obx(() { if (plPlayerController.dataStatus.loading || plPlayerController.isBuffering.value) { @@ -1888,14 +1888,6 @@ Widget buildSeekPreviewWidget(PlPlayerController plPlayerController) { padding: EdgeInsets.only(left: left), child: UnconstrainedBox( child: ClipRRect( - // clipBehavior: Clip.antiAlias, - // decoration: BoxDecoration( - // border: Border.all( - // color: Colors.white, - // strokeAlign: BorderSide.strokeAlignOutside, - // ), - // borderRadius: BorderRadius.circular(scale == 2.5 ? 6 : 10), - // ), borderRadius: BorderRadius.circular(scale == 2.5 ? 6 : 10), child: Align( widthFactor: 0.1, diff --git a/lib/plugin/pl_player/widgets/backward_seek.dart b/lib/plugin/pl_player/widgets/backward_seek.dart index 0c288fe7f..6e0983c61 100644 --- a/lib/plugin/pl_player/widgets/backward_seek.dart +++ b/lib/plugin/pl_player/widgets/backward_seek.dart @@ -3,13 +3,11 @@ import 'dart:async'; import 'package:flutter/material.dart'; class BackwardSeekIndicator extends StatefulWidget { - // final void Function(Duration) onChanged; final ValueChanged onSubmitted; final int duration; const BackwardSeekIndicator({ super.key, - // required this.onChanged, required this.onSubmitted, required this.duration, }); @@ -43,8 +41,6 @@ class BackwardSeekIndicatorState extends State { timer = Timer(const Duration(milliseconds: 400), () { widget.onSubmitted.call(duration); }); - // widget.onChanged.call(value); - // 重复点击 快退秒数累加10 setState(() { duration += Duration(seconds: widget.duration); }); diff --git a/lib/plugin/pl_player/widgets/bottom_control.dart b/lib/plugin/pl_player/widgets/bottom_control.dart index ab095e039..cdc34a4bb 100644 --- a/lib/plugin/pl_player/widgets/bottom_control.dart +++ b/lib/plugin/pl_player/widgets/bottom_control.dart @@ -50,9 +50,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget { return Padding( padding: const EdgeInsets.only(left: 10, right: 10, bottom: 7), child: Semantics( - // label: '${(value / max * 100).round()}%', value: '${(value / max * 100).round()}%', - // enabled: false, child: Stack( clipBehavior: Clip.none, alignment: Alignment.bottomCenter, diff --git a/lib/plugin/pl_player/widgets/forward_seek.dart b/lib/plugin/pl_player/widgets/forward_seek.dart index 156f4e340..10d54a8b5 100644 --- a/lib/plugin/pl_player/widgets/forward_seek.dart +++ b/lib/plugin/pl_player/widgets/forward_seek.dart @@ -3,13 +3,11 @@ import 'dart:async'; import 'package:flutter/material.dart'; class ForwardSeekIndicator extends StatefulWidget { - // final void Function(Duration) onChanged; final ValueChanged onSubmitted; final int duration; const ForwardSeekIndicator({ super.key, - // required this.onChanged, required this.onSubmitted, required this.duration, }); @@ -43,8 +41,6 @@ class ForwardSeekIndicatorState extends State { timer = Timer(const Duration(milliseconds: 400), () { widget.onSubmitted.call(duration); }); - // widget.onChanged.call(value); - // 重复点击 快进秒数累加10 setState(() { duration += Duration(seconds: widget.duration); }); diff --git a/lib/plugin/pl_player/widgets/play_pause_btn.dart b/lib/plugin/pl_player/widgets/play_pause_btn.dart index 3ec37c1f5..2e2a8f120 100644 --- a/lib/plugin/pl_player/widgets/play_pause_btn.dart +++ b/lib/plugin/pl_player/widgets/play_pause_btn.dart @@ -77,8 +77,6 @@ class PlayOrPauseButtonState extends State player.playOrPause(); } }, - // iconSize: widget.iconSize ?? _theme(context).buttonBarButtonSize, - // color: widget.iconColor ?? _theme(context).buttonBarButtonColor, child: Center( child: AnimatedIcon( semanticLabel: @@ -89,8 +87,6 @@ class PlayOrPauseButtonState extends State icon: AnimatedIcons.play_pause, color: Colors.white, size: 20, - // size: widget.iconSize ?? _theme(context).buttonBarButtonSize, - // color: widget.iconColor ?? _theme(context).buttonBarButtonColor, ), ), ), diff --git a/lib/router/app_pages.dart b/lib/router/app_pages.dart index 2d4f5fab9..68c32db43 100644 --- a/lib/router/app_pages.dart +++ b/lib/router/app_pages.dart @@ -1,3 +1,4 @@ +import 'package:PiliPlus/pages/about/view.dart'; import 'package:PiliPlus/pages/fav/view.dart'; import 'package:PiliPlus/pages/fav_search/view.dart'; import 'package:PiliPlus/pages/follow_search/view.dart'; @@ -22,7 +23,6 @@ import 'package:PiliPlus/pages/msg_feed_top/reply_me/view.dart'; import 'package:PiliPlus/pages/msg_feed_top/like_me/view.dart'; import 'package:PiliPlus/pages/setting/pages/logs.dart'; -import '../pages/about/index.dart'; import '../pages/blacklist/view.dart'; import '../pages/danmaku_block/view.dart'; import '../pages/dynamics/detail/index.dart'; @@ -100,9 +100,6 @@ class Routes { // 用户中心 CustomGetPage(name: '/member', page: () => const MemberPageNew()), CustomGetPage(name: '/memberSearch', page: () => const MemberSearchPage()), - // 二级回复 - // CustomGetPage( - // name: '/replyReply', page: () => const VideoReplyReplyPanel()), // 推荐流设置 CustomGetPage( name: '/recommendSetting', page: () => const RecommendSetting()), @@ -157,10 +154,6 @@ class Routes { // 用户动态 CustomGetPage( name: '/memberDynamics', page: () => const MemberDynamicsPage()), - // 用户最近投币 - // CustomGetPage(name: '/memberCoin', page: () => const MemberCoinPage()), - // 用户最近喜欢 - // CustomGetPage(name: '/memberLike', page: () => const MemberLikePage()), // 日志 CustomGetPage(name: '/logs', page: () => const LogsPage()), // 订阅 diff --git a/lib/utils/app_scheme.dart b/lib/utils/app_scheme.dart index 13eab0ef5..14f437ca6 100644 --- a/lib/utils/app_scheme.dart +++ b/lib/utils/app_scheme.dart @@ -595,23 +595,6 @@ class PiliScheme { } launchURL(); return false; - // case 'opus': - // String? id = uriDigitRegExp.firstMatch(path)?.group(1); - // if (id != null) { - // PageUtils.toDupNamed( - // '/htmlRender', - // parameters: { - // 'url': 'https://www.bilibili.com/opus/$id', - // 'title': '', - // 'id': id, - // 'dynamicType': 'opus' - // }, - // off: off, - // ); - // return true; - // } - // launchURL(); - // return false; case 'dynamic' || 'opus': bool hasMatch = await _onPushDynDetail(path, off); if (hasMatch.not) { diff --git a/lib/utils/cache_manage.dart b/lib/utils/cache_manage.dart index 1c1d67c7a..75c932dbf 100644 --- a/lib/utils/cache_manage.dart +++ b/lib/utils/cache_manage.dart @@ -1,9 +1,6 @@ import 'dart:async'; import 'dart:io'; -import 'package:flutter/material.dart'; import 'package:path_provider/path_provider.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; class CacheManage { CacheManage._internal(); @@ -76,45 +73,6 @@ class CacheManage { return size + unitArr[index]; } - // 清除缓存 - Future clearCacheAll(BuildContext context) async { - await showDialog( - context: context, - builder: (context) { - return AlertDialog( - title: const Text('提示'), - content: const Text('该操作将清除图片及网络请求缓存数据,确认清除?'), - actions: [ - TextButton( - onPressed: () => Get.back(), - child: Text( - '取消', - style: TextStyle(color: Theme.of(context).colorScheme.outline), - ), - ), - TextButton( - onPressed: () async { - SmartDialog.showLoading(msg: '正在清除...'); - try { - // 清除缓存 图片缓存 - await clearLibraryCache(); - SmartDialog.dismiss().then((res) { - SmartDialog.showToast('清除成功'); - }); - } catch (err) { - SmartDialog.dismiss(); - SmartDialog.showToast(err.toString()); - } - Get.back(); - }, - child: const Text('确认'), - ) - ], - ); - }, - ); - } - /// 清除 Documents 目录下的 DioCache.db Future clearApplicationCache() async { Directory directory = await getApplicationDocumentsDirectory(); diff --git a/lib/utils/download.dart b/lib/utils/download.dart index 5b458e5cd..aee36b588 100644 --- a/lib/utils/download.dart +++ b/lib/utils/download.dart @@ -79,24 +79,6 @@ class DownloadUtils { PermissionStatus status = await Permission.photos.status; if (status == PermissionStatus.denied || status == PermissionStatus.permanentlyDenied) { - // SmartDialog.show( - // useSystem: true, - // animationType: SmartAnimationType.centerFade_otherSlide, - // builder: (BuildContext context) { - // return AlertDialog( - // title: const Text('提示'), - // content: const Text('相册权限未授权'), - // actions: [ - // TextButton( - // onPressed: () async { - // openAppSettings(); - // }, - // child: const Text('去授权'), - // ) - // ], - // ); - // }, - // ); return false; } else { return true; diff --git a/lib/utils/em.dart b/lib/utils/em.dart index 0ffd9952c..6544159da 100644 --- a/lib/utils/em.dart +++ b/lib/utils/em.dart @@ -30,15 +30,5 @@ class Em { static String decodeHtmlEntities(String title) { return parse(title).body?.text ?? title; - // return title - // .replaceAll('<', '<') - // .replaceAll('>', '>') - // .replaceAll('"', '"') - // .replaceAll(''', "'") - // .replaceAll('"', '"') - // .replaceAll(''', "'") - // .replaceAll(' ', " ") - // .replaceAll('&', "&") - // .replaceAll(''', "'"); } } diff --git a/lib/utils/page_utils.dart b/lib/utils/page_utils.dart index fda9be077..557746934 100644 --- a/lib/utils/page_utils.dart +++ b/lib/utils/page_utils.dart @@ -160,8 +160,7 @@ class PageUtils { contentPadding: const EdgeInsets.only(), title: const Text("额外等待视频播放完毕", style: titleStyle), trailing: Transform.scale( - alignment: Alignment - .centerRight, // 缩放Switch的大小后保持右侧对齐, 避免右侧空隙过大 + alignment: Alignment.centerRight, scale: 0.8, child: Switch( thumbIcon: WidgetStateProperty.resolveWith( @@ -189,18 +188,15 @@ class PageUtils { onTap: () { shutdownTimerService.exitApp = false; setState(() {}); - // Get.back(); }, text: " 暂停视频 ", selectStatus: !shutdownTimerService.exitApp, ), const Spacer(), - // const SizedBox(width: 10), ActionRowLineItem( onTap: () { shutdownTimerService.exitApp = true; setState(() {}); - // Get.back(); }, text: " 退出APP ", selectStatus: shutdownTimerService.exitApp, diff --git a/lib/utils/recommend_filter.dart b/lib/utils/recommend_filter.dart index 5cd541ba4..336c18a8c 100644 --- a/lib/utils/recommend_filter.dart +++ b/lib/utils/recommend_filter.dart @@ -4,7 +4,6 @@ import 'package:hive/hive.dart'; import 'storage.dart'; class RecommendFilter { - // static late int filterUnfollowedRatio; static late int minDurationForRcmd; static late int minPlayForRcmd; static late int minLikeRatioForRecommend; @@ -20,8 +19,6 @@ class RecommendFilter { static Box get setting => GStorage.setting; static void update() { - // filterUnfollowedRatio = - // setting.get(SettingBoxKey.filterUnfollowedRatio, defaultValue: 0); minDurationForRcmd = setting.get(SettingBoxKey.minDurationForRcmd, defaultValue: 0); minPlayForRcmd = setting.get(SettingBoxKey.minPlayForRcmd, defaultValue: 0); diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 1f186b1ed..bb51dd201 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -44,10 +44,6 @@ class GStorage { static late final Box setting; static late final Box video; - // static bool get isLogin => userInfo.get('userInfoCache') != null; - - // static get ownerMid => userInfo.get('userInfoCache')?.mid; - static List get speedList => List.from( video.get( VideoBoxKey.speedsList, @@ -642,7 +638,6 @@ class SettingBoxKey { // ignore: constant_identifier_names CDNService = 'CDNService', disableAudioCDN = 'disableAudioCDN', - // enableCDN = 'enableCDN', autoPiP = 'autoPiP', pipNoDanmaku = 'pipNoDanmaku', enableAutoLongPressSpeed = 'enableAutoLongPressSpeed', @@ -669,7 +664,6 @@ class SettingBoxKey { minLikeRatioForRecommend = 'minLikeRatioForRecommend', exemptFilterForFollowed = 'exemptFilterForFollowed', banWordForRecommend = 'banWordForRecommend', - //filterUnfollowedRatio = 'filterUnfollowedRatio', applyFilterToRelatedVideos = 'applyFilterToRelatedVideos', /// 其他 @@ -806,8 +800,6 @@ class SettingBoxKey { displayMode = 'displayMode', smallCardWidth = 'smallCardWidth', videoPlayerRemoveSafeArea = 'videoPlayerRemoveSafeArea', // 视频播放器移除安全边距 - // videoPlayerShowStatusBarBackgroundColor = - // 'videoPlayerShowStatusBarBackgroundColor', // 播放页状态栏显示为背景色 dynamicsWaterfallFlow = 'dynamicsWaterfallFlow', // 动态瀑布流 upPanelPosition = 'upPanelPosition', // up主面板位置 dynamicsShowAllFollowedUp = 'dynamicsShowAllFollowedUp', // 动态显示全部关注up @@ -818,7 +810,6 @@ class SettingBoxKey { tabbarSort = 'tabbarSort', // 首页tabbar dynamicBadgeMode = 'dynamicBadgeMode', msgBadgeMode = 'msgBadgeMode', - // msgUnReadType = 'msgUnReadType', msgUnReadTypeV2 = 'msgUnReadTypeV2', hiddenSettingUnlocked = 'hiddenSettingUnlocked', enableGradientBg = 'enableGradientBg', diff --git a/lib/utils/theme_utils.dart b/lib/utils/theme_utils.dart index b4f28c76c..fb2de4d94 100644 --- a/lib/utils/theme_utils.dart +++ b/lib/utils/theme_utils.dart @@ -81,9 +81,6 @@ class ThemeUtils { : null, shadowColor: Colors.transparent, ), - // dialogTheme: DialogTheme( - // surfaceTintColor: isDark ? colorScheme.onSurfaceVariant : null, - // ), progressIndicatorTheme: ProgressIndicatorThemeData( refreshBackgroundColor: colorScheme.onSecondary, ), diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 098f60f92..93bc15739 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -147,14 +147,6 @@ class Utils { return base64Encoded; } - // static String genRandomString(int length) { - // const characters = '0123456789abcdefghijklmnopqrstuvwxyz'; - // Random random = Random(); - // return List.generate( - // length, (index) => characters[random.nextInt(characters.length)]) - // .join(); - // } - static String genTraceId() { String randomId = generateRandomString(32);