Compare commits

..

43 Commits

Author SHA1 Message Date
67c9ff699c feat: sentry 异常捕获 2024-03-23 14:15:51 +08:00
74f31a818c Merge branch 'main' into feature-sentry 2024-03-23 00:41:12 +08:00
c216c9bd65 mod: tabbar样式&增加评论数 2024-03-21 23:51:43 +08:00
3701fdef97 Merge branch 'fix-scrollSetVolume' 2024-03-21 23:40:55 +08:00
59641f0216 Merge branch 'fix' 2024-03-21 23:40:30 +08:00
4dbcd2e0ec fix: 尝试修复音量调节抖动 issues #647 #498 #104 #198 2024-03-21 23:39:56 +08:00
6d276fce4c fix: 媒体库无法滑动 2024-03-21 00:03:20 +08:00
710361caea fix: 历史记录相关错误 2024-03-20 23:21:41 +08:00
00b81b194f Merge branch 'fix-issues#620' 2024-03-20 00:13:51 +08:00
734db176bf Merge branch 'main' into fix 2024-03-20 00:08:37 +08:00
64292d523f fix: player fit rebuild 2024-03-18 22:13:15 +08:00
af96d16062 feat: 电池优化 2024-03-17 14:45:40 +08:00
12c299685b Merge branch 'feature-removeLockIcon' 2024-03-17 14:35:14 +08:00
1182a58cb4 Merge branch 'fix' 2024-03-17 14:30:26 +08:00
e04a7e5702 fix: 图片保存命名、质量、权限问题 2024-03-17 14:29:39 +08:00
e9dc6f7fdb Merge branch 'main' into fix 2024-03-17 01:13:54 +08:00
25d1ccc87a Merge branch 'feature-liveRoomRender' 2024-03-17 00:38:19 +08:00
33d28f51d1 feat: 未登录状态切换直播画质提示 2024-03-17 00:36:00 +08:00
a37f3b8b5b Merge branch 'main' into feature-liveRoomRender 2024-03-16 23:35:18 +08:00
a57f5e8b2f Merge branch 'main' of github.com:guozhigq/pilipala 2024-03-16 23:12:52 +08:00
beb640ac83 Merge branch 'fix-bangumi' 2024-03-16 23:12:31 +08:00
1b54f07bc3 merge main 2024-03-16 23:11:47 +08:00
fca0588377 Merge pull request #628 from guozhigq/feature-customBottomControl
Feature custom bottom control
2024-03-16 23:08:22 +08:00
4865948609 Merge branch 'fix-whisperRenderError' 2024-03-16 23:07:01 +08:00
09eb180fc7 Merge branch 'main' of github.com:guozhigq/pilipala 2024-03-16 23:06:18 +08:00
3fab47780b Merge pull request #635 from guozhigq/feature-videoDetailCodeCleanUp
feat: 视频番剧详情页代码整理
2024-03-16 23:05:58 +08:00
453cbd7b1c Merge branch 'main' of github.com:guozhigq/pilipala 2024-03-16 23:03:09 +08:00
0bf2326c73 Merge branch 'feature-updateVideoDetailStructure' 2024-03-16 23:02:43 +08:00
2985c624ab mod: stream close 2024-03-16 23:02:21 +08:00
32cbc2759e Merge branch 'main' into feature-updateVideoDetailStructure 2024-03-16 22:52:15 +08:00
13c77957fe fix: 番剧badge 2024-03-16 22:48:47 +08:00
f382c8f377 Merge pull request #632 from kalac2232/main
feature: 动态页跳转登录
2024-03-16 21:56:18 +08:00
491bc87251 fix: 私信列表渲染异常 issues #295 2024-03-15 23:26:43 +08:00
b13d7b475b feat: 非全屏状态下隐藏锁定按钮 2024-03-14 23:49:36 +08:00
5e8d9b524b Merge branch 'fix-favoritesCalc' 2024-03-14 23:31:00 +08:00
357133fa97 fix:去除无用的setState 2024-03-14 10:00:32 +08:00
da2bbeedff mod: 默认直播画质设置 2024-03-13 23:12:34 +08:00
bc9ea43cd2 feat: 视频番剧详情页代码整理 2024-03-12 23:45:22 +08:00
882957e2f8 feature:动态页的错误按钮在未登录状态下的按钮为直接跳转登录页 2024-03-12 14:34:32 +08:00
98aaca286b feat: 直播画质切换 2024-03-11 00:02:11 +08:00
6fdfcb888d feat: 播放器底部控制栏自定义 2024-03-10 19:41:23 +08:00
f41bb02bae fix: 合集最后一p不显示 issues #620 2024-03-08 23:05:09 +08:00
105a29f311 feat: disable Battery Optimization 2024-03-08 22:56:16 +08:00
34 changed files with 1202 additions and 1048 deletions

View File

@ -45,6 +45,13 @@ PODS:
- Flutter - Flutter
- screen_brightness_ios (0.1.0): - screen_brightness_ios (0.1.0):
- Flutter - Flutter
- Sentry/HybridSDK (8.19.0):
- SentryPrivate (= 8.19.0)
- sentry_flutter (0.0.1):
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.19.0)
- SentryPrivate (8.19.0)
- share_plus (0.0.1): - share_plus (0.0.1):
- Flutter - Flutter
- sqflite (0.0.3): - sqflite (0.0.3):
@ -86,6 +93,7 @@ DEPENDENCIES:
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- saver_gallery (from `.symlinks/plugins/saver_gallery/ios`) - saver_gallery (from `.symlinks/plugins/saver_gallery/ios`)
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`) - screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`)
- status_bar_control (from `.symlinks/plugins/status_bar_control/ios`) - status_bar_control (from `.symlinks/plugins/status_bar_control/ios`)
@ -101,6 +109,8 @@ SPEC REPOS:
- FMDB - FMDB
- GT3Captcha-iOS - GT3Captcha-iOS
- ReachabilitySwift - ReachabilitySwift
- Sentry
- SentryPrivate
- Toast - Toast
EXTERNAL SOURCES: EXTERNAL SOURCES:
@ -142,6 +152,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/saver_gallery/ios" :path: ".symlinks/plugins/saver_gallery/ios"
screen_brightness_ios: screen_brightness_ios:
:path: ".symlinks/plugins/screen_brightness_ios/ios" :path: ".symlinks/plugins/screen_brightness_ios/ios"
sentry_flutter:
:path: ".symlinks/plugins/sentry_flutter/ios"
share_plus: share_plus:
:path: ".symlinks/plugins/share_plus/ios" :path: ".symlinks/plugins/share_plus/ios"
sqflite: sqflite:
@ -184,6 +196,9 @@ SPEC CHECKSUMS:
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78 saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625 screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
Sentry: 1ebcaef678a27c8ac515f974cb5425dd1bbdec2f
sentry_flutter: ecdfbedee55337205561cfa782ee02d31ec83e1f
SentryPrivate: 765c9b4ebe9ac1a5fcdc067c5a1cfbf3f10e1677
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5 share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
status_bar_control: 7c84146799e6a076315cc1550f78ef53aae3e446 status_bar_control: 7c84146799e6a076315cc1550f78ef53aae3e446

View File

@ -45,10 +45,14 @@ class ApiInterceptor extends Interceptor {
void onError(DioException err, ErrorInterceptorHandler handler) async { void onError(DioException err, ErrorInterceptorHandler handler) async {
// 处理网络请求错误 // 处理网络请求错误
// handler.next(err); // handler.next(err);
String url = err.requestOptions.uri.toString();
print('🌹🌹ApiInterceptor: $url');
if (!url.contains('heartBeat')) {
SmartDialog.showToast( SmartDialog.showToast(
await dioError(err), await dioError(err),
displayType: SmartToastType.onlyRefresh, displayType: SmartToastType.onlyRefresh,
); );
}
super.onError(err, handler); super.onError(err, handler);
} }

View File

@ -31,14 +31,14 @@ class MsgHttp {
} catch (err) { } catch (err) {
return { return {
'status': false, 'status': false,
'date': [], 'data': [],
'msg': err.toString(), 'msg': err.toString(),
}; };
} }
} else { } else {
return { return {
'status': false, 'status': false,
'date': [], 'data': [],
'msg': res.data['message'], 'msg': res.data['message'],
}; };
} }

View File

@ -16,6 +16,7 @@ import 'package:pilipala/pages/search/index.dart';
import 'package:pilipala/pages/video/detail/index.dart'; import 'package:pilipala/pages/video/detail/index.dart';
import 'package:pilipala/router/app_pages.dart'; import 'package:pilipala/router/app_pages.dart';
import 'package:pilipala/pages/main/view.dart'; import 'package:pilipala/pages/main/view.dart';
import 'package:pilipala/services/disable_battery_opt.dart';
import 'package:pilipala/services/service_locator.dart'; import 'package:pilipala/services/service_locator.dart';
import 'package:pilipala/utils/app_scheme.dart'; import 'package:pilipala/utils/app_scheme.dart';
import 'package:pilipala/utils/data.dart'; import 'package:pilipala/utils/data.dart';
@ -24,6 +25,9 @@ import 'package:media_kit/media_kit.dart'; // Provides [Player], [Media], [Playl
import 'package:pilipala/utils/recommend_filter.dart'; import 'package:pilipala/utils/recommend_filter.dart';
import 'package:catcher_2/catcher_2.dart'; import 'package:catcher_2/catcher_2.dart';
import './services/loggeer.dart'; import './services/loggeer.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'services/sentry.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -54,14 +58,36 @@ void main() async {
[FileHandler(await getLogsPath())], [FileHandler(await getLogsPath())],
); );
Catcher2( // Catcher2(
debugConfig: debugConfig, // debugConfig: debugConfig,
releaseConfig: releaseConfig, // releaseConfig: releaseConfig,
runAppFunction: () { // runAppFunction: () {
runApp(const MyApp()); // runApp(const MyApp());
}, // },
// );
await SentryService.sentryInit(
() => runApp(
SentryScreenshotWidget(
child: SentryUserInteractionWidget(
child: DefaultAssetBundle(
bundle: SentryAssetBundle(),
child: const MyApp(),
),
),
),
),
); );
// try {
// int? test;
// test! + 3;
// } catch (exception, stackTrace) {
// debugPrint('111');
// await Sentry.captureException(exception, stackTrace: '$stackTrace');
// debugPrint('222');
// }
// 小白条、导航栏沉浸 // 小白条、导航栏沉浸
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
@ -71,6 +97,7 @@ void main() async {
)); ));
Data.init(); Data.init();
PiliSchame.init(); PiliSchame.init();
DisableBatteryOpt();
}); });
} }
@ -193,6 +220,7 @@ class MyApp extends StatelessWidget {
navigatorObservers: [ navigatorObservers: [
VideoDetailPage.routeObserver, VideoDetailPage.routeObserver,
SearchPage.routeObserver, SearchPage.routeObserver,
SentryNavigatorObserver(),
], ],
); );
}), }),

View File

@ -0,0 +1,43 @@
enum LiveQuality {
dolby,
super4K,
origin,
bluRay,
superHD,
smooth,
flunt,
}
extension LiveQualityCode on LiveQuality {
static final List<int> _codeList = [
30000,
20000,
10000,
400,
250,
150,
80,
];
int get code => _codeList[index];
static LiveQuality? fromCode(int code) {
final index = _codeList.indexOf(code);
if (index != -1) {
return LiveQuality.values[index];
}
return null;
}
}
extension VideoQualityDesc on LiveQuality {
static final List<String> _descList = [
'杜比',
'4K',
'原画',
'蓝光',
'超清',
'高清',
'流畅',
];
get description => _descList[index];
}

View File

@ -25,13 +25,6 @@ class BangumiIntroController extends GetxController {
? int.tryParse(Get.parameters['epId']!) ? int.tryParse(Get.parameters['epId']!)
: null; : null;
// 是否预渲染 骨架屏
bool preRender = false;
// 视频详情 上个页面传入
Map? videoItem = {};
BangumiInfoModel? bangumiItem;
// 请求状态 // 请求状态
RxBool isLoading = false.obs; RxBool isLoading = false.obs;
@ -63,27 +56,6 @@ class BangumiIntroController extends GetxController {
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
if (Get.arguments.isNotEmpty as bool) {
if (Get.arguments.containsKey('bangumiItem') as bool) {
preRender = true;
bangumiItem = Get.arguments['bangumiItem'];
// bangumiItem!['pic'] = args.pic;
// if (args.title is String) {
// videoItem!['title'] = args.title;
// } else {
// String str = '';
// for (Map map in args.title) {
// str += map['text'];
// }
// videoItem!['title'] = str;
// }
// if (args.stat != null) {
// videoItem!['stat'] = args.stat;
// }
// videoItem!['pubdate'] = args.pubdate;
// videoItem!['owner'] = args.owner;
}
}
userInfo = userInfoCache.get('userInfoCache'); userInfo = userInfoCache.get('userInfoCache');
userLogin = userInfo != null; userLogin = userInfo != null;
} }
@ -196,7 +168,8 @@ class BangumiIntroController extends GetxController {
} }
Get.back(); Get.back();
}, },
child: const Text('确定')) child: const Text('确定'),
)
], ],
); );
}); });

View File

