mod: 播放页样式
This commit is contained in:
@ -10,8 +10,10 @@ import 'package:pilipala/models/video/play/url.dart';
|
|||||||
import 'package:pilipala/models/video/reply/item.dart';
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
import 'package:pilipala/pages/video/detail/replyReply/index.dart';
|
import 'package:pilipala/pages/video/detail/replyReply/index.dart';
|
||||||
|
|
||||||
class VideoDetailController extends GetxController {
|
class VideoDetailController extends GetxController
|
||||||
|
with GetSingleTickerProviderStateMixin {
|
||||||
int tabInitialIndex = 0;
|
int tabInitialIndex = 0;
|
||||||
|
TabController? tabCtr;
|
||||||
// tabs
|
// tabs
|
||||||
RxList<String> tabs = <String>['简介', '评论'].obs;
|
RxList<String> tabs = <String>['简介', '评论'].obs;
|
||||||
|
|
||||||
@ -63,6 +65,7 @@ class VideoDetailController extends GetxController {
|
|||||||
}
|
}
|
||||||
heroTag = Get.arguments['heroTag'];
|
heroTag = Get.arguments['heroTag'];
|
||||||
}
|
}
|
||||||
|
tabCtr = TabController(length: 2, vsync: this);
|
||||||
queryVideoUrl();
|
queryVideoUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import 'package:pilipala/common/constants.dart';
|
|||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
import 'package:pilipala/pages/fav/index.dart';
|
import 'package:pilipala/pages/fav/index.dart';
|
||||||
import 'package:pilipala/pages/favDetail/index.dart';
|
import 'package:pilipala/pages/favDetail/index.dart';
|
||||||
|
import 'package:pilipala/pages/video/detail/index.dart';
|
||||||
import 'package:pilipala/pages/video/detail/widgets/expandable_section.dart';
|
import 'package:pilipala/pages/video/detail/widgets/expandable_section.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||||
@ -99,6 +100,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
|
|
||||||
final FavController _favController = Get.put(FavController());
|
final FavController _favController = Get.put(FavController());
|
||||||
|
|
||||||
|
late VideoDetailController? videoDetailCtr;
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -110,6 +112,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
);
|
);
|
||||||
_manualAnimation =
|
_manualAnimation =
|
||||||
Tween<double>(begin: 0.5, end: 1.5).animate(_manualController!);
|
Tween<double>(begin: 0.5, end: 1.5).animate(_manualController!);
|
||||||
|
videoDetailCtr =
|
||||||
|
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
||||||
}
|
}
|
||||||
|
|
||||||
showFavBottomSheet() {
|
showFavBottomSheet() {
|
||||||
@ -345,7 +349,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
// 点赞收藏转发
|
// 点赞收藏转发
|
||||||
_actionGrid(context, videoIntroController),
|
_actionGrid(context, videoIntroController, videoDetailCtr),
|
||||||
// 合集
|
// 合集
|
||||||
if (!widget.loadingStatus &&
|
if (!widget.loadingStatus &&
|
||||||
widget.videoDetail!.ugcSeason != null) ...[
|
widget.videoDetail!.ugcSeason != null) ...[
|
||||||
@ -425,39 +429,30 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 喜欢 投币 分享
|
// 喜欢 投币 分享
|
||||||
Widget _actionGrid(BuildContext context, videoIntroController) {
|
Widget _actionGrid(
|
||||||
|
BuildContext context, videoIntroController, videoDetailCtr) {
|
||||||
return LayoutBuilder(builder: (context, constraints) {
|
return LayoutBuilder(builder: (context, constraints) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: constraints.maxWidth / 5 * 0.8,
|
height: constraints.maxWidth / 5 * 0.8,
|
||||||
|
child: Material(
|
||||||
child: GridView.count(
|
child: GridView.count(
|
||||||
primary: false,
|
primary: false,
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(0),
|
||||||
crossAxisCount: 5,
|
crossAxisCount: 5,
|
||||||
childAspectRatio: 1.25,
|
childAspectRatio: 1.25,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
// ActionItem(
|
// InkWell(
|
||||||
// icon: const Icon(FontAwesomeIcons.s),
|
// onTap: () => videoIntroController.actionOneThree(),
|
||||||
// selectIcon: const Icon(FontAwesomeIcons.s),
|
// borderRadius: StyleString.mdRadius,
|
||||||
// onTap: () => {},
|
// child: Padding(
|
||||||
// selectStatus: true,
|
// padding: const EdgeInsets.all(12),
|
||||||
// loadingStatus: false,
|
// child: Image.asset(
|
||||||
// text: '三连',
|
// 'assets/images/logo/logo_big.png',
|
||||||
|
// width: 10,
|
||||||
|
// height: 10,
|
||||||
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// Column(
|
|
||||||
// children: [],
|
|
||||||
// ),
|
// ),
|
||||||
InkWell(
|
|
||||||
onTap: () => videoIntroController.actionOneThree(),
|
|
||||||
borderRadius: StyleString.mdRadius,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
child: Image.asset(
|
|
||||||
'assets/images/logo/logo_big.png',
|
|
||||||
width: 10,
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Obx(
|
Obx(
|
||||||
() => ActionItem(
|
() => ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.thumbsUp),
|
icon: const Icon(FontAwesomeIcons.thumbsUp),
|
||||||
@ -506,8 +501,19 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
text: !widget.loadingStatus
|
text: !widget.loadingStatus
|
||||||
? widget.videoDetail!.stat!.share!.toString()
|
? widget.videoDetail!.stat!.share!.toString()
|
||||||
: '-'),
|
: '-'),
|
||||||
|
ActionItem(
|
||||||
|
icon: const Icon(FontAwesomeIcons.comments),
|
||||||
|
onTap: () {
|
||||||
|
videoDetailCtr.tabCtr.animateTo(1);
|
||||||
|
},
|
||||||
|
selectStatus: false,
|
||||||
|
loadingStatus: widget.loadingStatus,
|
||||||
|
text: !widget.loadingStatus
|
||||||
|
? widget.videoDetail!.stat!.reply!.toString()
|
||||||
|
: '-'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -136,6 +136,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
controller: _videoReplyController.scrollController,
|
controller: _videoReplyController.scrollController,
|
||||||
key: const PageStorageKey<String>('评论'),
|
key: const PageStorageKey<String>('评论'),
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
|
const SliverToBoxAdapter(child: SizedBox(height: 12)),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:extended_image/extended_image.dart';
|
import 'package:extended_image/extended_image.dart';
|
||||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||||
@ -144,17 +145,37 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
final videoHeight = MediaQuery.of(context).size.width * 9 / 16;
|
final videoHeight = MediaQuery.of(context).size.width * 9 / 16;
|
||||||
final double pinnedHeaderHeight =
|
final double pinnedHeaderHeight =
|
||||||
statusBarHeight + kToolbarHeight + videoHeight;
|
statusBarHeight + kToolbarHeight + videoHeight;
|
||||||
return DefaultTabController(
|
return SafeArea(
|
||||||
initialIndex: videoDetailController.tabInitialIndex,
|
|
||||||
length: videoDetailController.tabs.length, // tab的数量.
|
|
||||||
child: SafeArea(
|
|
||||||
top: false,
|
top: false,
|
||||||
bottom: false,
|
bottom: false,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
|
Positioned(
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
child: NetworkImgLayer(
|
||||||
|
type: 'emote',
|
||||||
|
src: videoDetailController.videoItem['pic'],
|
||||||
|
width: Get.size.width,
|
||||||
|
height: videoHeight + 100,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned.fill(
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: 100, sigmaY: 100), //可以看源码
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
Theme.of(context).colorScheme.background.withOpacity(0.1),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
Scaffold(
|
Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
key: videoDetailController.scaffoldKey,
|
key: videoDetailController.scaffoldKey,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
body: ExtendedNestedScrollView(
|
body: ExtendedNestedScrollView(
|
||||||
controller: _extendNestCtr,
|
controller: _extendNestCtr,
|
||||||
headerSliverBuilder:
|
headerSliverBuilder:
|
||||||
@ -167,8 +188,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
forceElevated: innerBoxIsScrolled,
|
forceElevated: innerBoxIsScrolled,
|
||||||
expandedHeight: videoHeight,
|
expandedHeight: videoHeight,
|
||||||
// collapsedHeight: videoHeight,
|
backgroundColor: Colors.transparent,
|
||||||
backgroundColor: Theme.of(context).colorScheme.background,
|
// backgroundColor: Theme.of(context).colorScheme.background,
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
background: Padding(
|
background: Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
@ -177,8 +198,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
builder: (context, boxConstraints) {
|
builder: (context, boxConstraints) {
|
||||||
double maxWidth = boxConstraints.maxWidth;
|
double maxWidth = boxConstraints.maxWidth;
|
||||||
double maxHeight = boxConstraints.maxHeight;
|
double maxHeight = boxConstraints.maxHeight;
|
||||||
// double PR =
|
|
||||||
// MediaQuery.of(context).devicePixelRatio;
|
|
||||||
return Hero(
|
return Hero(
|
||||||
tag: videoDetailController.heroTag,
|
tag: videoDetailController.heroTag,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
@ -247,17 +266,18 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
},
|
},
|
||||||
pinnedHeaderSliverHeightBuilder: () {
|
pinnedHeaderSliverHeightBuilder: () {
|
||||||
return playerStatus != PlayerStatus.playing
|
return playerStatus != PlayerStatus.playing
|
||||||
? MediaQuery.of(context).padding.top + 50
|
? statusBarHeight + kToolbarHeight
|
||||||
: pinnedHeaderHeight;
|
: pinnedHeaderHeight;
|
||||||
},
|
},
|
||||||
onlyOneScrollInBody: true,
|
onlyOneScrollInBody: true,
|
||||||
body: Column(
|
body: Container(
|
||||||
|
color: Theme.of(context).colorScheme.background,
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 45,
|
height: 0,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.background,
|
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(
|
bottom: BorderSide(
|
||||||
color:
|
color:
|
||||||
@ -274,7 +294,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
margin: const EdgeInsets.only(left: 20),
|
margin: const EdgeInsets.only(left: 20),
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => TabBar(
|
() => TabBar(
|
||||||
|
controller: videoDetailController.tabCtr,
|
||||||
dividerColor: Colors.transparent,
|
dividerColor: Colors.transparent,
|
||||||
|
indicatorColor:
|
||||||
|
Theme.of(context).colorScheme.background,
|
||||||
tabs: videoDetailController.tabs
|
tabs: videoDetailController.tabs
|
||||||
.map((String name) => Tab(text: name))
|
.map((String name) => Tab(text: name))
|
||||||
.toList(),
|
.toList(),
|
||||||
@ -294,6 +317,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
|
controller: videoDetailController.tabCtr,
|
||||||
children: [
|
children: [
|
||||||
Builder(
|
Builder(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
@ -314,19 +338,20 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
// 播放完成/暂停播放
|
// 播放完成/暂停播放
|
||||||
Positioned(
|
Positioned(
|
||||||
top: -MediaQuery.of(context).padding.top +
|
top: -statusBarHeight +
|
||||||
(doubleOffset / videoHeight) * 50,
|
(doubleOffset / (videoHeight - kToolbarHeight)) *
|
||||||
|
(kToolbarHeight - 9),
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: Opacity(
|
child: Opacity(
|
||||||
opacity: doubleOffset / videoHeight,
|
opacity: doubleOffset / (videoHeight - kToolbarHeight),
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 50 + MediaQuery.of(context).padding.top,
|
height: statusBarHeight + kToolbarHeight,
|
||||||
color: Theme.of(context).colorScheme.background,
|
color: Theme.of(context).colorScheme.background,
|
||||||
padding:
|
padding: EdgeInsets.only(top: statusBarHeight),
|
||||||
EdgeInsets.only(top: MediaQuery.of(context).padding.top),
|
|
||||||
child: AppBar(
|
child: AppBar(
|
||||||
primary: false,
|
primary: false,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
@ -363,7 +388,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user