mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
chore: clean up
opt: pages Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -70,7 +70,6 @@ class DynamicsController extends GetxController
|
||||
Future queryFollowing2() async {
|
||||
if (upData.value.upList != null &&
|
||||
upData.value.upList!.length >= allFollowedUpsTotal) {
|
||||
// SmartDialog.showToast('没有更多了');
|
||||
return;
|
||||
}
|
||||
var res = await FollowHttp.followings(
|
||||
@@ -187,7 +186,6 @@ class DynamicsController extends GetxController
|
||||
await controller.onRefresh();
|
||||
}
|
||||
|
||||
// 返回顶部并刷新
|
||||
@override
|
||||
void animateToTop() async {
|
||||
controller.animateToTop();
|
||||
|
||||
@@ -31,7 +31,6 @@ import '../../../utils/grid.dart';
|
||||
import '../widgets/dynamic_panel.dart';
|
||||
|
||||
class DynamicDetailPage extends StatefulWidget {
|
||||
// const DynamicDetailPage({super.key});
|
||||
const DynamicDetailPage({super.key});
|
||||
|
||||
@override
|
||||
@@ -43,7 +42,6 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
late DynamicDetailController _dynamicDetailController;
|
||||
AnimationController? _fabAnimationCtr;
|
||||
final RxBool _visibleTitle = false.obs;
|
||||
// String? action;
|
||||
// 回复类型
|
||||
late int replyType;
|
||||
bool _isFabVisible = true;
|
||||
@@ -124,8 +122,6 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
Map args = Get.arguments;
|
||||
// 楼层
|
||||
int floor = args['floor'];
|
||||
// 从action栏点击进入
|
||||
// action = args.containsKey('action') ? args['action'] : null;
|
||||
// 评论类型
|
||||
int commentType = args['item'].basic!['comment_type'] ?? 11;
|
||||
replyType = (commentType == 0) ? 11 : commentType;
|
||||
|
||||
@@ -144,10 +144,7 @@ class _DynamicsTabPageState
|
||||
sliver: dynamicsWaterfallFlow
|
||||
? SliverWaterfallFlow.extent(
|
||||
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
||||
//cacheExtent: 0.0,
|
||||
crossAxisSpacing: StyleString.cardSpace / 2,
|
||||
// mainAxisSpacing: StyleString.cardSpace / 2,
|
||||
|
||||
lastChildLayoutTypeBuilder: (index) {
|
||||
if (index == loadingState.response!.length - 1) {
|
||||
controller.onLoadMore();
|
||||
@@ -163,7 +160,6 @@ class _DynamicsTabPageState
|
||||
DynamicPanel(
|
||||
item: i,
|
||||
onRemove: controller.onRemove,
|
||||
// onSetTop: controller.onSetTop,
|
||||
),
|
||||
] else ...[
|
||||
for (var i in loadingState.response!)
|
||||
@@ -172,7 +168,6 @@ class _DynamicsTabPageState
|
||||
DynamicPanel(
|
||||
item: i,
|
||||
onRemove: controller.onRemove,
|
||||
// onSetTop: controller.onSetTop,
|
||||
),
|
||||
]
|
||||
],
|
||||
@@ -198,7 +193,6 @@ class _DynamicsTabPageState
|
||||
return DynamicPanel(
|
||||
item: item,
|
||||
onRemove: controller.onRemove,
|
||||
// onSetTop: controller.onSetTop,
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
|
||||
@@ -131,7 +131,6 @@ Widget addWidget(item, context, type, {floor = 1}) {
|
||||
)
|
||||
],
|
||||
),
|
||||
// TextButton(onPressed: () {}, child: Text('123'))
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -140,60 +139,6 @@ Widget addWidget(item, context, type, {floor = 1}) {
|
||||
case 'ADDITIONAL_TYPE_GOODS':
|
||||
// 商品
|
||||
return const SizedBox();
|
||||
// return Padding(
|
||||
// padding: const EdgeInsets.only(top: 6),
|
||||
// child: InkWell(
|
||||
// onTap: () {},
|
||||
// child: Container(
|
||||
// padding:
|
||||
// const EdgeInsets.only(left: 12, top: 8, right: 12, bottom: 8),
|
||||
// decoration: BoxDecoration(
|
||||
// color: bgColor,
|
||||
// borderRadius: const BorderRadius.all(Radius.circular(6)),
|
||||
// ),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// NetworkImgLayer(
|
||||
// width: 75,
|
||||
// height: 75,
|
||||
// src: dynamicProperty[type].items.first.cover,
|
||||
// ),
|
||||
// const SizedBox(width: 10),
|
||||
// Expanded(
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// dynamicProperty[type].items.first.name,
|
||||
// maxLines: 1,
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// ),
|
||||
// Text(
|
||||
// dynamicProperty[type].items.first.brief,
|
||||
// maxLines: 1,
|
||||
// style: TextStyle(
|
||||
// color: Theme.of(context).colorScheme.outline,
|
||||
// fontSize: Theme.of(context)
|
||||
// .textTheme
|
||||
// .labelMedium!
|
||||
// .fontSize,
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(height: 2),
|
||||
// Text(
|
||||
// dynamicProperty[type].items.first.price,
|
||||
// style: TextStyle(
|
||||
// color: Theme.of(context).colorScheme.primary,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),);
|
||||
case 'ADDITIONAL_TYPE_MATCH':
|
||||
return const SizedBox();
|
||||
case 'ADDITIONAL_TYPE_COMMON':
|
||||
|
||||
@@ -94,7 +94,6 @@ class AuthorPanel extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
item.modules.moduleAuthor.name,
|
||||
// semanticsLabel: "UP主:${item.modules.moduleAuthor.name}",
|
||||
style: TextStyle(
|
||||
color: item.modules.moduleAuthor!.vip != null &&
|
||||
item.modules.moduleAuthor!.vip['status'] > 0 &&
|
||||
@@ -157,20 +156,6 @@ class AuthorPanel extends StatelessWidget {
|
||||
? Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// GestureDetector(
|
||||
// onTap:
|
||||
// item.modules.moduleAuthor.decorate['jump_url'] != null
|
||||
// ? () {
|
||||
// Get.toNamed(
|
||||
// '/webview',
|
||||
// parameters: {
|
||||
// 'url':
|
||||
// '${item.modules.moduleAuthor.decorate['jump_url']}'
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// : null,
|
||||
// child:
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.centerRight,
|
||||
@@ -210,7 +195,6 @@ class AuthorPanel extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
// ),
|
||||
_moreWidget(context),
|
||||
],
|
||||
)
|
||||
@@ -294,7 +278,6 @@ class AuthorPanel extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
// dense: true,
|
||||
leading: const Icon(Icons.watch_later_outlined, size: 19),
|
||||
title: Text(
|
||||
'稍后再看',
|
||||
|
||||
@@ -66,7 +66,6 @@ Widget content(bool isSave, BuildContext context, item, source, callback) {
|
||||
item.modules.moduleDynamic.major.opus.pics.isNotEmpty)
|
||||
Text.rich(
|
||||
picsNodes(),
|
||||
// semanticsLabel: '动态图片',
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -30,9 +30,6 @@ class DynamicPanel extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
// padding: source == 'detail'
|
||||
// ? const EdgeInsets.only(bottom: 12)
|
||||
// : EdgeInsets.zero,
|
||||
decoration: isSave ||
|
||||
(source == 'detail' &&
|
||||
Get.context!.orientation == Orientation.landscape)
|
||||
@@ -47,11 +44,7 @@ class DynamicPanel extends StatelessWidget {
|
||||
),
|
||||
child: Material(
|
||||
elevation: 0,
|
||||
// clipBehavior: Clip.hardEdge,
|
||||
color: Colors.transparent,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(5),
|
||||
// ),
|
||||
child: InkWell(
|
||||
onTap: source == 'detail' &&
|
||||
[
|
||||
|
||||
@@ -106,22 +106,6 @@ Widget forWard(bool isSave, item, BuildContext context, source, callback,
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
|
||||
/// fix #话题跟content重复
|
||||
// if (item.modules.moduleDynamic.topic != null) ...[
|
||||
// Padding(
|
||||
// padding: floor == 2
|
||||
// ? EdgeInsets.zero
|
||||
// : const EdgeInsets.only(left: 12, right: 12),
|
||||
// child: GestureDetector(
|
||||
// child: Text(
|
||||
// '#${item.modules.moduleDynamic.topic.name}',
|
||||
// style: authorStyle,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
|
||||
if (richNodes != null)
|
||||
Text.rich(
|
||||
richNodes,
|
||||
@@ -140,10 +124,7 @@ Widget forWard(bool isSave, item, BuildContext context, source, callback,
|
||||
if (hasPics) ...[
|
||||
Text.rich(
|
||||
picsNodes(item.modules.moduleDynamic.major.opus.pics, callback),
|
||||
// semanticsLabel: '动态图片',
|
||||
),
|
||||
// if (item.modules.moduleDynamic.additional != null)
|
||||
// const SizedBox(height: 4),
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
],
|
||||
@@ -206,11 +187,6 @@ Widget forWard(bool isSave, item, BuildContext context, source, callback,
|
||||
: const SizedBox.shrink(),
|
||||
_ => const SizedBox.shrink(),
|
||||
};
|
||||
// return Container(
|
||||
// padding:
|
||||
// const EdgeInsets.only(left: 10, top: 12, right: 10, bottom: 10),
|
||||
// color: Theme.of(context).dividerColor.withOpacity(0.08),
|
||||
// child: articlePanel(item, context, floor: floor));
|
||||
// 转发
|
||||
case 'DYNAMIC_TYPE_FORWARD':
|
||||
return InkWell(
|
||||
|
||||
@@ -40,9 +40,6 @@ InlineSpan? richNode(item, BuildContext context) {
|
||||
return null;
|
||||
} else {
|
||||
for (var i in richTextNodes) {
|
||||
/// fix 渲染专栏时内容会重复
|
||||
// if (item.modules.moduleDynamic.major.opus.title == null &&
|
||||
// i.type == 'RICH_TEXT_NODE_TYPE_TEXT') {
|
||||
if (i.type == 'RICH_TEXT_NODE_TYPE_TEXT') {
|
||||
spanChildren.add(
|
||||
TextSpan(text: i.origText, style: const TextStyle(height: 1.65)));
|
||||
@@ -289,121 +286,7 @@ InlineSpan? richNode(item, BuildContext context) {
|
||||
}
|
||||
}
|
||||
|
||||
// if (contentType == 'major' &&
|
||||
// item.modules.moduleDynamic.major.opus.pics.isNotEmpty) {
|
||||
// // 图片可能跟其他widget重复渲染
|
||||
// List<OpusPicsModel> pics = item.modules.moduleDynamic.major.opus.pics;
|
||||
// int len = pics.length;
|
||||
// List<String> picList = [];
|
||||
|
||||
// if (len == 1) {
|
||||
// OpusPicsModel pictureItem = pics.first;
|
||||
// picList.add(pictureItem.url!);
|
||||
// spanChildren.add(const TextSpan(text: '\n'));
|
||||
// spanChildren.add(
|
||||
// WidgetSpan(
|
||||
// child: LayoutBuilder(
|
||||
// builder: (context, BoxConstraints box) {
|
||||
// return GestureDetector(
|
||||
// onTap: () {
|
||||
// showDialog(
|
||||
// useSafeArea: false,
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return ImagePreview(initialPage: 0, imgList: picList);
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.only(top: 4),
|
||||
// child: NetworkImgLayer(
|
||||
// src: pictureItem.url,
|
||||
// width: box.maxWidth / 2,
|
||||
// height: box.maxWidth *
|
||||
// 0.5 *
|
||||
// (pictureItem.height != null &&
|
||||
// pictureItem.width != null
|
||||
// ? pictureItem.height! / pictureItem.width!
|
||||
// : 1),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// if (len > 1) {
|
||||
// List<Widget> list = [];
|
||||
// for (var i = 0; i < len; i++) {
|
||||
// picList.add(pics[i].url!);
|
||||
// list.add(
|
||||
// LayoutBuilder(
|
||||
// builder: (context, BoxConstraints box) {
|
||||
// return GestureDetector(
|
||||
// onTap: () {
|
||||
// showDialog(
|
||||
// useSafeArea: false,
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return ImagePreview(initialPage: i, imgList: picList);
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// child: NetworkImgLayer(
|
||||
// src: pics[i].url,
|
||||
// width: box.maxWidth,
|
||||
// height: box.maxWidth,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// spanChildren.add(
|
||||
// WidgetSpan(
|
||||
// child: LayoutBuilder(
|
||||
// builder: (context, BoxConstraints box) {
|
||||
// double maxWidth = box.maxWidth;
|
||||
// double crossCount = len < 3 ? 2 : 3;
|
||||
// double height = maxWidth /
|
||||
// crossCount *
|
||||
// (len % crossCount == 0
|
||||
// ? len ~/ crossCount
|
||||
// : len ~/ crossCount + 1) +
|
||||
// 6;
|
||||
// return Container(
|
||||
// padding: const EdgeInsets.only(top: 6),
|
||||
// height: height,
|
||||
// child: GridView.count(
|
||||
// padding: EdgeInsets.zero,
|
||||
// physics: const NeverScrollableScrollPhysics(),
|
||||
// crossAxisCount: crossCount.toInt(),
|
||||
// mainAxisSpacing: 4.0,
|
||||
// crossAxisSpacing: 4.0,
|
||||
// childAspectRatio: 1,
|
||||
// children: list,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// spanChildren.add(
|
||||
// WidgetSpan(
|
||||
// child: NetworkImgLayer(
|
||||
// src: pics.first.url,
|
||||
// type: 'emote',
|
||||
// width: 100,
|
||||
// height: 200,
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
return TextSpan(
|
||||
children: spanChildren,
|
||||
);
|
||||
return TextSpan(children: spanChildren);
|
||||
}
|
||||
} catch (err) {
|
||||
debugPrint('❌rich_node_panel err: $err');
|
||||
|
||||
@@ -109,36 +109,14 @@ class _UpPanelState extends State<UpPanel> {
|
||||
feedBack();
|
||||
if (data.type == 'up') {
|
||||
widget.dynamicsController.currentMid = data.mid;
|
||||
// dynamicsController.mid.value = data.mid;
|
||||
widget.dynamicsController
|
||||
..upInfo.value = data
|
||||
..onSelectUp(data.mid);
|
||||
// int liveLen = liveList.length;
|
||||
// int upLen = upList.length;
|
||||
// double itemWidth = contentWidth + itemPadding.horizontal;
|
||||
// double screenWidth = MediaQuery.sizeOf(context).width;
|
||||
// double moveDistance = 0.0;
|
||||
// if (itemWidth * (upList.length + liveList.length) <= screenWidth) {
|
||||
// } else if ((upLen - i - 0.5) * itemWidth > screenWidth / 2) {
|
||||
// moveDistance =
|
||||
// (i + liveLen + 0.5) * itemWidth + 46 - screenWidth / 2;
|
||||
// } else {
|
||||
// moveDistance = (upLen + liveLen) * itemWidth + 46 - screenWidth;
|
||||
// }
|
||||
|
||||
data.hasUpdate = false;
|
||||
// scrollController.animateTo(
|
||||
// moveDistance,
|
||||
// duration: const Duration(milliseconds: 500),
|
||||
// curve: Curves.easeInOut,
|
||||
// );
|
||||
|
||||
setState(() {});
|
||||
} else if (data.type == 'live') {
|
||||
// LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||
// 'title': data.title,
|
||||
// 'uname': data.uname,
|
||||
// 'face': data.face,
|
||||
// 'roomid': data.roomId,
|
||||
// });
|
||||
Get.toNamed('/liveRoom?roomid=${data.roomId}');
|
||||
}
|
||||
},
|
||||
@@ -224,29 +202,6 @@ class _UpPanelState extends State<UpPanel> {
|
||||
}
|
||||
}
|
||||
|
||||
// class _SliverHeaderDelegate extends SliverPersistentHeaderDelegate {
|
||||
// _SliverHeaderDelegate({required this.height, required this.child});
|
||||
|
||||
// final double height;
|
||||
// final Widget child;
|
||||
|
||||
// @override
|
||||
// Widget build(
|
||||
// BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
// return child;
|
||||
// }
|
||||
|
||||
// @override
|
||||
// double get maxExtent => height;
|
||||
|
||||
// @override
|
||||
// double get minExtent => height;
|
||||
|
||||
// @override
|
||||
// bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) =>
|
||||
// true;
|
||||
// }
|
||||
|
||||
class UpPanelSkeleton extends StatelessWidget {
|
||||
const UpPanelSkeleton({super.key});
|
||||
|
||||
|
||||
@@ -55,16 +55,12 @@ Widget videoSeasonWidget(source, item, context, type, {floor = 1}) {
|
||||
double width = box.maxWidth;
|
||||
return Stack(
|
||||
children: [
|
||||
// Hero(
|
||||
// tag: content.bvid,
|
||||
// child:
|
||||
NetworkImgLayer(
|
||||
width: width,
|
||||
height: width / StyleString.aspectRatio,
|
||||
src: content.cover,
|
||||
semanticsLabel: content.title,
|
||||
),
|
||||
// ),
|
||||
if (content?.badge?['text'] != null)
|
||||
PBadge(
|
||||
text: content.badge['text'],
|
||||
@@ -161,22 +157,6 @@ Widget videoSeasonWidget(source, item, context, type, {floor = 1}) {
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
// const SizedBox(height: 4),
|
||||
/// fix #话题跟content重复
|
||||
// if (item.modules.moduleDynamic.topic != null) ...[
|
||||
// Padding(
|
||||
// padding: floor == 2
|
||||
// ? EdgeInsets.zero
|
||||
// : const EdgeInsets.only(left: 12, right: 12),
|
||||
// child: GestureDetector(
|
||||
// child: Text(
|
||||
// '#${item.modules.moduleDynamic.topic.name}',
|
||||
// style: authorStyle,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(height: 6),
|
||||
// ],
|
||||
if (floor == 2 && item.modules.moduleDynamic.desc != null) ...[
|
||||
if (richNodes != null) Text.rich(richNodes),
|
||||
const SizedBox(height: 6),
|
||||
|
||||
Reference in New Issue
Block a user