@ -12,11 +12,10 @@ import 'package:pilipala/models/bangumi/info.dart';
import 'package:pilipala/pages/bangumi/widgets/bangumi_panel.dart'; import 'package:pilipala/pages/bangumi/widgets/bangumi_panel.dart';
import 'package:pilipala/pages/video/detail/index.dart'; import 'package:pilipala/pages/video/detail/index.dart';
import 'package:pilipala/pages/video/detail/introduction/widgets/action_item.dart'; import 'package:pilipala/pages/video/detail/introduction/widgets/action_item.dart';
import 'package:pilipala/pages/video/detail/introduction/widgets/action_row_item.dart';
import 'package:pilipala/pages/video/detail/introduction/widgets/fav_panel.dart'; import 'package:pilipala/pages/video/detail/introduction/widgets/fav_panel.dart';
import 'package:pilipala/utils/feed_back.dart'; import 'package:pilipala/utils/feed_back.dart';
import 'package:pilipala/utils/storage.dart'; import 'package:pilipala/utils/storage.dart';
import '../../../common/widgets/http_error.dart';
import 'controller.dart'; import 'controller.dart';
import 'widgets/intro_detail.dart'; import 'widgets/intro_detail.dart';
@ -51,9 +50,6 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
cid = widget.cid!; cid = widget.cid!;
bangumiIntroController = Get.put(BangumiIntroController(), tag: heroTag); bangumiIntroController = Get.put(BangumiIntroController(), tag: heroTag);
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag); videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
bangumiIntroController.bangumiDetail.listen((BangumiInfoModel value) {
bangumiDetail = value;
});
_futureBuilderFuture = bangumiIntroController.queryBangumiIntro(); _futureBuilderFuture = bangumiIntroController.queryBangumiIntro();
videoDetailCtr.cid.listen((int p0) { videoDetailCtr.cid.listen((int p0) {
cid = p0; cid = p0;
@ -68,27 +64,32 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
future: _futureBuilderFuture, future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) { builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done) { if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.data == null) {
return const SliverToBoxAdapter(child: SizedBox());
}
if (snapshot.data['status']) { if (snapshot.data['status']) {
// 请求成功 // 请求成功
return Obx(
return BangumiInfo( () => BangumiInfo(
loadingStatus: false, bangumiDetail: bangumiIntroController.bangumiDetail.value,
bangumiDetail: bangumiDetail,
cid: cid, cid: cid,
),
); );
} else { } else {
// 请求错误 // 请求错误
// return HttpError( return HttpError(
// errMsg: snapshot.data['msg'], errMsg: snapshot.data['msg'],
// fn: () => Get.back(), fn: () => Get.back(),
// ); );
return const SizedBox();
} }
} else { } else {
return BangumiInfo( return const SliverToBoxAdapter(
loadingStatus: true, child: SizedBox(
bangumiDetail: bangumiDetail, height: 100,
cid: cid, child: Center(
child: CircularProgressIndicator(),
),
),
); );
} }
}, },
@ -99,12 +100,10 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
class BangumiInfo extends StatefulWidget { class BangumiInfo extends StatefulWidget {
const BangumiInfo({ const BangumiInfo({
super.key, super.key,
this.loadingStatus = false,
this.bangumiDetail, this.bangumiDetail,
this.cid, this.cid,
}); });
final bool loadingStatus;
final BangumiInfoModel? bangumiDetail; final BangumiInfoModel? bangumiDetail;
final int? cid; final int? cid;
@ -117,7 +116,6 @@ class _BangumiInfoState extends State<BangumiInfo> {
late final BangumiIntroController bangumiIntroController; late final BangumiIntroController bangumiIntroController;
late final VideoDetailController videoDetailCtr; late final VideoDetailController videoDetailCtr;
Box localCache = GStrorage.localCache; Box localCache = GStrorage.localCache;
late final BangumiInfoModel? bangumiItem;
late double sheetHeight; late double sheetHeight;
int? cid; int? cid;
bool isProcessing = false; bool isProcessing = false;
@ -136,13 +134,10 @@ class _BangumiInfoState extends State<BangumiInfo> {
super.initState(); super.initState();
bangumiIntroController = Get.put(BangumiIntroController(), tag: heroTag); bangumiIntroController = Get.put(BangumiIntroController(), tag: heroTag);
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag); videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
bangumiItem = bangumiIntroController.bangumiItem;
sheetHeight = localCache.get('sheetHeight'); sheetHeight = localCache.get('sheetHeight');
cid = widget.cid!; cid = widget.cid!;
print('cid: $cid');
videoDetailCtr.cid.listen((p0) { videoDetailCtr.cid.listen((p0) {
cid = p0; cid = p0;
print('cid: $cid');
setState(() {}); setState(() {});
}); });
} }
@ -182,8 +177,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: StyleString.safeSpace, right: StyleString.safeSpace, top: 20), left: StyleString.safeSpace, right: StyleString.safeSpace, top: 20),
sliver: SliverToBoxAdapter( sliver: SliverToBoxAdapter(
child: !widget.loadingStatus || bangumiItem != null child: Column(
? Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
@ -194,15 +188,10 @@ class _BangumiInfoState extends State<BangumiInfo> {
NetworkImgLayer( NetworkImgLayer(
width: 105, width: 105,
height: 160, height: 160,
src: !widget.loadingStatus src: widget.bangumiDetail!.cover!,
? widget.bangumiDetail!.cover!
: bangumiItem!.cover!,
), ),
if (bangumiItem != null &&
bangumiItem!.rating != null)
PBadge( PBadge(
text: text: '评分 ${widget.bangumiDetail!.rating!['score']!}',
'评分 ${!widget.loadingStatus ? widget.bangumiDetail!.rating!['score']! : bangumiItem!.rating!['score']!}',
top: null, top: null,
right: 6, right: 6,
bottom: 6, bottom: 6,
@ -224,9 +213,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
!widget.loadingStatus widget.bangumiDetail!.title!,
? widget.bangumiDetail!.title!
: bangumiItem!.title!,
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -246,8 +233,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
backgroundColor: backgroundColor:
MaterialStateProperty.resolveWith( MaterialStateProperty.resolveWith(
(Set<MaterialState> states) { (Set<MaterialState> states) {
return t return t.colorScheme.primaryContainer
.colorScheme.primaryContainer
.withOpacity(0.7); .withOpacity(0.7);
}), }),
), ),
@ -266,18 +252,13 @@ class _BangumiInfoState extends State<BangumiInfo> {
children: [ children: [
StatView( StatView(
theme: 'gray', theme: 'gray',
view: !widget.loadingStatus view: widget.bangumiDetail!.stat!['views'],
? widget.bangumiDetail!.stat!['views']
: bangumiItem!.stat!['views'],
size: 'medium', size: 'medium',
), ),
const SizedBox(width: 6), const SizedBox(width: 6),
StatDanMu( StatDanMu(
theme: 'gray', theme: 'gray',
danmu: !widget.loadingStatus danmu: widget.bangumiDetail!.stat!['danmakus'],
? widget
.bangumiDetail!.stat!['danmakus']
: bangumiItem!.stat!['danmakus'],
size: 'medium', size: 'medium',
), ),
], ],
@ -286,15 +267,8 @@ class _BangumiInfoState extends State<BangumiInfo> {
Row( Row(
children: [ children: [
Text( Text(
!widget.loadingStatus (widget.bangumiDetail!.areas!.isNotEmpty
? (widget.bangumiDetail!.areas! ? widget.bangumiDetail!.areas!.first['name']
.isNotEmpty
? widget.bangumiDetail!.areas!
.first['name']
: '')
: (bangumiItem!.areas!.isNotEmpty
? bangumiItem!
.areas!.first['name']
: ''), : ''),
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
@ -303,11 +277,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
), ),
const SizedBox(width: 6), const SizedBox(width: 6),
Text( Text(
!widget.loadingStatus widget.bangumiDetail!.publish!['pub_time_show'],
? widget.bangumiDetail!
.publish!['pub_time_show']
: bangumiItem!
.publish!['pub_time_show'],
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: t.colorScheme.outline, color: t.colorScheme.outline,
@ -315,20 +285,16 @@ class _BangumiInfoState extends State<BangumiInfo> {
), ),
], ],
), ),
// const SizedBox(height: 4),
Text( Text(
!widget.loadingStatus widget.bangumiDetail!.newEp!['desc'],
? widget.bangumiDetail!.newEp!['desc']
: bangumiItem!.newEp!['desc'],
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: t.colorScheme.outline, color: t.colorScheme.outline,
), ),
), ),
// const SizedBox(height: 10),
const Spacer(), const Spacer(),
Text( Text(
'简介:${!widget.loadingStatus ? widget.bangumiDetail!.evaluate! : bangumiItem!.evaluate!}', '简介:${widget.bangumiDetail!.evaluate!}',
maxLines: 3, maxLines: 3,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -344,45 +310,22 @@ class _BangumiInfoState extends State<BangumiInfo> {
], ],
), ),
const SizedBox(height: 6), 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), actionGrid(context, bangumiIntroController),
// 番剧分p // 番剧分p
if ((!widget.loadingStatus && if (widget.bangumiDetail!.episodes!.isNotEmpty) ...[
widget.bangumiDetail!.episodes!.isNotEmpty) ||
bangumiItem != null &&
bangumiItem!.episodes!.isNotEmpty) ...[
BangumiPanel( BangumiPanel(
pages: bangumiItem != null pages: widget.bangumiDetail!.episodes!,
? bangumiItem!.episodes! cid: cid ?? widget.bangumiDetail!.episodes!.first.cid,
: widget.bangumiDetail!.episodes!,
cid: cid ??
(bangumiItem != null
? bangumiItem!.episodes!.first.cid
: widget.bangumiDetail!.episodes!.first.cid),
sheetHeight: sheetHeight, sheetHeight: sheetHeight,
changeFuc: (bvid, cid, aid) => bangumiIntroController changeFuc: (bvid, cid, aid) =>
.changeSeasonOrbangu(bvid, cid, aid), bangumiIntroController.changeSeasonOrbangu(bvid, cid, aid),
bangumiDetail: bangumiIntroController.bangumiDetail.value,
) )
], ],
], ],
) )),
: const SizedBox(
height: 100,
child: Center(
child: CircularProgressIndicator(),
),
),
),
); );
} }
@ -404,25 +347,19 @@ class _BangumiInfoState extends State<BangumiInfo> {
() => ActionItem( () => ActionItem(
icon: const Icon(FontAwesomeIcons.thumbsUp), icon: const Icon(FontAwesomeIcons.thumbsUp),
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp), selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
onTap: onTap: handleState(bangumiIntroController.actionLikeVideo),
handleState(bangumiIntroController.actionLikeVideo),
selectStatus: bangumiIntroController.hasLike.value, selectStatus: bangumiIntroController.hasLike.value,
loadingStatus: false, text: widget.bangumiDetail!.stat!['likes']!.toString(),
text: !widget.loadingStatus ),
? widget.bangumiDetail!.stat!['likes']!.toString()
: bangumiItem!.stat!['likes']!.toString()),
), ),
Obx( Obx(
() => ActionItem( () => ActionItem(
icon: const Icon(FontAwesomeIcons.b), icon: const Icon(FontAwesomeIcons.b),
selectIcon: const Icon(FontAwesomeIcons.b), selectIcon: const Icon(FontAwesomeIcons.b),
onTap: onTap: handleState(bangumiIntroController.actionCoinVideo),
handleState(bangumiIntroController.actionCoinVideo),
selectStatus: bangumiIntroController.hasCoin.value, selectStatus: bangumiIntroController.hasCoin.value,
loadingStatus: false, text: widget.bangumiDetail!.stat!['coins']!.toString(),
text: !widget.loadingStatus ),
? widget.bangumiDetail!.stat!['coins']!.toString()
: bangumiItem!.stat!['coins']!.toString()),
), ),
Obx( Obx(
() => ActionItem( () => ActionItem(
@ -430,29 +367,22 @@ class _BangumiInfoState extends State<BangumiInfo> {
selectIcon: const Icon(FontAwesomeIcons.solidStar), selectIcon: const Icon(FontAwesomeIcons.solidStar),
onTap: () => showFavBottomSheet(), onTap: () => showFavBottomSheet(),
selectStatus: bangumiIntroController.hasFav.value, selectStatus: bangumiIntroController.hasFav.value,
loadingStatus: false, text: widget.bangumiDetail!.stat!['favorite']!.toString(),
text: !widget.loadingStatus ),
? widget.bangumiDetail!.stat!['favorite']!.toString()
: bangumiItem!.stat!['favorite']!.toString()),
), ),
ActionItem( ActionItem(
icon: const Icon(FontAwesomeIcons.comment), icon: const Icon(FontAwesomeIcons.comment),
selectIcon: const Icon(FontAwesomeIcons.reply), selectIcon: const Icon(FontAwesomeIcons.reply),
onTap: () => videoDetailCtr.tabCtr.animateTo(1), onTap: () => videoDetailCtr.tabCtr.animateTo(1),
selectStatus: false, selectStatus: false,
loadingStatus: false, text: widget.bangumiDetail!.stat!['reply']!.toString(),
text: !widget.loadingStatus
? widget.bangumiDetail!.stat!['reply']!.toString()
: bangumiItem!.stat!['reply']!.toString(),
), ),
ActionItem( ActionItem(
icon: const Icon(FontAwesomeIcons.shareFromSquare), icon: const Icon(FontAwesomeIcons.shareFromSquare),
onTap: () => bangumiIntroController.actionShareVideo(), onTap: () => bangumiIntroController.actionShareVideo(),
selectStatus: false, selectStatus: false,
loadingStatus: false, text: widget.bangumiDetail!.stat!['share']!.toString(),
text: !widget.loadingStatus ),
? widget.bangumiDetail!.stat!['share']!.toString()
: bangumiItem!.stat!['share']!.toString()),
], ],
), ),
), ),
@ -460,63 +390,4 @@ class _BangumiInfoState extends State<BangumiInfo> {
); );
}); });
} }
Widget actionRow(BuildContext context, videoIntroController, videoDetailCtr) {
return Row(children: [
Obx(
() => ActionRowItem(
icon: const Icon(FontAwesomeIcons.thumbsUp),
onTap: handleState(videoIntroController.actionLikeVideo),
selectStatus: videoIntroController.hasLike.value,
loadingStatus: widget.loadingStatus,
text: !widget.loadingStatus
? widget.bangumiDetail!.stat!['likes']!.toString()
: '-',
),
),
const SizedBox(width: 8),
Obx(
() => ActionRowItem(
icon: const Icon(FontAwesomeIcons.b),
onTap: handleState(videoIntroController.actionCoinVideo),
selectStatus: videoIntroController.hasCoin.value,
loadingStatus: widget.loadingStatus,
text: !widget.loadingStatus
? widget.bangumiDetail!.stat!['coins']!.toString()
: '-',
),
),
const SizedBox(width: 8),
Obx(
() => ActionRowItem(
icon: const Icon(FontAwesomeIcons.heart),
onTap: () => showFavBottomSheet(),
selectStatus: videoIntroController.hasFav.value,
loadingStatus: widget.loadingStatus,
text: !widget.loadingStatus
? widget.bangumiDetail!.stat!['favorite']!.toString()
: '-',
),
),
const SizedBox(width: 8),
ActionRowItem(
icon: const Icon(FontAwesomeIcons.comment),
onTap: () {
videoDetailCtr.tabCtr.animateTo(1);
},
selectStatus: false,
loadingStatus: widget.loadingStatus,
text: !widget.loadingStatus
? widget.bangumiDetail!.stat!['reply']!.toString()
: '-',
),
const SizedBox(width: 8),
ActionRowItem(
icon: const Icon(FontAwesomeIcons.share),
onTap: () => videoIntroController.actionShareVideo(),
selectStatus: false,
loadingStatus: widget.loadingStatus,
text: '转发'),
]);
}
} }

