mod: 图标修改

This commit is contained in:
guozhigq
2023-07-22 15:51:16 +08:00
45 changed files with 1302 additions and 551 deletions

View File

@ -7,6 +7,7 @@ import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/http/constants.dart';
import 'package:pilipala/http/video.dart';
import 'package:pilipala/models/common/reply_type.dart';
import 'package:pilipala/models/video/play/url.dart';
import 'package:pilipala/models/video/reply/item.dart';
import 'package:pilipala/pages/video/detail/replyReply/index.dart';
@ -87,6 +88,8 @@ class VideoDetailController extends GetxController
},
firstFloor: firstFloor,
paddingTop: paddingTop,
replyType: ReplyType.video,
source: 'videoDetail',
);
});
ctr?.closed.then((value) {
@ -95,6 +98,7 @@ class VideoDetailController extends GetxController
}
playerInit(source, audioSource, {Duration defaultST = Duration.zero}) {
meeduPlayerController.onVideoFitChange(BoxFit.cover);
meeduPlayerController.setDataSource(
DataSource(
type: DataSourceType.network,
@ -157,7 +161,7 @@ class VideoDetailController extends GetxController
@override
void onClose() {
markHeartBeat();
if (timer!.isActive) {
if (timer != null && timer!.isActive) {
timer!.cancel();
}
super.onClose();

View File

@ -84,11 +84,11 @@ class VideoIntroController extends GetxController {
Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
.tabs
.value = ['简介', '评论 ${result['data']!.stat!.reply}'];
// 获取到粉丝数再返回
await queryUserStat();
} else {
responseMsg = result['msg'];
}
// 获取到粉丝数再返回
await queryUserStat();
if (userLogin) {
// 获取点赞状态
queryHasLikeVideo();
@ -99,13 +99,13 @@ class VideoIntroController extends GetxController {
//
queryFollowStatus();
}
return result;
}
// 获取up主粉丝数
Future queryUserStat() async {
var result = await UserHttp.userStat(mid: videoDetail.value.owner!.mid!);
print('🌹:$result');
if (result['status']) {
userStat = result['data'];
}

View File

@ -65,7 +65,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
// 请求错误
return HttpError(
errMsg: snapshot.data['msg'],
fn: () => setState(() {}),
fn: () => Get.back(),
);
}
} else {
@ -231,7 +231,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
return SliverPadding(
padding: const EdgeInsets.only(left: 12, right: 12, top: 20),
padding: const EdgeInsets.only(left: 12, right: 12, top: 10),
sliver: SliverToBoxAdapter(
child: !widget.loadingStatus || videoItem.isNotEmpty
? Column(
@ -248,6 +248,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
style: Theme.of(context).textTheme.titleMedium!.copyWith(
letterSpacing: 0.5,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
InkWell(

View File

@ -1,4 +0,0 @@
library video_player;
export './controller.dart';
export './view.dart';

View File

@ -6,6 +6,7 @@ import 'package:get/get.dart';
import 'package:pilipala/common/skeleton/video_reply.dart';
import 'package:pilipala/common/widgets/http_error.dart';
import 'package:pilipala/models/video/reply/item.dart';
import 'package:pilipala/pages/video/detail/index.dart';
import 'package:pilipala/pages/video/detail/replyNew/index.dart';
import 'package:pilipala/utils/id_utils.dart';
import 'controller.dart';
@ -52,9 +53,10 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
tag: widget.rpid.toString());
_videoReplyController.rPid = widget.rpid;
} else {
int oid = Get.parameters['bvid'] != null
? IdUtils.bv2av(Get.parameters['bvid']!)
: 0;
// fix 评论加载不对称
// int oid = Get.parameters['bvid'] != null
// ? IdUtils.bv2av(Get.parameters['bvid']!)
// : 0;
_videoReplyController = Get.put(VideoReplyController(oid, '', '1'),
tag: Get.arguments['heroTag']);
}
@ -113,6 +115,16 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
_videoReplyController.wakeUpReply();
}
// 展示二级回复
void replyReply(replyItem, paddingTop) {
VideoDetailController videoDetailCtr =
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
videoDetailCtr.oid = replyItem.replies!.first.oid;
videoDetailCtr.fRpid = replyItem.rpid!;
videoDetailCtr.firstFloor = replyItem;
videoDetailCtr.showReplyReplyPanel(paddingTop);
}
@override
void dispose() {
super.dispose();
@ -164,10 +176,13 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
);
} else {
return ReplyItem(
replyItem:
_videoReplyController.replyList[index],
showReplyRow: true,
replyLevel: replyLevel);
replyItem:
_videoReplyController.replyList[index],
showReplyRow: true,
replyLevel: replyLevel,
replyReply: (replyItem, paddingTop) =>
replyReply(replyItem, paddingTop),
);
}
},
childCount:

View File

@ -6,6 +6,7 @@ import 'package:flutter_meedu_media_kit/meedu_player.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/models/common/reply_type.dart';
import 'package:pilipala/models/video/reply/item.dart';
import 'package:pilipala/pages/video/detail/controller.dart';
import 'package:pilipala/pages/video/detail/reply/index.dart';
@ -14,16 +15,21 @@ import 'package:pilipala/pages/video/detail/replyReply/index.dart';
import 'package:pilipala/utils/utils.dart';
class ReplyItem extends StatelessWidget {
ReplyItem(
{super.key,
this.replyItem,
this.addReply,
this.replyLevel,
this.showReplyRow});
ReplyItem({
super.key,
this.replyItem,
this.addReply,
this.replyLevel,
this.showReplyRow,
this.replyReply,
this.replyType,
});
ReplyItemModel? replyItem;
Function? addReply;
String? replyLevel;
bool? showReplyRow = true;
Function? replyReply;
ReplyType? replyType;
@override
Widget build(BuildContext context) {
@ -212,6 +218,7 @@ class ReplyItem extends StatelessWidget {
replyControl: replyItem!.replyControl,
f_rpid: replyItem!.rpid,
replyItem: replyItem,
replyReply: replyReply,
),
),
],
@ -272,11 +279,13 @@ class ReplyItem extends StatelessWidget {
isScrollControlled: true,
builder: (builder) {
return VideoReplyNewDialog(
replyLevel: replyLevel,
oid: replyItem!.oid,
root: replyItem!.rpid,
parent: replyItem!.rpid,
paddingTop: paddingTop);
replyLevel: replyLevel,
oid: replyItem!.oid,
root: replyItem!.rpid,
parent: replyItem!.rpid,
paddingTop: paddingTop,
replyType: replyType,
);
},
).then((value) => {
// 完成评论,数据添加
@ -320,21 +329,25 @@ class ReplyItem extends StatelessWidget {
// ignore: must_be_immutable
class ReplyItemRow extends StatelessWidget {
ReplyItemRow(
{super.key,
this.replies,
this.replyControl,
this.f_rpid,
this.replyItem});
ReplyItemRow({
super.key,
this.replies,
this.replyControl,
this.f_rpid,
this.replyItem,
this.replyReply,
});
List? replies;
ReplyControl? replyControl;
int? f_rpid;
ReplyItemModel? replyItem;
Function? replyReply;
@override
Widget build(BuildContext context) {
bool isShow = replyControl!.isShow!;
int extraRow = replyControl != null && isShow ? 1 : 0;
double paddingTop = MediaQuery.of(context).padding.top;
return Container(
margin: const EdgeInsets.only(left: 42, right: 4, top: 0),
child: Material(
@ -347,8 +360,7 @@ class ReplyItemRow extends StatelessWidget {
children: [
for (var i = 0; i < replies!.length; i++) ...[
InkWell(
onTap: () =>
replyReply(replyItem, MediaQuery.of(context).padding.top),
onTap: () => replyReply!(replyItem, paddingTop),
child: Container(
width: double.infinity,
padding: EdgeInsets.fromLTRB(
@ -398,8 +410,7 @@ class ReplyItemRow extends StatelessWidget {
],
if (extraRow == 1)
InkWell(
onTap: () =>
replyReply(replyItem, MediaQuery.of(context).padding.top),
onTap: () => replyReply!(replyItem, paddingTop),
child: Container(
width: double.infinity,
padding: const EdgeInsets.fromLTRB(8, 5, 8, 8),
@ -428,16 +439,6 @@ class ReplyItemRow extends StatelessWidget {
),
);
}
void replyReply(replyItem, paddingTop) {
// replyItem 楼主评论
VideoDetailController videoDetailCtr =
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
videoDetailCtr.oid = replies!.first.oid;
videoDetailCtr.fRpid = f_rpid!;
videoDetailCtr.firstFloor = replyItem;
videoDetailCtr.showReplyReplyPanel(paddingTop);
}
}
InlineSpan buildContent(BuildContext context, content) {

View File

@ -13,6 +13,7 @@ class VideoReplyNewDialog extends StatefulWidget {
String? replyLevel;
int? parent;
double? paddingTop;
ReplyType? replyType;
VideoReplyNewDialog({
this.oid,
@ -20,6 +21,7 @@ class VideoReplyNewDialog extends StatefulWidget {
this.replyLevel,
this.parent,
this.paddingTop,
this.replyType,
});
@override
@ -64,7 +66,7 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
Future submitReplyAdd() async {
String message = _replyContentController.text;
var result = await VideoHttp.replyAdd(
type: ReplyType.video,
type: widget.replyType!,
oid: widget.oid!,
root: widget.root!,
parent: widget.parent!,

View File

@ -1,16 +1,18 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/http/reply.dart';
import 'package:pilipala/models/common/reply_type.dart';
import 'package:pilipala/models/video/reply/data.dart';
import 'package:pilipala/models/video/reply/item.dart';
class VideoReplyReplyController extends GetxController {
VideoReplyReplyController(this.aid, this.rpid);
VideoReplyReplyController(this.aid, this.rpid, this.replyType);
final ScrollController scrollController = ScrollController();
// 视频aid 请求时使用的oid
int? aid;
// rpid 请求楼中楼回复
String? rpid;
ReplyType replyType = ReplyType.video;
RxList<ReplyItemModel> replyList = [ReplyItemModel()].obs;
// 当前页
int currentPage = 0;
@ -41,7 +43,10 @@ class VideoReplyReplyController extends GetxController {
}
isLoadingMore = true;
var res = await ReplyHttp.replyReplyList(
oid: aid!, root: rpid!, pageNum: currentPage + 1, type: 1);
oid: aid!,
root: rpid!,
pageNum: currentPage + 1,
type: replyType.index);
if (res['status']) {
res['data'] = ReplyData.fromJson(res['data']);
if (res['data'].replies.isNotEmpty) {

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/skeleton/video_reply.dart';
import 'package:pilipala/common/widgets/http_error.dart';
import 'package:pilipala/models/common/reply_type.dart';
import 'package:pilipala/models/video/reply/item.dart';
import 'package:pilipala/pages/video/detail/reply/widgets/reply_item.dart';
@ -13,6 +14,8 @@ class VideoReplyReplyPanel extends StatefulWidget {
Function? closePanel;
ReplyItemModel? firstFloor;
double? paddingTop;
String? source;
ReplyType? replyType;
VideoReplyReplyPanel({
this.oid,
@ -20,6 +23,8 @@ class VideoReplyReplyPanel extends StatefulWidget {
this.closePanel,
this.firstFloor,
this.paddingTop,
this.source,
this.replyType,
super.key,
});
@ -34,7 +39,8 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
@override
void initState() {
_videoReplyReplyController = Get.put(
VideoReplyReplyController(widget.oid, widget.rpid.toString()),
VideoReplyReplyController(
widget.oid, widget.rpid.toString(), widget.replyType!),
tag: widget.rpid.toString());
super.initState();
@ -62,34 +68,37 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
@override
Widget build(BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height -
MediaQuery.of(context).size.width * 9 / 16 -
widget.paddingTop!,
height: widget.source == 'videoDetail'
? MediaQuery.of(context).size.height -
MediaQuery.of(context).size.width * 9 / 16 -
widget.paddingTop!
: null,
color: Theme.of(context).colorScheme.background,
child: Column(
children: [
Container(
height: 45,
padding: const EdgeInsets.only(left: 14, right: 14),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'评论详情',
style: Theme.of(context).textTheme.titleMedium,
),
IconButton(
icon: const Icon(Icons.close),
onPressed: () {
_videoReplyReplyController.currentPage = 0;
_videoReplyReplyController.rPid = 0;
widget.closePanel!();
Navigator.pop(context);
},
),
],
if (widget.source == 'videoDetail')
Container(
height: 45,
padding: const EdgeInsets.only(left: 14, right: 14),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'评论详情',
style: Theme.of(context).textTheme.titleMedium,
),
IconButton(
icon: const Icon(Icons.close),
onPressed: () {
_videoReplyReplyController.currentPage = 0;
_videoReplyReplyController.rPid = 0;
widget.closePanel!();
Navigator.pop(context);
},
),
],
),
),
),
Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
@ -188,7 +197,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
delegate:
SliverChildBuilderDelegate((context, index) {
return const VideoReplySkeleton();
}, childCount: 5),
}, childCount: 8),
);
}
},

View File

@ -90,14 +90,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
@override
void dispose() {
videoDetailController.meeduPlayerController.dispose();
videoDetailController.timer!.cancel();
if (videoDetailController.timer != null) {
videoDetailController.timer!.cancel();
}
super.dispose();
}
@override
// 离开当前页面时
void didPushNext() async {
if (!_meeduPlayerController!.pipEnabled) {
if (!_meeduPlayerController!.pipAvailable.value) {
_meeduPlayerController!.pause();
}
if (videoDetailController.timer!.isActive) {
@ -232,7 +234,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
children: [
Container(
width: double.infinity,
height: 0,
height: 45,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
@ -252,8 +254,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
() => TabBar(
controller: videoDetailController.tabCtr,
dividerColor: Colors.transparent,
indicatorColor:
Theme.of(context).colorScheme.background,
// indicatorColor:
// Theme.of(context).colorScheme.background,
tabs: videoDetailController.tabs
.map((String name) => Tab(text: name))
.toList(),
@ -278,7 +280,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
);
},
),
VideoReplyPanel()
VideoReplyPanel(
bvid: videoDetailController.bvid,
)
],
),
),