Merge branch 'main' into fix

This commit is contained in:
guozhigq
2024-07-17 23:29:43 +08:00
6 changed files with 104 additions and 69 deletions

View File

@ -78,14 +78,9 @@ class _DynamicsPageState extends State<DynamicsPage>
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
backgroundColor: Colors.transparent,
systemOverlayStyle: Theme.of(context).brightness == Brightness.dark
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark,
title: SizedBox(
height: 34,
child: Stack(

View File

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -54,9 +55,16 @@ class _HomePageState extends State<HomePage>
toolbarHeight: 0,
elevation: 0,
backgroundColor: Colors.transparent,
systemOverlayStyle: Theme.of(context).brightness == Brightness.dark
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark,
systemOverlayStyle: Platform.isAndroid
? SystemUiOverlayStyle(
statusBarIconBrightness:
Theme.of(context).brightness == Brightness.dark
? Brightness.light
: Brightness.dark,
)
: Theme.of(context).brightness == Brightness.dark
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark,
),
body: Column(
children: [

View File

@ -123,27 +123,28 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
Align(
alignment: Alignment.topLeft,
child: Opacity(
opacity: 0.6,
opacity: Theme.of(context).brightness == Brightness.dark
? 0.3
: 0.6,
child: Container(
width: MediaQuery.of(context).size.width,
// height: MediaQuery.of(context).size.height,
height: MediaQuery.of(context).padding.top + 400,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Theme.of(context)
.colorScheme
.primary
.withOpacity(0.6),
.withOpacity(0.7),
Theme.of(context).colorScheme.surface,
Theme.of(context)
.colorScheme
.surface
.withOpacity(0.3),
Theme.of(context).colorScheme.surface
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: const [0.1, 0.8, 1]),
stops: const [0.1, 0.3, 5]),
),
),
),

View File

@ -46,16 +46,7 @@ class _MediaPageState extends State<MediaPage>
super.build(context);
Color primary = Theme.of(context).colorScheme.primary;
return Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
toolbarHeight: 30,
backgroundColor: Colors.transparent,
systemOverlayStyle: Theme.of(context).brightness == Brightness.dark
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark,
),
appBar: AppBar(toolbarHeight: 30),
body: SingleChildScrollView(
controller: mediaController.scrollController,
child: Column(

View File

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -39,9 +40,16 @@ class _RankPageState extends State<RankPage>
toolbarHeight: 0,
elevation: 0,
backgroundColor: Colors.transparent,
systemOverlayStyle: Theme.of(context).brightness == Brightness.dark
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark,
systemOverlayStyle: Platform.isAndroid
? SystemUiOverlayStyle(
statusBarIconBrightness:
Theme.of(context).brightness == Brightness.dark
? Brightness.light
: Brightness.dark,
)
: Theme.of(context).brightness == Brightness.dark
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark,
),
body: Column(
children: [

View File

@ -1,16 +1,15 @@
import 'dart:async';
import 'dart:io';
import 'dart:ui';
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
import 'package:floating/floating.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_svg/svg.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart';
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import 'package:lottie/lottie.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/http/user.dart';
import 'package:pilipala/models/common/search_type.dart';
@ -29,6 +28,7 @@ import 'package:status_bar_control/status_bar_control.dart';
import '../../../plugin/pl_player/models/bottom_control_type.dart';
import '../../../services/shutdown_timer_service.dart';
import 'widgets/app_bar.dart';
import 'widgets/header_control.dart';
class VideoDetailPage extends StatefulWidget {
const VideoDetailPage({Key? key}) : super(key: key);
@ -494,45 +494,77 @@ class _VideoDetailPageState extends State<VideoDetailPage>
exitFullScreen();
}
Widget buildLoadingWidget() {
return Center(child: Lottie.asset('assets/loading.json', width: 200));
}
Widget buildVideoPlayerWidget(AsyncSnapshot snapshot) {
return Obx(() => !vdCtr.autoPlay.value
? const SizedBox()
: PLVideoPlayer(
controller: plPlayerController!,
headerControl: vdCtr.headerControl,
danmuWidget: PlDanmaku(
key: Key(vdCtr.danmakuCid.value.toString()),
cid: vdCtr.danmakuCid.value,
playerController: plPlayerController!,
),
bottomList: vdCtr.bottomList,
showEposideCb: () => vdCtr.videoType == SearchType.video
? videoIntroController.showEposideHandler()
: bangumiIntroController.showEposideHandler(),
fullScreenCb: (bool status) {
videoHeight.value =
status ? Get.size.height : defaultVideoHeight;
},
));
}
Widget buildErrorWidget(dynamic error) {
return Obx(
() => SizedBox(
height: videoHeight.value,
width: Get.size.width,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text('加载失败', style: TextStyle(color: Colors.white)),
Text('$error', style: const TextStyle(color: Colors.white)),
const SizedBox(height: 10),
IconButton.filled(
onPressed: () {
setState(() {
_futureBuilderFuture = vdCtr.queryVideoUrl();
});
},
icon: const Icon(Icons.refresh),
)
],
),
),
);
}
/// 播放器面板
Widget videoPlayerPanel = FutureBuilder(
future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasData && snapshot.data['status']) {
return Obx(
() {
return !vdCtr.autoPlay.value
? const SizedBox()
: Obx(
() => PLVideoPlayer(
controller: plPlayerController!,
headerControl: vdCtr.headerControl,
danmuWidget: PlDanmaku(
key: Key(vdCtr.danmakuCid.value.toString()),
cid: vdCtr.danmakuCid.value,
playerController: plPlayerController!,
),
bottomList: vdCtr.bottomList,
showEposideCb: () => vdCtr.videoType == SearchType.video
? videoIntroController.showEposideHandler()
: bangumiIntroController.showEposideHandler(),
fullScreenCb: (bool status) {
if (status) {
videoHeight.value = Get.size.height;
} else {
videoHeight.value = defaultVideoHeight;
}
},
),
);
},
);
} else {
// 加载失败异常处理
return const SizedBox();
}
},
);
Widget buildVideoPlayerPanel() {
return FutureBuilder(
future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return buildLoadingWidget();
} else if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasData && snapshot.data['status']) {
return buildVideoPlayerWidget(snapshot);
} else {
return buildErrorWidget(snapshot.error);
}
} else {
return buildErrorWidget('未知错误');
}
},
);
}
Widget childWhenDisabled = SafeArea(
top: MediaQuery.of(context).orientation == Orientation.portrait &&
@ -607,7 +639,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
tag: heroTag,
child: Stack(
children: <Widget>[
if (isShowing) videoPlayerPanel,
if (isShowing) buildVideoPlayerPanel(),
/// 关闭自动播放时 手动播放
Obx(
@ -717,7 +749,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
if (Platform.isAndroid) {
return PiPSwitcher(
childWhenDisabled: childWhenDisabled,
childWhenEnabled: videoPlayerPanel,
childWhenEnabled: buildVideoPlayerPanel(),
floating: floating,
);
} else {