View File

@ -14,12 +14,14 @@ class BangumiPanel extends StatefulWidget {
this.cid, this.cid,
this.sheetHeight, this.sheetHeight,
this.changeFuc, this.changeFuc,
this.bangumiDetail,
}); });
final List<EpisodeItem> pages; final List<EpisodeItem> pages;
final int? cid; final int? cid;
final double? sheetHeight; final double? sheetHeight;
final Function? changeFuc; final Function? changeFuc;
final BangumiInfoModel? bangumiDetail;
@override @override
State<BangumiPanel> createState() => _BangumiPanelState(); State<BangumiPanel> createState() => _BangumiPanelState();
@ -87,7 +89,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
) )
: null, : null,
title: Text( title: Text(
'${index + 1}${page.longTitle!}', '${page.title}${page.longTitle!}',
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: isCurrentIndex color: isCurrentIndex
@ -96,9 +98,11 @@ class _BangumiPanelState extends State<BangumiPanel> {
), ),
), ),
trailing: page.badge != null trailing: page.badge != null
? Image.asset( ? Text(
'assets/images/big-vip.png', page.badge!,
height: 20, style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
) )
: const SizedBox(), : const SizedBox(),
); );
@ -144,9 +148,9 @@ class _BangumiPanelState extends State<BangumiPanel> {
Expanded( Expanded(
child: Material( child: Material(
child: ScrollablePositionedList.builder( child: ScrollablePositionedList.builder(
itemCount: widget.pages.length, itemCount: widget.pages.length + 1,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
bool isLastItem = index == widget.pages.length - 1; bool isLastItem = index == widget.pages.length;
bool isCurrentIndex = currentIndex == index; bool isCurrentIndex = currentIndex == index;
return isLastItem return isLastItem
? SizedBox( ? SizedBox(
@ -201,11 +205,11 @@ class _BangumiPanelState extends State<BangumiPanel> {
return Column( return Column(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.only(top: 10, bottom: 6), padding: const EdgeInsets.only(top: 10, bottom: 10),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
const Text(''), const Text(''),
Expanded( Expanded(
child: Text( child: Text(
' 正在播放:${widget.pages[currentIndex].longTitle}', ' 正在播放:${widget.pages[currentIndex].longTitle}',
@ -225,7 +229,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
), ),
onPressed: () => showBangumiPanel(), onPressed: () => showBangumiPanel(),
child: Text( child: Text(
'${widget.pages.length}', '${widget.bangumiDetail!.newEp!['desc']}',
style: const TextStyle(fontSize: 13), style: const TextStyle(fontSize: 13),
), ),
), ),
@ -278,23 +282,15 @@ class _BangumiPanelState extends State<BangumiPanel> {
), ),
const SizedBox(width: 2), const SizedBox(width: 2),
if (widget.pages[i].badge != null) ...[ if (widget.pages[i].badge != null) ...[
if (widget.pages[i].badge == '会员') ...[
Image.asset(
'assets/images/big-vip.png',
height: 16,
),
],
if (widget.pages[i].badge != '会员') ...[
const Spacer(), const Spacer(),
Text( Text(
widget.pages[i].badge!, widget.pages[i].badge!,
style: TextStyle( style: TextStyle(
fontSize: 11, fontSize: 12,
color: color:
Theme.of(context).colorScheme.primary, Theme.of(context).colorScheme.primary,
), ),
), ),
],
] ]
], ],
), ),

View File

@ -14,6 +14,7 @@ import 'package:pilipala/pages/main/index.dart';
import 'package:pilipala/utils/feed_back.dart'; import 'package:pilipala/utils/feed_back.dart';
import 'package:pilipala/utils/storage.dart'; import 'package:pilipala/utils/storage.dart';
import '../mine/controller.dart';
import 'controller.dart'; import 'controller.dart';
import 'widgets/dynamic_panel.dart'; import 'widgets/dynamic_panel.dart';
import 'widgets/up_panel.dart'; import 'widgets/up_panel.dart';
@ -28,6 +29,7 @@ class DynamicsPage extends StatefulWidget {
class _DynamicsPageState extends State<DynamicsPage> class _DynamicsPageState extends State<DynamicsPage>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
final DynamicsController _dynamicsController = Get.put(DynamicsController()); final DynamicsController _dynamicsController = Get.put(DynamicsController());
final MineController mineController = Get.put(MineController());
late Future _futureBuilderFuture; late Future _futureBuilderFuture;
late Future _futureBuilderFutureUp; late Future _futureBuilderFutureUp;
Box userInfoCache = GStrorage.userInfo; Box userInfoCache = GStrorage.userInfo;
@ -256,6 +258,14 @@ class _DynamicsPageState extends State<DynamicsPage>
} }
}, },
); );
} else if (data['msg'] == "账号未登录") {
return HttpError(
errMsg: data['msg'],
btnText: "去登录",
fn: () {
mineController.onLogin();
},
);
} else { } else {
return HttpError( return HttpError(
errMsg: data['msg'], errMsg: data['msg'],

View File

@ -88,9 +88,11 @@ class HistoryController extends GetxController {
// 观看历史暂停状态 // 观看历史暂停状态
Future historyStatus() async { Future historyStatus() async {
var res = await UserHttp.historyStatus(); var res = await UserHttp.historyStatus();
if (res.data['code'] == 0) {
pauseStatus.value = res.data['data']; pauseStatus.value = res.data['data'];
localCache.put(LocalCacheKey.historyPause, res.data['data']); localCache.put(LocalCacheKey.historyPause, res.data['data']);
} }
}
// 清空观看历史 // 清空观看历史
Future onClearHistory() async { Future onClearHistory() async {

View File

@ -1,6 +1,8 @@
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:pilipala/http/constants.dart'; import 'package:pilipala/http/constants.dart';
import 'package:pilipala/http/live.dart'; import 'package:pilipala/http/live.dart';
import 'package:pilipala/models/live/quality.dart';
import 'package:pilipala/models/live/room_info.dart'; import 'package:pilipala/models/live/room_info.dart';
import 'package:pilipala/plugin/pl_player/index.dart'; import 'package:pilipala/plugin/pl_player/index.dart';
import '../../models/live/room_info_h5.dart'; import '../../models/live/room_info_h5.dart';
@ -19,10 +21,16 @@ class LiveRoomController extends GetxController {
PlPlayerController.getInstance(videoType: 'live'); PlPlayerController.getInstance(videoType: 'live');
Rx<RoomInfoH5Model> roomInfoH5 = RoomInfoH5Model().obs; Rx<RoomInfoH5Model> roomInfoH5 = RoomInfoH5Model().obs;
late bool enableCDN; late bool enableCDN;
late int currentQn;
int? tempCurrentQn;
late List<Map<String, dynamic>> acceptQnList;
RxString currentQnDesc = ''.obs;
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
currentQn = setting.get(SettingBoxKey.defaultLiveQa,
defaultValue: LiveQuality.values.last.code);
roomId = int.parse(Get.parameters['roomid']!); roomId = int.parse(Get.parameters['roomid']!);
if (Get.arguments != null) { if (Get.arguments != null) {
liveItem = Get.arguments['liveItem']; liveItem = Get.arguments['liveItem'];
@ -57,11 +65,28 @@ class LiveRoomController extends GetxController {
} }
Future queryLiveInfo() async { Future queryLiveInfo() async {
var res = await LiveHttp.liveRoomInfo(roomId: roomId, qn: 10000); var res = await LiveHttp.liveRoomInfo(roomId: roomId, qn: currentQn);
if (res['status']) { if (res['status']) {
List<CodecItem> codec = List<CodecItem> codec =
res['data'].playurlInfo.playurl.stream.first.format.first.codec; res['data'].playurlInfo.playurl.stream.first.format.first.codec;
CodecItem item = codec.first; CodecItem item = codec.first;
// 以服务端返回的码率为准
currentQn = item.currentQn!;
if (tempCurrentQn != null && tempCurrentQn == currentQn) {
SmartDialog.showToast('画质切换失败,请检查登录状态');
}
List acceptQn = item.acceptQn!;
acceptQnList = acceptQn.map((e) {
return {
'code': e,
'desc': LiveQuality.values
.firstWhere((element) => element.code == e)
.description,
};
}).toList();
currentQnDesc.value = LiveQuality.values
.firstWhere((element) => element.code == currentQn)
.description;
String videoUrl = enableCDN String videoUrl = enableCDN
? VideoUtils.getCdnUrl(item) ? VideoUtils.getCdnUrl(item)
: (item.urlInfo?.first.host)! + : (item.urlInfo?.first.host)! +
@ -90,4 +115,17 @@ class LiveRoomController extends GetxController {
} }
return res; return res;
} }
// 修改画质
void changeQn(int qn) async {
tempCurrentQn = currentQn;
if (currentQn == qn) {
return;
}
currentQn = qn;
currentQnDesc.value = LiveQuality.values
.firstWhere((element) => element.code == currentQn)
.description;
await queryLiveInfo();
}
} }

View File

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:floating/floating.dart'; import 'package:floating/floating.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:pilipala/models/video/play/url.dart'; import 'package:pilipala/models/video/play/url.dart';
import 'package:pilipala/pages/live_room/index.dart'; import 'package:pilipala/pages/live_room/index.dart';
@ -83,6 +84,30 @@ class _BottomControlState extends State<BottomControl> {
// ), // ),
// ), // ),
// const SizedBox(width: 4), // const SizedBox(width: 4),
SizedBox(
width: 30,
child: PopupMenuButton<int>(
padding: EdgeInsets.zero,
onSelected: (value) {
widget.liveRoomCtr!.changeQn(value);
},
child: Obx(
() => Text(
widget.liveRoomCtr!.currentQnDesc.value,
style: const TextStyle(color: Colors.white, fontSize: 13),
),
),
itemBuilder: (BuildContext context) {
return widget.liveRoomCtr!.acceptQnList.map((e) {
return PopupMenuItem<int>(
value: e['code'],
child: Text(e['desc']),
);
}).toList();
},
),
),
const SizedBox(width: 10),
if (Platform.isAndroid) ...[ if (Platform.isAndroid) ...[
SizedBox( SizedBox(
width: 34, width: 34,
@ -110,7 +135,7 @@ class _BottomControlState extends State<BottomControl> {
), ),
), ),
), ),
const SizedBox(width: 4), const SizedBox(width: 10),
], ],
ComBtn( ComBtn(
icon: const Icon( icon: const Icon(

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:media_kit/media_kit.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart'; import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/models/user/fav_folder.dart'; import 'package:pilipala/models/user/fav_folder.dart';
import 'package:pilipala/pages/main/index.dart'; import 'package:pilipala/pages/main/index.dart';
@ -102,7 +103,11 @@ class _MediaPageState extends State<MediaPage>
], ],
Obx(() => mediaController.userLogin.value Obx(() => mediaController.userLogin.value
? favFolder(mediaController, context) ? favFolder(mediaController, context)
: const SizedBox()) : const SizedBox()),
SizedBox(
height: MediaQuery.of(context).padding.bottom +
kBottomNavigationBarHeight,
)
], ],
), ),
), ),

View File

@ -10,6 +10,7 @@ import 'package:pilipala/services/service_locator.dart';
import 'package:pilipala/utils/global_data.dart'; import 'package:pilipala/utils/global_data.dart';
import 'package:pilipala/utils/storage.dart'; import 'package:pilipala/utils/storage.dart';
import '../../models/live/quality.dart';
import 'widgets/switch_item.dart'; import 'widgets/switch_item.dart';
class PlaySetting extends StatefulWidget { class PlaySetting extends StatefulWidget {
@ -22,6 +23,7 @@ class PlaySetting extends StatefulWidget {
class _PlaySettingState extends State<PlaySetting> { class _PlaySettingState extends State<PlaySetting> {
Box setting = GStrorage.setting; Box setting = GStrorage.setting;
late dynamic defaultVideoQa; late dynamic defaultVideoQa;
late dynamic defaultLiveQa;
late dynamic defaultAudioQa; late dynamic defaultAudioQa;
late dynamic defaultDecode; late dynamic defaultDecode;
late int defaultFullScreenMode; late int defaultFullScreenMode;
@ -32,6 +34,8 @@ class _PlaySettingState extends State<PlaySetting> {
super.initState(); super.initState();
defaultVideoQa = setting.get(SettingBoxKey.defaultVideoQa, defaultVideoQa = setting.get(SettingBoxKey.defaultVideoQa,
defaultValue: VideoQuality.values.last.code); defaultValue: VideoQuality.values.last.code);
defaultLiveQa = setting.get(SettingBoxKey.defaultLiveQa,
defaultValue: LiveQuality.values.last.code);
defaultAudioQa = setting.get(SettingBoxKey.defaultAudioQa, defaultAudioQa = setting.get(SettingBoxKey.defaultAudioQa,
defaultValue: AudioQuality.values.last.code); defaultValue: AudioQuality.values.last.code);
defaultDecode = setting.get(SettingBoxKey.defaultDecode, defaultDecode = setting.get(SettingBoxKey.defaultDecode,
@ -157,9 +161,9 @@ class _PlaySettingState extends State<PlaySetting> {
}), }),
ListTile( ListTile(
dense: false, dense: false,
title: Text('默认画质', style: titleStyle), title: Text('默认视频画质', style: titleStyle),
subtitle: Text( subtitle: Text(
'当前画质${VideoQualityCode.fromCode(defaultVideoQa)!.description!}', '当前默认画质${VideoQualityCode.fromCode(defaultVideoQa)!.description!}',
style: subTitleStyle, style: subTitleStyle,
), ),
onTap: () async { onTap: () async {
@ -167,7 +171,7 @@ class _PlaySettingState extends State<PlaySetting> {
context: context, context: context,
builder: (context) { builder: (context) {
return SelectDialog<int>( return SelectDialog<int>(
title: '默认画质', title: '默认视频画质',
value: defaultVideoQa, value: defaultVideoQa,
values: VideoQuality.values.reversed.map((e) { values: VideoQuality.values.reversed.map((e) {
return {'title': e.description, 'value': e.code}; return {'title': e.description, 'value': e.code};
@ -181,6 +185,32 @@ class _PlaySettingState extends State<PlaySetting> {
} }
}, },
), ),
ListTile(
dense: false,
title: Text('默认直播画质', style: titleStyle),
subtitle: Text(
'当前默认画质${LiveQualityCode.fromCode(defaultLiveQa)!.description!}',
style: subTitleStyle,
),
onTap: () async {
int? result = await showDialog(
context: context,
builder: (context) {
return SelectDialog<int>(
title: '默认直播画质',
value: defaultLiveQa,
values: LiveQuality.values.reversed.map((e) {
return {'title': e.description, 'value': e.code};
}).toList());
},
);
if (result != null) {
defaultLiveQa = result;
setting.put(SettingBoxKey.defaultLiveQa, result);
setState(() {});
}
},
),
ListTile( ListTile(
dense: false, dense: false,
title: Text('默认音质', style: titleStyle), title: Text('默认音质', style: titleStyle),

View File

@ -25,13 +25,6 @@ class VideoIntroController extends GetxController {
VideoIntroController({required this.bvid}); VideoIntroController({required this.bvid});
// 视频bvid // 视频bvid
String bvid; String bvid;
// 是否预渲染 骨架屏
bool preRender = false;
// 视频详情 上个页面传入
Map? videoItem = {};
// 请求状态 // 请求状态
RxBool isLoading = false.obs; RxBool isLoading = false.obs;
@ -74,26 +67,6 @@ class VideoIntroController extends GetxController {
try { try {
heroTag = Get.arguments['heroTag']; heroTag = Get.arguments['heroTag'];
} catch (_) {} } catch (_) {}
if (Get.arguments.isNotEmpty) {
if (Get.arguments.containsKey('videoItem')) {
preRender = true;
var args = Get.arguments['videoItem'];
var keys = Get.arguments.keys.toList();
videoItem!['pic'] = args.pic;
if (args.title is String) {
videoItem!['title'] = args.title;
} else {
String str = '';
for (Map map in args.title) {
str += map['text'];
}
videoItem!['title'] = str;
}
videoItem!['stat'] = keys.contains('stat') && args.stat;
videoItem!['pubdate'] = keys.contains('pubdate') && args.pubdate;
videoItem!['owner'] = keys.contains('owner') && args.owner;
}
}
userLogin = userInfo != null; userLogin = userInfo != null;
lastPlayCid.value = int.parse(Get.parameters['cid']!); lastPlayCid.value = int.parse(Get.parameters['cid']!);
isShowOnlineTotal = isShowOnlineTotal =
@ -112,10 +85,9 @@ class VideoIntroController extends GetxController {
if (videoDetail.value.pages!.isNotEmpty && lastPlayCid.value == 0) { if (videoDetail.value.pages!.isNotEmpty && lastPlayCid.value == 0) {
lastPlayCid.value = videoDetail.value.pages!.first.cid!; lastPlayCid.value = videoDetail.value.pages!.first.cid!;
} }
// Get.find<VideoDetailController>(tag: heroTag).tabs.value = [ final VideoDetailController videoDetailCtr =
// '简介', Get.find<VideoDetailController>(tag: heroTag);
// '评论 ${result['data']!.stat!.reply}' videoDetailCtr.tabs.value = ['简介', '评论 ${result['data']?.stat?.reply}'];
// ];
// 获取到粉丝数再返回 // 获取到粉丝数再返回
await queryUserStat(); await queryUserStat();
} }

View File

@ -15,9 +15,7 @@ import 'package:pilipala/pages/video/detail/widgets/ai_detail.dart';
import 'package:pilipala/utils/feed_back.dart'; import 'package:pilipala/utils/feed_back.dart';
import 'package:pilipala/utils/storage.dart'; import 'package:pilipala/utils/storage.dart';
import 'package:pilipala/utils/utils.dart'; import 'package:pilipala/utils/utils.dart';
import 'widgets/action_item.dart'; import 'widgets/action_item.dart';
import 'widgets/action_row_item.dart';
import 'widgets/fav_panel.dart'; import 'widgets/fav_panel.dart';
import 'widgets/intro_detail.dart'; import 'widgets/intro_detail.dart';
import 'widgets/page.dart'; import 'widgets/page.dart';
@ -78,7 +76,6 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
// 请求成功 // 请求成功
return Obx( return Obx(
() => VideoInfo( () => VideoInfo(
loadingStatus: false,
videoDetail: videoIntroController.videoDetail.value, videoDetail: videoIntroController.videoDetail.value,
heroTag: heroTag, heroTag: heroTag,
bvid: widget.bvid, bvid: widget.bvid,
@ -96,11 +93,13 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
); );
} }
} else { } else {
return VideoInfo( return const SliverToBoxAdapter(
loadingStatus: true, child: SizedBox(
videoDetail: videoDetail, height: 100,
heroTag: heroTag, child: Center(
bvid: widget.bvid, child: CircularProgressIndicator(),
),
),
); );
} }
}, },
@ -109,14 +108,12 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
} }
class VideoInfo extends StatefulWidget { class VideoInfo extends StatefulWidget {
final bool loadingStatus;
final VideoDetailData? videoDetail; final VideoDetailData? videoDetail;
final String? heroTag; final String? heroTag;
final String bvid; final String bvid;
const VideoInfo({ const VideoInfo({
Key? key, Key? key,
this.loadingStatus = false,
this.videoDetail, this.videoDetail,
this.heroTag, this.heroTag,
required this.bvid, required this.bvid,
@ -127,18 +124,12 @@ class VideoInfo extends StatefulWidget {
} }
class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin { class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
// final String heroTag = Get.arguments['heroTag'];
late String heroTag; late String heroTag;
late final VideoIntroController videoIntroController; late final VideoIntroController videoIntroController;
late final VideoDetailController videoDetailCtr; late final VideoDetailController videoDetailCtr;
late final Map<dynamic, dynamic> videoItem;
final Box<dynamic> localCache = GStrorage.localCache; final Box<dynamic> localCache = GStrorage.localCache;
final Box<dynamic> setting = GStrorage.setting; final Box<dynamic> setting = GStrorage.setting;
late double sheetHeight; late double sheetHeight;
late final bool loadingStatus; // 加载状态
late final dynamic owner; late final dynamic owner;
late final dynamic follower; late final dynamic follower;
late final dynamic followStatus; late final dynamic followStatus;
@ -163,14 +154,10 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
videoIntroController = videoIntroController =
Get.put(VideoIntroController(bvid: widget.bvid), tag: heroTag); Get.put(VideoIntroController(bvid: widget.bvid), tag: heroTag);
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag); videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
videoItem = videoIntroController.videoItem!;
sheetHeight = localCache.get('sheetHeight'); sheetHeight = localCache.get('sheetHeight');
loadingStatus = widget.loadingStatus; owner = widget.videoDetail!.owner;
owner = loadingStatus ? videoItem['owner'] : widget.videoDetail!.owner; follower = Utils.numFormat(videoIntroController.userStat['follower']);
follower = loadingStatus
? '-'
: Utils.numFormat(videoIntroController.userStat['follower']);
followStatus = videoIntroController.followStatus; followStatus = videoIntroController.followStatus;
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true); enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
} }
@ -224,9 +211,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
// 视频介绍 // 视频介绍
showIntroDetail() { showIntroDetail() {
if (loadingStatus) {
return;
}
feedBack(); feedBack();
showBottomSheet( showBottomSheet(
context: context, context: context,
@ -240,13 +224,9 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
// 用户主页 // 用户主页
onPushMember() { onPushMember() {
feedBack(); feedBack();
mid = !loadingStatus mid = widget.videoDetail!.owner!.mid!;
? widget.videoDetail!.owner!.mid
: videoItem['owner'].mid;
memberHeroTag = Utils.makeHeroTag(mid); memberHeroTag = Utils.makeHeroTag(mid);
String face = !loadingStatus String face = widget.videoDetail!.owner!.face!;
? widget.videoDetail!.owner!.face
: videoItem['owner'].face;
Get.toNamed('/member?mid=$mid', Get.toNamed('/member?mid=$mid',
arguments: {'face': face, 'heroTag': memberHeroTag}); arguments: {'face': face, 'heroTag': memberHeroTag});
} }
@ -273,17 +253,14 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
top: 16, top: 16,
), ),
sliver: SliverToBoxAdapter( sliver: SliverToBoxAdapter(
child: !loadingStatus child: Column(
? Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
GestureDetector( GestureDetector(
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
onTap: () => showIntroDetail(), onTap: () => showIntroDetail(),
child: Text( child: Text(
!loadingStatus widget.videoDetail!.title!,
? widget.videoDetail!.title
: videoItem['title'],
style: const TextStyle( style: const TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -303,25 +280,18 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
children: [ children: [
StatView( StatView(
theme: 'gray', theme: 'gray',
view: !loadingStatus view: widget.videoDetail!.stat!.view,
? widget.videoDetail!.stat!.view
: videoItem['stat'].view,
size: 'medium', size: 'medium',
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
StatDanMu( StatDanMu(
theme: 'gray', theme: 'gray',
danmu: !loadingStatus danmu: widget.videoDetail!.stat!.danmaku,
? widget.videoDetail!.stat!.danmaku
: videoItem['stat'].danmaku,
size: 'medium', size: 'medium',
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
Text( Text(
Utils.dateFormat( Utils.dateFormat(widget.videoDetail!.pubdate,
!loadingStatus
? widget.videoDetail!.pubdate
: videoItem['pubdate'],
formatType: 'detail'), formatType: 'detail'),
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
@ -349,33 +319,21 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
top: 6, top: 6,
child: GestureDetector( child: GestureDetector(
onTap: () async { onTap: () async {
final res = final res = await videoIntroController.aiConclusion();
await videoIntroController.aiConclusion();
if (res['status']) { if (res['status']) {
showAiBottomSheet(); showAiBottomSheet();
} }
}, },
child: child: Image.asset('assets/images/ai.png', height: 22),
Image.asset('assets/images/ai.png', height: 22),
), ),
) )
], ],
), ),
// 点赞收藏转发 布局样式1
// SingleChildScrollView( /// 点赞收藏转发
// padding: const EdgeInsets.only(top: 7, bottom: 7),
// scrollDirection: Axis.horizontal,
// child: actionRow(
// context,
// videoIntroController,
// videoDetailCtr,
// ),
// ),
// 点赞收藏转发 布局样式2
actionGrid(context, videoIntroController), actionGrid(context, videoIntroController),
// 合集 // 合集
if (!loadingStatus && if (widget.videoDetail!.ugcSeason != null) ...[
widget.videoDetail!.ugcSeason != null) ...[
Obx( Obx(
() => SeasonPanel( () => SeasonPanel(
ugcSeason: widget.videoDetail!.ugcSeason!, ugcSeason: widget.videoDetail!.ugcSeason!,
@ -383,43 +341,37 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
? videoIntroController.lastPlayCid.value ? videoIntroController.lastPlayCid.value
: widget.videoDetail!.pages!.first.cid, : widget.videoDetail!.pages!.first.cid,
sheetHeight: sheetHeight, sheetHeight: sheetHeight,
changeFuc: (bvid, cid, aid) => videoIntroController changeFuc: (bvid, cid, aid) =>
.changeSeasonOrbangu(bvid, cid, aid), videoIntroController.changeSeasonOrbangu(bvid, cid, aid),
), ),
) )
], ],
if (!loadingStatus && if (widget.videoDetail!.pages != null &&
widget.videoDetail!.pages != null &&
widget.videoDetail!.pages!.length > 1) ...[ widget.videoDetail!.pages!.length > 1) ...[
Obx(() => PagesPanel( Obx(() => PagesPanel(
pages: widget.videoDetail!.pages!, pages: widget.videoDetail!.pages!,
cid: videoIntroController.lastPlayCid.value, cid: videoIntroController.lastPlayCid.value,
sheetHeight: sheetHeight, sheetHeight: sheetHeight,
changeFuc: (cid) => changeFuc: (cid) => videoIntroController.changeSeasonOrbangu(
videoIntroController.changeSeasonOrbangu(
videoIntroController.bvid, cid, null), videoIntroController.bvid, cid, null),
)) ))
], ],
GestureDetector( GestureDetector(
onTap: onPushMember, onTap: onPushMember,
child: Container( child: Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 4),
vertical: 12, horizontal: 4),
child: Row( child: Row(
children: [ children: [
NetworkImgLayer( NetworkImgLayer(
type: 'avatar', type: 'avatar',
src: loadingStatus src: widget.videoDetail!.owner!.face,
? owner.face
: widget.videoDetail!.owner!.face,
width: 34, width: 34,
height: 34, height: 34,
fadeInDuration: Duration.zero, fadeInDuration: Duration.zero,
fadeOutDuration: Duration.zero, fadeOutDuration: Duration.zero,
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
Text(owner.name, Text(owner.name, style: const TextStyle(fontSize: 13)),
style: const TextStyle(fontSize: 13)),
const SizedBox(width: 6), const SizedBox(width: 6),
Text( Text(
follower, follower,
@ -430,20 +382,16 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
), ),
const Spacer(), const Spacer(),
Obx(() => AnimatedOpacity( Obx(() => AnimatedOpacity(
opacity: loadingStatus || opacity:
videoIntroController videoIntroController.followStatus.isEmpty ? 0 : 1,
.followStatus.isEmpty
? 0
: 1,
duration: const Duration(milliseconds: 50), duration: const Duration(milliseconds: 50),
child: SizedBox( child: SizedBox(
height: 32, height: 32,
child: Obx( child: Obx(
() => videoIntroController () => videoIntroController.followStatus.isNotEmpty
.followStatus.isNotEmpty
? TextButton( ? TextButton(
onPressed: videoIntroController onPressed:
.actionRelationMod, videoIntroController.actionRelationMod,
style: TextButton.styleFrom( style: TextButton.styleFrom(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 8, right: 8), left: 8, right: 8),
@ -453,8 +401,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
: t.colorScheme.onPrimary, : t.colorScheme.onPrimary,
backgroundColor: backgroundColor:
followStatus['attribute'] != 0 followStatus['attribute'] != 0
? t.colorScheme ? t.colorScheme.onInverseSurface
.onInverseSurface
: t.colorScheme : t.colorScheme
.primary, // 设置按钮背景色 .primary, // 设置按钮背景色
), ),
@ -463,13 +410,13 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
? '已关注' ? '已关注'
: '关注', : '关注',
style: TextStyle( style: TextStyle(
fontSize: t.textTheme fontSize: t
.labelMedium!.fontSize), .textTheme.labelMedium!.fontSize),
), ),
) )
: ElevatedButton( : ElevatedButton(
onPressed: videoIntroController onPressed:
.actionRelationMod, videoIntroController.actionRelationMod,
child: const Text('关注'), child: const Text('关注'),
), ),
), ),
@ -480,14 +427,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
), ),
), ),
], ],
) )),
: const SizedBox(
height: 100,
child: Center(
child: CircularProgressIndicator(),
),
),
),
); );
} }
@ -509,10 +449,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp), selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
onTap: handleState(videoIntroController.actionLikeVideo), onTap: handleState(videoIntroController.actionLikeVideo),
selectStatus: videoIntroController.hasLike.value, selectStatus: videoIntroController.hasLike.value,
loadingStatus: loadingStatus, text: widget.videoDetail!.stat!.like!.toString()),
text: !loadingStatus
? widget.videoDetail!.stat!.like!.toString()
: '-'),
), ),
// ActionItem( // ActionItem(
// icon: const Icon(FontAwesomeIcons.clock), // icon: const Icon(FontAwesomeIcons.clock),
@ -526,10 +463,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
selectIcon: const Icon(FontAwesomeIcons.b), selectIcon: const Icon(FontAwesomeIcons.b),
onTap: handleState(videoIntroController.actionCoinVideo), onTap: handleState(videoIntroController.actionCoinVideo),
selectStatus: videoIntroController.hasCoin.value, selectStatus: videoIntroController.hasCoin.value,
loadingStatus: loadingStatus, text: widget.videoDetail!.stat!.coin!.toString(),
text: !loadingStatus ),
? widget.videoDetail!.stat!.coin!.toString()
: '-'),
), ),
Obx( Obx(
() => ActionItem( () => ActionItem(
@ -538,88 +473,24 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
onTap: () => showFavBottomSheet(), onTap: () => showFavBottomSheet(),
onLongPress: () => showFavBottomSheet(type: 'longPress'), onLongPress: () => showFavBottomSheet(type: 'longPress'),
selectStatus: videoIntroController.hasFav.value, selectStatus: videoIntroController.hasFav.value,
loadingStatus: loadingStatus, text: widget.videoDetail!.stat!.favorite!.toString(),
text: !loadingStatus ),
? widget.videoDetail!.stat!.favorite!.toString()
: '-'),
), ),
ActionItem( ActionItem(
icon: const Icon(FontAwesomeIcons.comment), icon: const Icon(FontAwesomeIcons.comment),
onTap: () => videoDetailCtr.tabCtr.animateTo(1), onTap: () => videoDetailCtr.tabCtr.animateTo(1),
selectStatus: false, selectStatus: false,
loadingStatus: loadingStatus, text: widget.videoDetail!.stat!.reply!.toString(),
text: !loadingStatus ),
? widget.videoDetail!.stat!.reply!.toString()
: '评论'),
ActionItem( ActionItem(
icon: const Icon(FontAwesomeIcons.shareFromSquare), icon: const Icon(FontAwesomeIcons.shareFromSquare),
onTap: () => videoIntroController.actionShareVideo(), onTap: () => videoIntroController.actionShareVideo(),
selectStatus: false, selectStatus: false,
loadingStatus: loadingStatus, text: '分享',
text: '分享'), ),
], ],
), ),
); );
}); });
} }
Widget actionRow(BuildContext context, videoIntroController, videoDetailCtr) {
return Row(children: <Widget>[
Obx(
() => ActionRowItem(
icon: const Icon(FontAwesomeIcons.thumbsUp),
onTap: handleState(videoIntroController.actionLikeVideo),
selectStatus: videoIntroController.hasLike.value,
loadingStatus: loadingStatus,
text:
!loadingStatus ? widget.videoDetail!.stat!.like!.toString() : '-',
),
),
const SizedBox(width: 8),
Obx(
() => ActionRowItem(
icon: const Icon(FontAwesomeIcons.b),
onTap: handleState(videoIntroController.actionCoinVideo),
selectStatus: videoIntroController.hasCoin.value,
loadingStatus: loadingStatus,
text:
!loadingStatus ? widget.videoDetail!.stat!.coin!.toString() : '-',
),
),
const SizedBox(width: 8),
Obx(
() => ActionRowItem(
icon: const Icon(FontAwesomeIcons.heart),
onTap: () => showFavBottomSheet(),
onLongPress: () => showFavBottomSheet(type: 'longPress'),
selectStatus: videoIntroController.hasFav.value,
loadingStatus: loadingStatus,
text: !loadingStatus
? widget.videoDetail!.stat!.favorite!.toString()
: '-',
),
),
const SizedBox(width: 8),
ActionRowItem(
icon: const Icon(FontAwesomeIcons.comment),
onTap: () {
videoDetailCtr.tabCtr.animateTo(1);
},
selectStatus: false,
loadingStatus: loadingStatus,
text:
!loadingStatus ? widget.videoDetail!.stat!.reply!.toString() : '-',
),
const SizedBox(width: 8),
ActionRowItem(
icon: const Icon(FontAwesomeIcons.share),
onTap: () => videoIntroController.actionShareVideo(),
selectStatus: false,
loadingStatus: loadingStatus,
// text: !loadingStatus
// ? widget.videoDetail!.stat!.share!.toString()
// : '-',
text: '转发'),
]);
}
} }

