Revert "chore: clean up"

This reverts commit 538494b7ec.
This commit is contained in:
bggRGjQaUbCoE
2025-04-20 18:04:06 +08:00
parent a5c7ec0d60
commit 6f4321ae14
90 changed files with 1814 additions and 493 deletions

View File

@@ -70,6 +70,7 @@ 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(
@@ -186,6 +187,7 @@ class DynamicsController extends GetxController
await controller.onRefresh();
}
// 返回顶部并刷新
@override
void animateToTop() async {
controller.animateToTop();

View File

@@ -31,6 +31,7 @@ import '../../../utils/grid.dart';
import '../widgets/dynamic_panel.dart';
class DynamicDetailPage extends StatefulWidget {
// const DynamicDetailPage({super.key});
const DynamicDetailPage({super.key});
@override
@@ -42,6 +43,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
late DynamicDetailController _dynamicDetailController;
AnimationController? _fabAnimationCtr;
final RxBool _visibleTitle = false.obs;
// String? action;
// 回复类型
late int replyType;
bool _isFabVisible = true;
@@ -122,6 +124,8 @@ 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;

View File

@@ -144,7 +144,10 @@ 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();
@@ -160,6 +163,7 @@ class _DynamicsTabPageState
DynamicPanel(
item: i,
onRemove: controller.onRemove,
// onSetTop: controller.onSetTop,
),
] else ...[
for (var i in loadingState.response!)
@@ -168,6 +172,7 @@ class _DynamicsTabPageState
DynamicPanel(
item: i,
onRemove: controller.onRemove,
// onSetTop: controller.onSetTop,
),
]
],
@@ -193,6 +198,7 @@ class _DynamicsTabPageState
return DynamicPanel(
item: item,
onRemove: controller.onRemove,
// onSetTop: controller.onSetTop,
);
}
return const SizedBox.shrink();

View File

@@ -131,6 +131,7 @@ Widget addWidget(item, context, type, {floor = 1}) {
)
],
),
// TextButton(onPressed: () {}, child: Text('123'))
),
),
)
@@ -139,6 +140,60 @@ 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':

View File

@@ -84,6 +84,7 @@ 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 &&
@@ -144,6 +145,20 @@ 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,
@@ -183,6 +198,7 @@ class AuthorPanel extends StatelessWidget {
),
],
),
// ),
_moreWidget(context),
],
)
@@ -266,6 +282,7 @@ class AuthorPanel extends StatelessWidget {
}
},
minLeadingWidth: 0,
// dense: true,
leading: const Icon(Icons.watch_later_outlined, size: 19),
title: Text(
'稍后再看',

View File

@@ -66,6 +66,7 @@ Widget content(bool isSave, BuildContext context, item, source, callback) {
item.modules.moduleDynamic.major.opus.pics.isNotEmpty)
Text.rich(
picsNodes(),
// semanticsLabel: '动态图片',
),
],
),

View File

@@ -29,6 +29,9 @@ 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)
@@ -43,7 +46,11 @@ 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' &&
[

View File

@@ -106,6 +106,22 @@ 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,
@@ -124,7 +140,10 @@ 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),
],
@@ -187,6 +206,11 @@ 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(

View File

@@ -40,6 +40,9 @@ 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)));
@@ -286,7 +289,121 @@ InlineSpan? richNode(item, BuildContext context) {
}
}
return TextSpan(children: spanChildren);
// 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,
);
}
} catch (err) {
debugPrint('❌rich_node_panel err: $err');

View File

@@ -109,14 +109,36 @@ 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}');
}
},
@@ -202,6 +224,29 @@ 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});

View File

@@ -55,12 +55,16 @@ 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'],
@@ -157,6 +161,22 @@ 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),