Merge branch 'main' into fix
This commit is contained in:
@ -78,14 +78,9 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
systemOverlayStyle: Theme.of(context).brightness == Brightness.dark
|
|
||||||
? SystemUiOverlayStyle.light
|
|
||||||
: SystemUiOverlayStyle.dark,
|
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
height: 34,
|
height: 34,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@ -54,7 +55,14 @@ class _HomePageState extends State<HomePage>
|
|||||||
toolbarHeight: 0,
|
toolbarHeight: 0,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
systemOverlayStyle: Theme.of(context).brightness == Brightness.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.light
|
||||||
: SystemUiOverlayStyle.dark,
|
: SystemUiOverlayStyle.dark,
|
||||||
),
|
),
|
||||||
|
@ -123,27 +123,28 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: Opacity(
|
child: Opacity(
|
||||||
opacity: 0.6,
|
opacity: Theme.of(context).brightness == Brightness.dark
|
||||||
|
? 0.3
|
||||||
|
: 0.6,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
// height: MediaQuery.of(context).size.height,
|
height: MediaQuery.of(context).size.height,
|
||||||
height: MediaQuery.of(context).padding.top + 400,
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
colors: [
|
colors: [
|
||||||
Theme.of(context)
|
Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.primary
|
.primary
|
||||||
.withOpacity(0.6),
|
.withOpacity(0.7),
|
||||||
|
Theme.of(context).colorScheme.surface,
|
||||||
Theme.of(context)
|
Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.surface
|
.surface
|
||||||
.withOpacity(0.3),
|
.withOpacity(0.3),
|
||||||
Theme.of(context).colorScheme.surface
|
|
||||||
],
|
],
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
stops: const [0.1, 0.8, 1]),
|
stops: const [0.1, 0.3, 5]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -46,16 +46,7 @@ class _MediaPageState extends State<MediaPage>
|
|||||||
super.build(context);
|
super.build(context);
|
||||||
Color primary = Theme.of(context).colorScheme.primary;
|
Color primary = Theme.of(context).colorScheme.primary;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.transparent,
|
appBar: AppBar(toolbarHeight: 30),
|
||||||
appBar: AppBar(
|
|
||||||
elevation: 0,
|
|
||||||
scrolledUnderElevation: 0,
|
|
||||||
toolbarHeight: 30,
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
systemOverlayStyle: Theme.of(context).brightness == Brightness.dark
|
|
||||||
? SystemUiOverlayStyle.light
|
|
||||||
: SystemUiOverlayStyle.dark,
|
|
||||||
),
|
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
controller: mediaController.scrollController,
|
controller: mediaController.scrollController,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@ -39,7 +40,14 @@ class _RankPageState extends State<RankPage>
|
|||||||
toolbarHeight: 0,
|
toolbarHeight: 0,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
systemOverlayStyle: Theme.of(context).brightness == Brightness.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.light
|
||||||
: SystemUiOverlayStyle.dark,
|
: SystemUiOverlayStyle.dark,
|
||||||
),
|
),
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:ui';
|
|
||||||
|
|
||||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||||
import 'package:floating/floating.dart';
|
import 'package:floating/floating.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:lottie/lottie.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
import 'package:pilipala/models/common/search_type.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 '../../../plugin/pl_player/models/bottom_control_type.dart';
|
||||||
import '../../../services/shutdown_timer_service.dart';
|
import '../../../services/shutdown_timer_service.dart';
|
||||||
import 'widgets/app_bar.dart';
|
import 'widgets/app_bar.dart';
|
||||||
|
import 'widgets/header_control.dart';
|
||||||
|
|
||||||
class VideoDetailPage extends StatefulWidget {
|
class VideoDetailPage extends StatefulWidget {
|
||||||
const VideoDetailPage({Key? key}) : super(key: key);
|
const VideoDetailPage({Key? key}) : super(key: key);
|
||||||
@ -494,17 +494,14 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
exitFullScreen();
|
exitFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 播放器面板
|
Widget buildLoadingWidget() {
|
||||||
Widget videoPlayerPanel = FutureBuilder(
|
return Center(child: Lottie.asset('assets/loading.json', width: 200));
|
||||||
future: _futureBuilderFuture,
|
}
|
||||||
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
|
||||||
if (snapshot.hasData && snapshot.data['status']) {
|
Widget buildVideoPlayerWidget(AsyncSnapshot snapshot) {
|
||||||
return Obx(
|
return Obx(() => !vdCtr.autoPlay.value
|
||||||
() {
|
|
||||||
return !vdCtr.autoPlay.value
|
|
||||||
? const SizedBox()
|
? const SizedBox()
|
||||||
: Obx(
|
: PLVideoPlayer(
|
||||||
() => PLVideoPlayer(
|
|
||||||
controller: plPlayerController!,
|
controller: plPlayerController!,
|
||||||
headerControl: vdCtr.headerControl,
|
headerControl: vdCtr.headerControl,
|
||||||
danmuWidget: PlDanmaku(
|
danmuWidget: PlDanmaku(
|
||||||
@ -517,22 +514,57 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
? videoIntroController.showEposideHandler()
|
? videoIntroController.showEposideHandler()
|
||||||
: bangumiIntroController.showEposideHandler(),
|
: bangumiIntroController.showEposideHandler(),
|
||||||
fullScreenCb: (bool status) {
|
fullScreenCb: (bool status) {
|
||||||
if (status) {
|
videoHeight.value =
|
||||||
videoHeight.value = Get.size.height;
|
status ? Get.size.height : defaultVideoHeight;
|
||||||
} else {
|
|
||||||
videoHeight.value = 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 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 {
|
} else {
|
||||||
// 加载失败异常处理
|
return buildErrorWidget(snapshot.error);
|
||||||
return const SizedBox();
|
}
|
||||||
|
} else {
|
||||||
|
return buildErrorWidget('未知错误');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget childWhenDisabled = SafeArea(
|
Widget childWhenDisabled = SafeArea(
|
||||||
top: MediaQuery.of(context).orientation == Orientation.portrait &&
|
top: MediaQuery.of(context).orientation == Orientation.portrait &&
|
||||||
@ -607,7 +639,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (isShowing) videoPlayerPanel,
|
if (isShowing) buildVideoPlayerPanel(),
|
||||||
|
|
||||||
/// 关闭自动播放时 手动播放
|
/// 关闭自动播放时 手动播放
|
||||||
Obx(
|
Obx(
|
||||||
@ -717,7 +749,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
return PiPSwitcher(
|
return PiPSwitcher(
|
||||||
childWhenDisabled: childWhenDisabled,
|
childWhenDisabled: childWhenDisabled,
|
||||||
childWhenEnabled: videoPlayerPanel,
|
childWhenEnabled: buildVideoPlayerPanel(),
|
||||||
floating: floating,
|
floating: floating,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user