View File

@ -7,7 +7,6 @@ class ActionItem extends StatelessWidget {
final Icon? selectIcon; final Icon? selectIcon;
final Function? onTap; final Function? onTap;
final Function? onLongPress; final Function? onLongPress;
final bool? loadingStatus;
final String? text; final String? text;
final bool selectStatus; final bool selectStatus;
@ -17,7 +16,6 @@ class ActionItem extends StatelessWidget {
this.selectIcon, this.selectIcon,
this.onTap, this.onTap,
this.onLongPress, this.onLongPress,
this.loadingStatus,
this.text, this.text,
this.selectStatus = false, this.selectStatus = false,
}) : super(key: key); }) : super(key: key);
@ -43,25 +41,15 @@ class ActionItem extends StatelessWidget {
: Icon(icon!.icon!, : Icon(icon!.icon!,
size: 18, color: Theme.of(context).colorScheme.outline), size: 18, color: Theme.of(context).colorScheme.outline),
const SizedBox(height: 6), const SizedBox(height: 6),
AnimatedOpacity( Text(
opacity: loadingStatus! ? 0 : 1,
duration: const Duration(milliseconds: 200),
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 300),
transitionBuilder: (Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child);
},
child: Text(
text ?? '', text ?? '',
key: ValueKey<String>(text ?? ''),
style: TextStyle( style: TextStyle(
color: selectStatus color: selectStatus
? Theme.of(context).colorScheme.primary ? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline, : Theme.of(context).colorScheme.outline,
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize), fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
),
),
), ),
)
], ],
), ),
); );

View File

@ -161,9 +161,9 @@ class _SeasonPanelState extends State<SeasonPanel> {
Expanded( Expanded(
child: Material( child: Material(
child: ScrollablePositionedList.builder( child: ScrollablePositionedList.builder(
itemCount: episodes.length, itemCount: episodes.length + 1,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
bool isLastItem = index == episodes.length - 1; bool isLastItem = index == episodes.length;
bool isCurrentIndex = currentIndex == index; bool isCurrentIndex = currentIndex == index;
return isLastItem return isLastItem
? SizedBox( ? SizedBox(

View File

@ -194,6 +194,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
floating.toggleAutoPip(autoEnter: false); floating.toggleAutoPip(autoEnter: false);
floating.dispose(); floating.dispose();
} }
appbarStream.close();
super.dispose(); super.dispose();
} }
@ -318,18 +319,31 @@ class _VideoDetailPageState extends State<VideoDetailPage>
), ),
), ),
), ),
child: Material(
child: Row( child: Row(
children: [ children: [
const SizedBox(width: 20), Flexible(
Expanded( flex: 1,
child: TabBar( child: Obx(
() => TabBar(
padding: EdgeInsets.zero,
controller: vdCtr.tabCtr, controller: vdCtr.tabCtr,
labelStyle: const TextStyle(fontSize: 13),
labelPadding:
const EdgeInsets.symmetric(horizontal: 10.0), // 设置每个标签的宽度
dividerColor: Colors.transparent, dividerColor: Colors.transparent,
tabs: vdCtr.tabs.map((String name) => Tab(text: name)).toList(), tabs: vdCtr.tabs
.map(
(String name) => Flexible(
child: Tab(text: name),
),
)
.toList(),
), ),
), ),
SizedBox( ),
width: 220, Flexible(
flex: 1,
child: Center( child: Center(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@ -341,7 +355,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
padding: MaterialStateProperty.all(EdgeInsets.zero), padding: MaterialStateProperty.all(EdgeInsets.zero),
), ),
onPressed: () => vdCtr.showShootDanmakuSheet(), onPressed: () => vdCtr.showShootDanmakuSheet(),
child: const Text('发弹幕', style: TextStyle(fontSize: 12)), child:
const Text('发弹幕', style: TextStyle(fontSize: 12)),
), ),
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
@ -354,13 +369,15 @@ class _VideoDetailPageState extends State<VideoDetailPage>
), ),
onPressed: () { onPressed: () {
plPlayerController?.isOpenDanmu.value = plPlayerController?.isOpenDanmu.value =
!(plPlayerController?.isOpenDanmu.value ?? false); !(plPlayerController?.isOpenDanmu.value ??
false);
}, },
child: Obx(() => Text( child: Obx(() => Text(
'', '',
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: (plPlayerController?.isOpenDanmu.value ?? color: (plPlayerController
?.isOpenDanmu.value ??
false) false)
? Theme.of(context).colorScheme.primary ? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline, : Theme.of(context).colorScheme.outline,
@ -371,10 +388,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
const SizedBox(width: 14), const SizedBox(width: 14),
], ],
), ),
), )),
),
], ],
), ),
),
); );
/// 手动播放 /// 手动播放

View File

@ -180,7 +180,8 @@ class _WhisperPageState extends State<WhisperPage> {
sessionList[i] sessionList[i]
.lastMsg .lastMsg
.content[ .content[
'reply_content']) 'reply_content'] ??
'不支持的消息类型')
: '不支持的消息类型', : '不支持的消息类型',
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,

View File

@ -0,0 +1,10 @@
enum BottomControlType {
pre,
playOrPause,
next,
time,
space,
fit,
speed,
fullscreen,
}

View File

@ -1,6 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:audio_video_progress_bar/audio_video_progress_bar.dart'; import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
import 'package:easy_debounce/easy_throttle.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_volume_controller/flutter_volume_controller.dart'; import 'package:flutter_volume_controller/flutter_volume_controller.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@ -8,7 +9,6 @@ import 'package:get/get.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:media_kit/media_kit.dart'; import 'package:media_kit/media_kit.dart';
import 'package:media_kit_video/media_kit_video.dart'; import 'package:media_kit_video/media_kit_video.dart';
import 'package:nil/nil.dart';
import 'package:pilipala/models/common/gesture_mode.dart'; import 'package:pilipala/models/common/gesture_mode.dart';
import 'package:pilipala/plugin/pl_player/controller.dart'; import 'package:pilipala/plugin/pl_player/controller.dart';
import 'package:pilipala/plugin/pl_player/models/duration.dart'; import 'package:pilipala/plugin/pl_player/models/duration.dart';
@ -19,12 +19,14 @@ import 'package:pilipala/utils/storage.dart';
import 'package:screen_brightness/screen_brightness.dart'; import 'package:screen_brightness/screen_brightness.dart';
import '../../utils/global_data.dart'; import '../../utils/global_data.dart';
import 'models/bottom_control_type.dart';
import 'models/bottom_progress_behavior.dart'; import 'models/bottom_progress_behavior.dart';
import 'widgets/app_bar_ani.dart'; import 'widgets/app_bar_ani.dart';
import 'widgets/backward_seek.dart'; import 'widgets/backward_seek.dart';
import 'widgets/bottom_control.dart'; import 'widgets/bottom_control.dart';
import 'widgets/common_btn.dart'; import 'widgets/common_btn.dart';
import 'widgets/forward_seek.dart'; import 'widgets/forward_seek.dart';
import 'widgets/play_pause_btn.dart';
class PLVideoPlayer extends StatefulWidget { class PLVideoPlayer extends StatefulWidget {
const PLVideoPlayer({ const PLVideoPlayer({
@ -32,6 +34,7 @@ class PLVideoPlayer extends StatefulWidget {
this.headerControl, this.headerControl,
this.bottomControl, this.bottomControl,
this.danmuWidget, this.danmuWidget,
this.bottomList,
super.key, super.key,
}); });
@ -39,6 +42,7 @@ class PLVideoPlayer extends StatefulWidget {
final PreferredSizeWidget? headerControl; final PreferredSizeWidget? headerControl;
final PreferredSizeWidget? bottomControl; final PreferredSizeWidget? bottomControl;
final Widget? danmuWidget; final Widget? danmuWidget;
final List<BottomControlType>? bottomList;
@override @override
State<PLVideoPlayer> createState() => _PLVideoPlayerState(); State<PLVideoPlayer> createState() => _PLVideoPlayerState();
@ -48,26 +52,22 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
with TickerProviderStateMixin { with TickerProviderStateMixin {
late AnimationController animationController; late AnimationController animationController;
late VideoController videoController; late VideoController videoController;
final PLVideoPlayerController _ctr = Get.put(PLVideoPlayerController());
// bool _mountSeekBackwardButton = false; final RxBool _mountSeekBackwardButton = false.obs;
// bool _mountSeekForwardButton = false; final RxBool _mountSeekForwardButton = false.obs;
// bool _hideSeekBackwardButton = false; final RxBool _hideSeekBackwardButton = false.obs;
// bool _hideSeekForwardButton = false; final RxBool _hideSeekForwardButton = false.obs;
// double _brightnessValue = 0.0; final RxDouble _brightnessValue = 0.0.obs;
// bool _brightnessIndicator = false; final RxBool _brightnessIndicator = false.obs;
Timer? _brightnessTimer; Timer? _brightnessTimer;
// double _volumeValue = 0.0; final RxDouble _volumeValue = 0.0.obs;
// bool _volumeIndicator = false; final RxBool _volumeIndicator = false.obs;
Timer? _volumeTimer; Timer? _volumeTimer;
double _distance = 0.0; final RxDouble _distance = 0.0.obs;
// 初始手指落下位置 final RxBool _volumeInterceptEventStream = false.obs;
// double _initTapPositoin = 0.0;
// bool _volumeInterceptEventStream = false;
Box setting = GStrorage.setting; Box setting = GStrorage.setting;
late FullScreenMode mode; late FullScreenMode mode;
@ -82,11 +82,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
DateTime? lastFullScreenToggleTime; DateTime? lastFullScreenToggleTime;
void onDoubleTapSeekBackward() { void onDoubleTapSeekBackward() {
_ctr.onDoubleTapSeekBackward(); _mountSeekBackwardButton.value = true;
} }
void onDoubleTapSeekForward() { void onDoubleTapSeekForward() {
_ctr.onDoubleTapSeekForward(); _mountSeekForwardButton.value = true;
} }
// 双击播放、暂停 // 双击播放、暂停
@ -138,10 +138,10 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
Future.microtask(() async { Future.microtask(() async {
try { try {
FlutterVolumeController.updateShowSystemUI(true); FlutterVolumeController.updateShowSystemUI(true);
_ctr.volumeValue.value = (await FlutterVolumeController.getVolume())!; _volumeValue.value = (await FlutterVolumeController.getVolume())!;
FlutterVolumeController.addListener((double value) { FlutterVolumeController.addListener((double value) {
if (mounted && !_ctr.volumeInterceptEventStream.value) { if (mounted && !_volumeInterceptEventStream.value) {
_ctr.volumeValue.value = value; _volumeValue.value = value;
} }
}); });
} catch (_) {} } catch (_) {}
@ -149,10 +149,10 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
Future.microtask(() async { Future.microtask(() async {
try { try {
_ctr.brightnessValue.value = await ScreenBrightness().current; _brightnessValue.value = await ScreenBrightness().current;
ScreenBrightness().onCurrentBrightnessChanged.listen((double value) { ScreenBrightness().onCurrentBrightnessChanged.listen((double value) {
if (mounted) { if (mounted) {
_ctr.brightnessValue.value = value; _brightnessValue.value = value;
} }
}); });
} catch (_) {} } catch (_) {}
@ -164,14 +164,14 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
FlutterVolumeController.updateShowSystemUI(false); FlutterVolumeController.updateShowSystemUI(false);
await FlutterVolumeController.setVolume(value); await FlutterVolumeController.setVolume(value);
} catch (_) {} } catch (_) {}
_ctr.volumeValue.value = value; _volumeValue.value = value;
_ctr.volumeIndicator.value = true; _volumeIndicator.value = true;
_ctr.volumeInterceptEventStream.value = true; _volumeInterceptEventStream.value = true;
_volumeTimer?.cancel(); _volumeTimer?.cancel();
_volumeTimer = Timer(const Duration(milliseconds: 200), () { _volumeTimer = Timer(const Duration(milliseconds: 200), () {
if (mounted) { if (mounted) {
_ctr.volumeIndicator.value = false; _volumeIndicator.value = false;
_ctr.volumeInterceptEventStream.value = false; _volumeInterceptEventStream.value = false;
} }
}); });
} }
@ -180,11 +180,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
try { try {
await ScreenBrightness().setScreenBrightness(value); await ScreenBrightness().setScreenBrightness(value);
} catch (_) {} } catch (_) {}
_ctr.brightnessIndicator.value = true; _brightnessIndicator.value = true;
_brightnessTimer?.cancel(); _brightnessTimer?.cancel();
_brightnessTimer = Timer(const Duration(milliseconds: 200), () { _brightnessTimer = Timer(const Duration(milliseconds: 200), () {
if (mounted) { if (mounted) {
_ctr.brightnessIndicator.value = false; _brightnessIndicator.value = false;
} }
}); });
widget.controller.brightness.value = value; widget.controller.brightness.value = value;
@ -197,6 +197,134 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
super.dispose(); super.dispose();
} }
// 动态构建底部控制条
List<Widget> buildBottomControl() {
const TextStyle textStyle = TextStyle(
color: Colors.white,
fontSize: 12,
);
final PlPlayerController _ = widget.controller;
Map<BottomControlType, Widget> videoProgressWidgets = {
/// 上一集
BottomControlType.pre: ComBtn(
icon: const Icon(
Icons.skip_previous_outlined,
size: 15,
color: Colors.white,
),
fuc: () {},
),
/// 播放暂停
BottomControlType.playOrPause: PlayOrPauseButton(
controller: _,
),
/// 下一集
BottomControlType.next: ComBtn(
icon: const Icon(
Icons.last_page_outlined,
size: 15,
color: Colors.white,
),
fuc: () {},
),
/// 时间进度
BottomControlType.time: Row(
children: [
Obx(() {
return Text(
_.durationSeconds.value >= 3600
? printDurationWithHours(
Duration(seconds: _.positionSeconds.value))
: printDuration(Duration(seconds: _.positionSeconds.value)),
style: textStyle,
);
}),
const SizedBox(width: 2),
const Text('/', style: textStyle),
const SizedBox(width: 2),
Obx(
() => Text(
_.durationSeconds.value >= 3600
? printDurationWithHours(
Duration(seconds: _.durationSeconds.value))
: printDuration(Duration(seconds: _.durationSeconds.value)),
style: textStyle,
),
),
],
),
/// 空白占位
BottomControlType.space: const Spacer(),
/// 画面比例
BottomControlType.fit: SizedBox(
height: 30,
child: TextButton(
onPressed: () => _.toggleVideoFit(),
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
child: Obx(
() => Text(
_.videoFitDEsc.value,
style: const TextStyle(color: Colors.white, fontSize: 13),
),
),
),
),
/// 播放速度
BottomControlType.speed: SizedBox(
width: 45,
height: 34,
child: TextButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
onPressed: () {},
child: Obx(
() => Text(
'${_.playbackSpeed.toString()}X',
style: textStyle,
),
),
),
),
/// 字幕
/// 全屏
BottomControlType.fullscreen: ComBtn(
icon: Obx(
() => Icon(
_.isFullScreen.value
? FontAwesomeIcons.compress
: FontAwesomeIcons.expand,
size: 15,
color: Colors.white,
),
),
fuc: () => _.triggerFullScreen(),
),
};
final List<Widget> list = [];
var userSpecifyItem = widget.bottomList ??
[
BottomControlType.playOrPause,
BottomControlType.time,
BottomControlType.space,
BottomControlType.fit,
BottomControlType.fullscreen,
];
for (var i = 0; i < userSpecifyItem.length; i++) {
list.add(videoProgressWidgets[userSpecifyItem[i]]!);
}
return list;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final PlPlayerController _ = widget.controller; final PlPlayerController _ = widget.controller;
@ -219,6 +347,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
children: <Widget>[ children: <Widget>[
Obx( Obx(
() => Video( () => Video(
key: ValueKey(_.videoFit.value),
controller: videoController, controller: videoController,
controls: NoVideoControls, controls: NoVideoControls,
pauseUponEnteringBackgroundMode: !enableBackgroundPlay, pauseUponEnteringBackgroundMode: !enableBackgroundPlay,
@ -316,7 +445,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
() => Align( () => Align(
child: AnimatedOpacity( child: AnimatedOpacity(
curve: Curves.easeInOut, curve: Curves.easeInOut,
opacity: _ctr.volumeIndicator.value ? 1.0 : 0.0, opacity: _volumeIndicator.value ? 1.0 : 0.0,
duration: const Duration(milliseconds: 150), duration: const Duration(milliseconds: 150),
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
@ -335,9 +464,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
width: 28.0, width: 28.0,
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Icon( child: Icon(
_ctr.volumeValue.value == 0.0 _volumeValue.value == 0.0
? Icons.volume_off ? Icons.volume_off
: _ctr.volumeValue.value < 0.5 : _volumeValue.value < 0.5
? Icons.volume_down ? Icons.volume_down
: Icons.volume_up, : Icons.volume_up,
color: const Color(0xFFFFFFFF), color: const Color(0xFFFFFFFF),
@ -346,7 +475,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
), ),
Expanded( Expanded(
child: Text( child: Text(
'${(_ctr.volumeValue.value * 100.0).round()}%', '${(_volumeValue.value * 100.0).round()}%',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: const TextStyle(
fontSize: 13.0, fontSize: 13.0,
@ -367,7 +496,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
() => Align( () => Align(
child: AnimatedOpacity( child: AnimatedOpacity(
curve: Curves.easeInOut, curve: Curves.easeInOut,
opacity: _ctr.brightnessIndicator.value ? 1.0 : 0.0, opacity: _brightnessIndicator.value ? 1.0 : 0.0,
duration: const Duration(milliseconds: 150), duration: const Duration(milliseconds: 150),
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
@ -386,9 +515,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
width: 28.0, width: 28.0,
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Icon( child: Icon(
_ctr.brightnessValue.value < 1.0 / 3.0 _brightnessValue.value < 1.0 / 3.0
? Icons.brightness_low ? Icons.brightness_low
: _ctr.brightnessValue.value < 2.0 / 3.0 : _brightnessValue.value < 2.0 / 3.0
? Icons.brightness_medium ? Icons.brightness_medium
: Icons.brightness_high, : Icons.brightness_high,
color: const Color(0xFFFFFFFF), color: const Color(0xFFFFFFFF),
@ -398,7 +527,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
const SizedBox(width: 2.0), const SizedBox(width: 2.0),
Expanded( Expanded(
child: Text( child: Text(
'${(_ctr.brightnessValue.value * 100.0).round()}%', '${(_brightnessValue.value * 100.0).round()}%',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: const TextStyle(
fontSize: 13.0, fontSize: 13.0,
@ -489,7 +618,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
pos.clamp(Duration.zero, _.duration.value); pos.clamp(Duration.zero, _.duration.value);
_.onUpdatedSliderProgress(result); _.onUpdatedSliderProgress(result);
_.onChangedSliderStart(); _.onChangedSliderStart();
// _initTapPositoin = tapPosition;
}, },
onHorizontalDragEnd: (DragEndDetails details) { onHorizontalDragEnd: (DragEndDetails details) {
if (_.videoType.value == 'live' || _.controlsLock.value) { if (_.videoType.value == 'live' || _.controlsLock.value) {
@ -521,7 +649,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
: screenWidth * 9 / 16) * : screenWidth * 9 / 16) *
3; 3;
final double brightness = final double brightness =
_ctr.brightnessValue.value - delta / level; _brightnessValue.value - delta / level;
final double result = brightness.clamp(0.0, 1.0); final double result = brightness.clamp(0.0, 1.0);
setBrightness(result); setBrightness(result);
} else if (tapPosition < sectionWidth * 2) { } else if (tapPosition < sectionWidth * 2) {
@ -530,31 +658,34 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
const double threshold = 7.0; // 滑动阈值 const double threshold = 7.0; // 滑动阈值
final bool flag = final bool flag =
fullScreenGestureMode != FullScreenGestureMode.values.last; fullScreenGestureMode != FullScreenGestureMode.values.last;
if (dy > _distance && dy > threshold) { if (dy > _distance.value && dy > threshold) {
if (_.isFullScreen.value ^ flag) { if (_.isFullScreen.value ^ flag) {
lastFullScreenToggleTime = DateTime.now(); lastFullScreenToggleTime = DateTime.now();
// 下滑退出全屏 // 下滑退出全屏
await widget.controller.triggerFullScreen(status: flag); await widget.controller.triggerFullScreen(status: flag);
} }
_distance = 0.0; _distance.value = 0.0;
} else if (dy < _distance && dy < -threshold) { } else if (dy < _distance.value && dy < -threshold) {
if (!_.isFullScreen.value ^ flag) { if (!_.isFullScreen.value ^ flag) {
lastFullScreenToggleTime = DateTime.now(); lastFullScreenToggleTime = DateTime.now();
// 上滑进入全屏 // 上滑进入全屏
await widget.controller.triggerFullScreen(status: !flag); await widget.controller.triggerFullScreen(status: !flag);
} }
_distance = 0.0; _distance.value = 0.0;
} }
_distance = dy; _distance.value = dy;
} else { } else {
// 右边区域 👈 // 右边区域 👈
EasyThrottle.throttle(
'setVolume', const Duration(milliseconds: 20), () {
final double level = (_.isFullScreen.value final double level = (_.isFullScreen.value
? Get.size.height ? Get.size.height
: screenWidth * 9 / 16) * : screenWidth * 9 / 16);
3; final double volume = _volumeValue.value -
final double volume = _ctr.volumeValue.value - delta / level; double.parse(delta.toStringAsFixed(1)) / level;
final double result = volume.clamp(0.0, 1.0); final double result = volume.clamp(0.0, 1.0);
setVolume(result); setVolume(result);
});
} }
}, },
onVerticalDragEnd: (DragEndDetails details) {}, onVerticalDragEnd: (DragEndDetails details) {},
@ -586,8 +717,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: widget.bottomControl ?? child: widget.bottomControl ??
BottomControl( BottomControl(
controller: widget.controller, controller: widget.controller,
triggerFullScreen: triggerFullScreen: _.triggerFullScreen,
widget.controller.triggerFullScreen), buildBottomControl: buildBottomControl(),
),
), ),
), ),
], ],
@ -607,23 +739,23 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
} }
if (defaultBtmProgressBehavior == if (defaultBtmProgressBehavior ==
BtmProgresBehavior.alwaysHide.code) { BtmProgresBehavior.alwaysHide.code) {
return nil; return const SizedBox();
} }
if (defaultBtmProgressBehavior == if (defaultBtmProgressBehavior ==
BtmProgresBehavior.onlyShowFullScreen.code && BtmProgresBehavior.onlyShowFullScreen.code &&
!_.isFullScreen.value) { !_.isFullScreen.value) {
return nil; return const SizedBox();
} else if (defaultBtmProgressBehavior == } else if (defaultBtmProgressBehavior ==
BtmProgresBehavior.onlyHideFullScreen.code && BtmProgresBehavior.onlyHideFullScreen.code &&
_.isFullScreen.value) { _.isFullScreen.value) {
return nil; return const SizedBox();
} }
if (_.videoType.value == 'live') { if (_.videoType.value == 'live') {
return const SizedBox(); return const SizedBox();
} }
if (value > max || max <= 0) { if (value > max || max <= 0) {
return nil; return const SizedBox();
} }
return Positioned( return Positioned(
bottom: -1.5, bottom: -1.5,
@ -672,7 +804,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
// 锁 // 锁
Obx( Obx(
() => Visibility( () => Visibility(
visible: _.videoType.value != 'live', visible: _.videoType.value != 'live' && _.isFullScreen.value,
child: Align( child: Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: FractionalTranslation( child: FractionalTranslation(
@ -720,18 +852,17 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
/// 点击 快进/快退 /// 点击 快进/快退
Obx( Obx(
() => Visibility( () => Visibility(
visible: _ctr.mountSeekBackwardButton.value || visible:
_ctr.mountSeekForwardButton.value, _mountSeekBackwardButton.value || _mountSeekForwardButton.value,
child: Positioned.fill( child: Positioned.fill(
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: _ctr.mountSeekBackwardButton.value child: _mountSeekBackwardButton.value
? TweenAnimationBuilder<double>( ? TweenAnimationBuilder<double>(
tween: Tween<double>( tween: Tween<double>(
begin: 0.0, begin: 0.0,
end: end: _hideSeekBackwardButton.value ? 0.0 : 1.0,
_ctr.hideSeekBackwardButton.value ? 0.0 : 1.0,
), ),
duration: const Duration(milliseconds: 500), duration: const Duration(milliseconds: 500),
builder: (BuildContext context, double value, builder: (BuildContext context, double value,
@ -741,17 +872,15 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: child, child: child,
), ),
onEnd: () { onEnd: () {
if (_ctr.hideSeekBackwardButton.value) { if (_hideSeekBackwardButton.value) {
_ctr.hideSeekBackwardButton.value = false; _hideSeekBackwardButton.value = false;
_ctr.mountSeekBackwardButton.value = false; _mountSeekBackwardButton.value = false;
} }
}, },
child: BackwardSeekIndicator( child: BackwardSeekIndicator(
onChanged: (Duration value) { onChanged: (Duration value) => {},
// _seekBarDeltaValueNotifier.value = -value;
},
onSubmitted: (Duration value) { onSubmitted: (Duration value) {
_ctr.hideSeekBackwardButton.value = true; _hideSeekBackwardButton.value = true;
final Player player = final Player player =
widget.controller.videoPlayerController!; widget.controller.videoPlayerController!;
Duration result = player.state.position - value; Duration result = player.state.position - value;
@ -764,7 +893,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
}, },
), ),
) )
: nil, : const SizedBox(),
), ),
Expanded( Expanded(
child: SizedBox( child: SizedBox(
@ -772,11 +901,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
), ),
), ),
Expanded( Expanded(
child: _ctr.mountSeekForwardButton.value child: _mountSeekForwardButton.value
? TweenAnimationBuilder<double>( ? TweenAnimationBuilder<double>(
tween: Tween<double>( tween: Tween<double>(
begin: 0.0, begin: 0.0,
end: _ctr.hideSeekForwardButton.value ? 0.0 : 1.0, end: _hideSeekForwardButton.value ? 0.0 : 1.0,
), ),
duration: const Duration(milliseconds: 500), duration: const Duration(milliseconds: 500),
builder: (BuildContext context, double value, builder: (BuildContext context, double value,
@ -786,17 +915,15 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: child, child: child,
), ),
onEnd: () { onEnd: () {
if (_ctr.hideSeekForwardButton.value) { if (_hideSeekForwardButton.value) {
_ctr.hideSeekForwardButton.value = false; _hideSeekForwardButton.value = false;
_ctr.mountSeekForwardButton.value = false; _mountSeekForwardButton.value = false;
} }
}, },
child: ForwardSeekIndicator( child: ForwardSeekIndicator(
onChanged: (Duration value) { onChanged: (Duration value) => {},
// _seekBarDeltaValueNotifier.value = value;
},
onSubmitted: (Duration value) { onSubmitted: (Duration value) {
_ctr.hideSeekForwardButton.value = true; _hideSeekForwardButton.value = true;
final Player player = final Player player =
widget.controller.videoPlayerController!; widget.controller.videoPlayerController!;
Duration result = player.state.position + value; Duration result = player.state.position + value;
@ -809,7 +936,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
}, },
), ),
) )
: nil, : const SizedBox(),
), ),
], ],
), ),
@ -820,31 +947,3 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
); );
} }
} }
class PLVideoPlayerController extends GetxController {
RxBool mountSeekBackwardButton = false.obs;
RxBool mountSeekForwardButton = false.obs;
RxBool hideSeekBackwardButton = false.obs;
RxBool hideSeekForwardButton = false.obs;
RxDouble brightnessValue = 0.0.obs;
RxBool brightnessIndicator = false.obs;
RxDouble volumeValue = 0.0.obs;
RxBool volumeIndicator = false.obs;
RxDouble distance = 0.0.obs;
// 初始手指落下位置
RxDouble initTapPositoin = 0.0.obs;
RxBool volumeInterceptEventStream = false.obs;
// 双击快进 展示样式
void onDoubleTapSeekForward() {
mountSeekForwardButton.value = true;
}
void onDoubleTapSeekBackward() {
mountSeekBackwardButton.value = true;
}
}

View File

@ -1,17 +1,20 @@
import 'package:audio_video_progress_bar/audio_video_progress_bar.dart'; import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:nil/nil.dart'; import 'package:nil/nil.dart';
import 'package:pilipala/plugin/pl_player/index.dart'; import 'package:pilipala/plugin/pl_player/index.dart';
import 'package:pilipala/plugin/pl_player/widgets/play_pause_btn.dart';
import 'package:pilipala/utils/feed_back.dart'; import 'package:pilipala/utils/feed_back.dart';
class BottomControl extends StatelessWidget implements PreferredSizeWidget { class BottomControl extends StatelessWidget implements PreferredSizeWidget {
final PlPlayerController? controller; final PlPlayerController? controller;
final Function? triggerFullScreen; final Function? triggerFullScreen;
const BottomControl({this.controller, this.triggerFullScreen, Key? key}) final List<Widget>? buildBottomControl;
: super(key: key); const BottomControl({
this.controller,
this.triggerFullScreen,
this.buildBottomControl,
Key? key,
}) : super(key: key);
@override @override
Size get preferredSize => const Size(double.infinity, kToolbarHeight); Size get preferredSize => const Size(double.infinity, kToolbarHeight);
@ -20,11 +23,6 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
Color colorTheme = Theme.of(context).colorScheme.primary; Color colorTheme = Theme.of(context).colorScheme.primary;
final _ = controller!; final _ = controller!;
const textStyle = TextStyle(
color: Colors.white,
fontSize: 12,
);
return Container( return Container(
color: Colors.transparent, color: Colors.transparent,
height: 90, height: 90,
@ -71,86 +69,89 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
}, },
), ),
Row( Row(
children: [ children: [...buildBottomControl!],
PlayOrPauseButton(
controller: _,
), ),
const SizedBox(width: 4), // Row(
// 播放时间 // children: [
Obx(() { // PlayOrPauseButton(
return Text( // controller: _,
_.durationSeconds.value >= 3600
? printDurationWithHours(
Duration(seconds: _.positionSeconds.value))
: printDuration(
Duration(seconds: _.positionSeconds.value)),
style: textStyle,
);
}),
const SizedBox(width: 2),
const Text('/', style: textStyle),
const SizedBox(width: 2),
Obx(
() => Text(
_.durationSeconds.value >= 3600
? printDurationWithHours(
Duration(seconds: _.durationSeconds.value))
: printDuration(
Duration(seconds: _.durationSeconds.value)),
style: textStyle,
),
),
const Spacer(),
// 倍速
// Obx(
// () => SizedBox(
// width: 45,
// height: 34,
// child: TextButton(
// style: ButtonStyle(
// padding: MaterialStateProperty.all(EdgeInsets.zero),
// ), // ),
// onPressed: () { // const SizedBox(width: 4),
// _.togglePlaybackSpeed(); // // 播放时间
// }, // Obx(() {
// child: Text( // return Text(
// '${_.playbackSpeed.toString()}X', // _.durationSeconds.value >= 3600
// ? printDurationWithHours(
// Duration(seconds: _.positionSeconds.value))
// : printDuration(
// Duration(seconds: _.positionSeconds.value)),
// style: textStyle,
// );
// }),
// const SizedBox(width: 2),
// const Text('/', style: textStyle),
// const SizedBox(width: 2),
// Obx(
// () => Text(
// _.durationSeconds.value >= 3600
// ? printDurationWithHours(
// Duration(seconds: _.durationSeconds.value))
// : printDuration(
// Duration(seconds: _.durationSeconds.value)),
// style: textStyle, // style: textStyle,
// ), // ),
// ), // ),
// const Spacer(),
// // 倍速
// // Obx(
// // () => SizedBox(
// // width: 45,
// // height: 34,
// // child: TextButton(
// // style: ButtonStyle(
// // padding: MaterialStateProperty.all(EdgeInsets.zero),
// // ),
// // onPressed: () {
// // _.togglePlaybackSpeed();
// // },
// // child: Text(
// // '${_.playbackSpeed.toString()}X',
// // style: textStyle,
// // ),
// // ),
// // ),
// // ),
// SizedBox(
// height: 30,
// child: TextButton(
// onPressed: () => _.toggleVideoFit(),
// style: ButtonStyle(
// padding: MaterialStateProperty.all(EdgeInsets.zero),
// ),
// child: Obx(
// () => Text(
// _.videoFitDEsc.value,
// style: const TextStyle(color: Colors.white, fontSize: 13),
// ), // ),
// ), // ),
SizedBox( // ),
height: 30, // ),
child: TextButton( // const SizedBox(width: 10),
onPressed: () => _.toggleVideoFit(), // // 全屏
style: ButtonStyle( // Obx(
padding: MaterialStateProperty.all(EdgeInsets.zero), // () => ComBtn(
), // icon: Icon(
child: Obx( // _.isFullScreen.value
() => Text( // ? FontAwesomeIcons.compress
_.videoFitDEsc.value, // : FontAwesomeIcons.expand,
style: const TextStyle(color: Colors.white, fontSize: 13), // size: 15,
), // color: Colors.white,
), // ),
), // fuc: () => triggerFullScreen!(),
), // ),
const SizedBox(width: 10), // ),
// 全屏 // ],
Obx( // ),
() => ComBtn(
icon: Icon(
_.isFullScreen.value
? FontAwesomeIcons.compress
: FontAwesomeIcons.expand,
size: 15,
color: Colors.white,
),
fuc: () => triggerFullScreen!(),
),
),
],
),
const SizedBox(height: 12), const SizedBox(height: 12),
], ],
), ),

View File

@ -0,0 +1,40 @@
import 'dart:io';
import 'package:disable_battery_optimization/disable_battery_optimization.dart';
import 'package:pilipala/utils/storage.dart';
void DisableBatteryOpt() async {
if (!Platform.isAndroid) {
return;
}
// 本地缓存中读取 是否禁用了电池优化 默认未禁用
bool isDisableBatteryOptLocal =
GStrorage.localCache.get('isDisableBatteryOptLocal', defaultValue: false);
if (!isDisableBatteryOptLocal) {
final isBatteryOptimizationDisabled =
await DisableBatteryOptimization.isBatteryOptimizationDisabled;
if (isBatteryOptimizationDisabled == false) {
final hasDisabled = await DisableBatteryOptimization
.showDisableBatteryOptimizationSettings();
// 设置为已禁用
GStrorage.localCache.put('isDisableBatteryOptLocal', hasDisabled == true);
}
}
bool isManufacturerBatteryOptimizationDisabled = GStrorage.localCache
.get('isManufacturerBatteryOptimizationDisabled', defaultValue: false);
if (!isManufacturerBatteryOptimizationDisabled) {
final isManBatteryOptimizationDisabled = await DisableBatteryOptimization
.isManufacturerBatteryOptimizationDisabled;
if (isManBatteryOptimizationDisabled == false) {
final hasDisabled = await DisableBatteryOptimization
.showDisableManufacturerBatteryOptimizationSettings(
"当前设备可能有额外的电池优化",
"按照步骤操作以禁用电池优化,以保证应用在后台正常运行",
);
// 设置为已禁用
GStrorage.localCache.put(
'isManufacturerBatteryOptimizationDisabled', hasDisabled == true);
}
}
}

26
lib/services/sentry.dart Normal file
View File

@ -0,0 +1,26 @@
import 'package:sentry_flutter/sentry_flutter.dart';
class SentryService {
static sentryInit(AppRunner appRunner) async {
return await SentryFlutter.init(
(options) => options
..dsn =
'https://cb0ce70fcda1c903072a6c73cc2d89e2@o4506669621182464.ingest.sentry.io/4506669624459264'
..debug = true // 调试模式下启用
..attachThreads = true // 附带线程信息
..sendDefaultPii = true
..reportPackages = false // 禁用报告包信息
..tracesSampleRate = 0.1 // 要发送的事件百分比
..attachScreenshot = false // 屏幕截图
..attachViewHierarchy = true // 包含视图结构
..reportSilentFlutterErrors = true // 报告静默的 Flutter 错误
..enableAutoPerformanceTracing = true // 自动性能跟踪
..considerInAppFramesByDefault = false // 不考虑应用内帧
..enableWindowMetricBreadcrumbs = true // 启用窗口度量面包屑
..screenshotQuality = SentryScreenshotQuality.low // 屏幕截图质量
..maxRequestBodySize = MaxRequestBodySize.small // 请求体大小
..maxResponseBodySize = MaxResponseBodySize.small, // 响应体大小
appRunner: appRunner,
);
}
}

View File

@ -1,40 +1,94 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:saver_gallery/saver_gallery.dart'; import 'package:saver_gallery/saver_gallery.dart';
class DownloadUtils { class DownloadUtils {
// 获取存储权限 // 获取存储权限
static requestStoragePer() async { static Future<bool> requestStoragePer() async {
Map<Permission, PermissionStatus> statuses = await [ await Permission.storage.request();
Permission.storage, PermissionStatus status = await Permission.storage.status;
Permission.photos, if (status == PermissionStatus.denied ||
].request(); status == PermissionStatus.permanentlyDenied) {
statuses[Permission.storage].toString(); 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;
}
}
// 获取相册权限
static Future<bool> requestPhotoPer() async {
await Permission.photos.request();
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;
}
} }
static Future<bool> downloadImg(String imgUrl, static Future<bool> downloadImg(String imgUrl,
{String imgType = 'cover'}) async { {String imgType = 'cover'}) async {
try { try {
await requestStoragePer(); if (!await requestPhotoPer()) {
return false;
}
SmartDialog.showLoading(msg: '保存中'); SmartDialog.showLoading(msg: '保存中');
var response = await Dio() var response = await Dio()
.get(imgUrl, options: Options(responseType: ResponseType.bytes)); .get(imgUrl, options: Options(responseType: ResponseType.bytes));
final String imgSuffix = imgUrl.split('.').last;
String picName = String picName =
"plpl_${imgType}_${DateTime.now().toString().split('-').join()}"; "plpl_${imgType}_${DateTime.now().toString().replaceAll(RegExp(r'[- :]'), '').split('.').first}";
final SaveResult result = await SaverGallery.saveImage( final SaveResult result = await SaverGallery.saveImage(
Uint8List.fromList(response.data), Uint8List.fromList(response.data),
quality: 60, name: '$picName.$imgSuffix',
name: picName,
// 保存到 PiliPala文件夹 // 保存到 PiliPala文件夹
androidRelativePath: "Pictures/PiliPala", androidRelativePath: "Pictures/PiliPala",
androidExistNotSave: false, androidExistNotSave: false,
); );
SmartDialog.dismiss(); SmartDialog.dismiss();
if (result.isSuccess) { if (result.isSuccess) {
await SmartDialog.showToast('$picName」已保存 '); await SmartDialog.showToast('${'$picName.$imgSuffix'}」已保存 ');
} }
return true; return true;
} catch (err) { } catch (err) {

View File

@ -84,6 +84,7 @@ class SettingBoxKey {
autoUpgradeEnable = 'autoUpgradeEnable', autoUpgradeEnable = 'autoUpgradeEnable',
feedBackEnable = 'feedBackEnable', feedBackEnable = 'feedBackEnable',
defaultVideoQa = 'defaultVideoQa', defaultVideoQa = 'defaultVideoQa',
defaultLiveQa = 'defaultLiveQa',
defaultAudioQa = 'defaultAudioQa', defaultAudioQa = 'defaultAudioQa',
autoPlayEnable = 'autoPlayEnable', autoPlayEnable = 'autoPlayEnable',
fullScreenMode = 'fullScreenMode', fullScreenMode = 'fullScreenMode',
@ -171,6 +172,10 @@ class LocalCacheKey {
// 代理host port // 代理host port
systemProxyHost = 'systemProxyHost', systemProxyHost = 'systemProxyHost',
systemProxyPort = 'systemProxyPort'; systemProxyPort = 'systemProxyPort';
static const String isDisableBatteryOptLocal = 'isDisableBatteryOptLocal',
isManufacturerBatteryOptimizationDisabled =
'isManufacturerBatteryOptimizationDisabled';
} }
class VideoBoxKey { class VideoBoxKey {

View File

@ -10,6 +10,7 @@
#include <flutter_volume_controller/flutter_volume_controller_plugin.h> #include <flutter_volume_controller/flutter_volume_controller_plugin.h>
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h> #include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
#include <media_kit_video/media_kit_video_plugin.h> #include <media_kit_video/media_kit_video_plugin.h>
#include <sentry_flutter/sentry_flutter_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
@ -25,6 +26,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) media_kit_video_registrar = g_autoptr(FlPluginRegistrar) media_kit_video_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin");
media_kit_video_plugin_register_with_registrar(media_kit_video_registrar); media_kit_video_plugin_register_with_registrar(media_kit_video_registrar);
g_autoptr(FlPluginRegistrar) sentry_flutter_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SentryFlutterPlugin");
sentry_flutter_plugin_register_with_registrar(sentry_flutter_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

View File

@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
flutter_volume_controller flutter_volume_controller
media_kit_libs_linux media_kit_libs_linux
media_kit_video media_kit_video
sentry_flutter
url_launcher_linux url_launcher_linux
) )

View File

@ -16,6 +16,7 @@ import media_kit_video
import package_info_plus import package_info_plus
import path_provider_foundation import path_provider_foundation
import screen_brightness_macos import screen_brightness_macos
import sentry_flutter
import share_plus import share_plus
import sqflite import sqflite
import url_launcher_macos import url_launcher_macos
@ -33,6 +34,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin")) ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin"))
SentryFlutterPlugin.register(with: registry.registrar(forPlugin: "SentryFlutterPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))

View File

@ -393,6 +393,14 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
disable_battery_optimization:
dependency: "direct main"
description:
name: disable_battery_optimization
sha256: "6b2ba802f984af141faf1b6b5fb956d5ef01f9cd555597c35b9cc335a03185ba"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
dismissible_page: dismissible_page:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1259,10 +1267,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: sentry name: sentry
sha256: "5686ed515bb620dc52b4ae99a6586fe720d443591183cf1f620ec5d1f0eec100" sha256: a7946f4a90b0feb47214981d881b98149e05f6c576da9f2a2f33945bf561de25
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "7.15.0" version: "7.16.0"
sentry_flutter:
dependency: "direct main"
description:
name: sentry_flutter
sha256: "6db7fa1b076faf2f5dd77d8cc9ef206171f32a290cc638842d78e5d62b441a27"
url: "https://pub.flutter-io.cn"
source: hosted
version: "7.16.0"
share_plus: share_plus:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -140,6 +140,9 @@ dependencies:
catcher_2: ^1.1.0 catcher_2: ^1.1.0
logger: ^2.0.2+1 logger: ^2.0.2+1
path: 1.8.3 path: 1.8.3
# 电池优化
disable_battery_optimization: ^1.1.1
sentry_flutter: ^7.16.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

View File

@ -13,6 +13,7 @@
#include <media_kit_video/media_kit_video_plugin_c_api.h> #include <media_kit_video/media_kit_video_plugin_c_api.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h> #include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <screen_brightness_windows/screen_brightness_windows_plugin.h> #include <screen_brightness_windows/screen_brightness_windows_plugin.h>
#include <sentry_flutter/sentry_flutter_plugin.h>
#include <share_plus/share_plus_windows_plugin_c_api.h> #include <share_plus/share_plus_windows_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h> #include <url_launcher_windows/url_launcher_windows.h>
@ -31,6 +32,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
ScreenBrightnessWindowsPluginRegisterWithRegistrar( ScreenBrightnessWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenBrightnessWindowsPlugin")); registry->GetRegistrarForPlugin("ScreenBrightnessWindowsPlugin"));
SentryFlutterPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SentryFlutterPlugin"));
SharePlusWindowsPluginCApiRegisterWithRegistrar( SharePlusWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar( UrlLauncherWindowsRegisterWithRegistrar(

View File

@ -10,6 +10,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
media_kit_video media_kit_video
permission_handler_windows permission_handler_windows
screen_brightness_windows screen_brightness_windows
sentry_flutter
share_plus share_plus
url_launcher_windows url_launcher_windows
) )