mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: show dyn blocked item
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -166,6 +166,7 @@ class ModuleBlocked {
|
|||||||
BgImg? bgImg;
|
BgImg? bgImg;
|
||||||
int? blockedType;
|
int? blockedType;
|
||||||
Button? button;
|
Button? button;
|
||||||
|
String? title;
|
||||||
String? hintMessage;
|
String? hintMessage;
|
||||||
BgImg? icon;
|
BgImg? icon;
|
||||||
|
|
||||||
@@ -173,6 +174,7 @@ class ModuleBlocked {
|
|||||||
bgImg = json['bg_img'] == null ? null : BgImg.fromJson(json['bg_img']);
|
bgImg = json['bg_img'] == null ? null : BgImg.fromJson(json['bg_img']);
|
||||||
blockedType = json['blocked_type'];
|
blockedType = json['blocked_type'];
|
||||||
button = json['button'] == null ? null : Button.fromJson(json['button']);
|
button = json['button'] == null ? null : Button.fromJson(json['button']);
|
||||||
|
title = json['title'];
|
||||||
hintMessage = json['hint_message'];
|
hintMessage = json['hint_message'];
|
||||||
icon = json['icon'] == null ? null : BgImg.fromJson(json['icon']);
|
icon = json['icon'] == null ? null : BgImg.fromJson(json['icon']);
|
||||||
}
|
}
|
||||||
@@ -533,7 +535,7 @@ class DynamicMajorModel {
|
|||||||
Map? courses;
|
Map? courses;
|
||||||
Map? common;
|
Map? common;
|
||||||
Map? music;
|
Map? music;
|
||||||
Map? blocked;
|
ModuleBlocked? blocked;
|
||||||
Map? medialist;
|
Map? medialist;
|
||||||
|
|
||||||
DynamicMajorModel.fromJson(Map<String, dynamic> json) {
|
DynamicMajorModel.fromJson(Map<String, dynamic> json) {
|
||||||
@@ -560,7 +562,9 @@ class DynamicMajorModel {
|
|||||||
courses = json['courses'] ?? {};
|
courses = json['courses'] ?? {};
|
||||||
common = json['common'] ?? {};
|
common = json['common'] ?? {};
|
||||||
music = json['music'] ?? {};
|
music = json['music'] ?? {};
|
||||||
blocked = json['blocked'];
|
blocked = json['blocked'] == null
|
||||||
|
? null
|
||||||
|
: ModuleBlocked.fromJson(json['blocked']);
|
||||||
medialist = json['medialist'];
|
medialist = json['medialist'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -349,8 +349,9 @@ class _ArticlePageState extends State<ArticlePage>
|
|||||||
debugPrint('moduleBlocked');
|
debugPrint('moduleBlocked');
|
||||||
final moduleBlocked =
|
final moduleBlocked =
|
||||||
_articleCtr.opusData!.modules.moduleBlocked!;
|
_articleCtr.opusData!.modules.moduleBlocked!;
|
||||||
final width = maxWidth * 0.8;
|
content = SliverToBoxAdapter(
|
||||||
content = moduleBlockedItem(moduleBlocked, width);
|
child: moduleBlockedItem(theme, moduleBlocked, maxWidth),
|
||||||
|
);
|
||||||
} else if (_articleCtr.articleData?.content != null) {
|
} else if (_articleCtr.articleData?.content != null) {
|
||||||
debugPrint('html page');
|
debugPrint('html page');
|
||||||
final res = parser.parse(_articleCtr.articleData!.content!);
|
final res = parser.parse(_articleCtr.articleData!.content!);
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:PiliPlus/common/constants.dart';
|
import 'package:PiliPlus/common/constants.dart';
|
||||||
import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart'
|
import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart'
|
||||||
show SourceModel;
|
show SourceModel;
|
||||||
@@ -286,14 +288,16 @@ class OpusContent extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget moduleBlockedItem(ModuleBlocked moduleBlocked, double width) {
|
Widget moduleBlockedItem(
|
||||||
return SliverToBoxAdapter(
|
ThemeData theme, ModuleBlocked moduleBlocked, double maxWidth) {
|
||||||
child: Stack(
|
if (moduleBlocked.blockedType == 1) {
|
||||||
|
maxWidth = min(400, maxWidth * 0.8);
|
||||||
|
return Stack(
|
||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
if (moduleBlocked.bgImg != null)
|
if (moduleBlocked.bgImg != null)
|
||||||
CachedNetworkImage(
|
CachedNetworkImage(
|
||||||
width: width,
|
width: maxWidth,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
imageUrl: Utils.thumbnailImgUrl(
|
imageUrl: Utils.thumbnailImgUrl(
|
||||||
Get.isDarkMode
|
Get.isDarkMode
|
||||||
@@ -302,15 +306,15 @@ Widget moduleBlockedItem(ModuleBlocked moduleBlocked, double width) {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
width: width,
|
width: maxWidth,
|
||||||
height: width,
|
height: maxWidth,
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
if (moduleBlocked.icon != null)
|
if (moduleBlocked.icon != null)
|
||||||
CachedNetworkImage(
|
CachedNetworkImage(
|
||||||
width: width / 7,
|
width: maxWidth / 7,
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
imageUrl: Utils.thumbnailImgUrl(
|
imageUrl: Utils.thumbnailImgUrl(
|
||||||
Get.isDarkMode
|
Get.isDarkMode
|
||||||
@@ -323,6 +327,9 @@ Widget moduleBlockedItem(ModuleBlocked moduleBlocked, double width) {
|
|||||||
Text(
|
Text(
|
||||||
moduleBlocked.hintMessage!,
|
moduleBlocked.hintMessage!,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: theme.colorScheme.outline,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
if (moduleBlocked.button != null) ...[
|
if (moduleBlocked.button != null) ...[
|
||||||
@@ -359,6 +366,98 @@ Widget moduleBlockedItem(ModuleBlocked moduleBlocked, double width) {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
|
}
|
||||||
|
return Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
if (moduleBlocked.bgImg != null)
|
||||||
|
CachedNetworkImage(
|
||||||
|
width: maxWidth,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
imageUrl: Utils.thumbnailImgUrl(
|
||||||
|
Get.isDarkMode
|
||||||
|
? moduleBlocked.bgImg!.imgDark
|
||||||
|
: moduleBlocked.bgImg!.imgDay,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
if (moduleBlocked.icon != null) ...[
|
||||||
|
CachedNetworkImage(
|
||||||
|
width: 42,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
imageUrl: Utils.thumbnailImgUrl(
|
||||||
|
Get.isDarkMode
|
||||||
|
? moduleBlocked.icon!.imgDark
|
||||||
|
: moduleBlocked.icon!.imgDay,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
],
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (moduleBlocked.title != null)
|
||||||
|
Text(
|
||||||
|
moduleBlocked.title!,
|
||||||
|
),
|
||||||
|
if (moduleBlocked.hintMessage != null) ...[
|
||||||
|
const SizedBox(height: 2),
|
||||||
|
Text(
|
||||||
|
moduleBlocked.hintMessage!,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: theme.colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (moduleBlocked.button != null) ...[
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
FilledButton.tonal(
|
||||||
|
style: FilledButton.styleFrom(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
|
visualDensity:
|
||||||
|
const VisualDensity(vertical: -3, horizontal: -4),
|
||||||
|
backgroundColor: Get.isDarkMode
|
||||||
|
? const Color(0xFF8F0030)
|
||||||
|
: const Color(0xFFFF6699),
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
shape: const RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(6))),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
if (moduleBlocked.button!.jumpUrl != null) {
|
||||||
|
PiliScheme.routePushFromUrl(moduleBlocked.button!.jumpUrl!);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (moduleBlocked.button!.icon != null)
|
||||||
|
CachedNetworkImage(
|
||||||
|
height: 16,
|
||||||
|
color: Colors.white,
|
||||||
|
imageUrl: moduleBlocked.button!.icon!,
|
||||||
|
),
|
||||||
|
Text(moduleBlocked.button!.text ?? ''),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:PiliPlus/common/widgets/badge.dart';
|
|||||||
import 'package:PiliPlus/common/widgets/image_save.dart';
|
import 'package:PiliPlus/common/widgets/image_save.dart';
|
||||||
import 'package:PiliPlus/common/widgets/image_view.dart';
|
import 'package:PiliPlus/common/widgets/image_view.dart';
|
||||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||||
|
import 'package:PiliPlus/pages/article/widgets/opus_content.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -43,31 +44,13 @@ InlineSpan picsNodes(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _blockedItem(ThemeData theme, DynamicItemModel item, String? source) {
|
Widget _blockedItem(ThemeData theme, ModuleBlocked moduleBlocked) {
|
||||||
return Container(
|
return Padding(
|
||||||
width: double.infinity,
|
padding: EdgeInsets.symmetric(horizontal: 13, vertical: 1),
|
||||||
padding: EdgeInsets.only(
|
child: LayoutBuilder(
|
||||||
left: 12, right: 12, bottom: source == 'detail' ? 8 : 0),
|
builder: (context, constraints) {
|
||||||
child: Column(
|
return moduleBlockedItem(theme, moduleBlocked, constraints.maxWidth);
|
||||||
mainAxisSize: MainAxisSize.min,
|
},
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
if (item.modules.moduleDynamic!.major!.blocked!['title'] != null)
|
|
||||||
Text(
|
|
||||||
item.modules.moduleDynamic!.major!.blocked!['title'],
|
|
||||||
style: TextStyle(
|
|
||||||
color: theme.colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (item.modules.moduleDynamic!.major!.blocked!['hint_message'] != null)
|
|
||||||
Text(
|
|
||||||
item.modules.moduleDynamic!.major!.blocked!['hint_message'],
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: theme.colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -153,7 +136,7 @@ Widget forWard(
|
|||||||
floor: floor,
|
floor: floor,
|
||||||
),
|
),
|
||||||
if (item.modules.moduleDynamic?.major?.blocked != null)
|
if (item.modules.moduleDynamic?.major?.blocked != null)
|
||||||
_blockedItem(theme, item, source),
|
_blockedItem(theme, item.modules.moduleDynamic!.major!.blocked!),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
// 视频
|
// 视频
|
||||||
@@ -165,35 +148,7 @@ Widget forWard(
|
|||||||
return item.isForwarded == true
|
return item.isForwarded == true
|
||||||
? articlePanel(theme, source, item, context, callback, floor: floor)
|
? articlePanel(theme, source, item, context, callback, floor: floor)
|
||||||
: item.modules.moduleDynamic?.major?.blocked != null
|
: item.modules.moduleDynamic?.major?.blocked != null
|
||||||
? Padding(
|
? _blockedItem(theme, item.modules.moduleDynamic!.major!.blocked!)
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
if (item.modules.moduleDynamic?.major
|
|
||||||
?.blocked?['title'] !=
|
|
||||||
null)
|
|
||||||
Text(
|
|
||||||
item.modules.moduleDynamic!.major!.blocked!['title'],
|
|
||||||
style: TextStyle(
|
|
||||||
color: theme.colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (item.modules.moduleDynamic?.major
|
|
||||||
?.blocked?['hint_message'] !=
|
|
||||||
null)
|
|
||||||
Text(
|
|
||||||
item.modules.moduleDynamic!.major!
|
|
||||||
.blocked!['hint_message'],
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: theme.colorScheme.outline,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: const SizedBox.shrink();
|
: const SizedBox.shrink();
|
||||||
// 转发
|
// 转发
|
||||||
case 'DYNAMIC_TYPE_FORWARD':
|
case 'DYNAMIC_TYPE_FORWARD':
|
||||||
@@ -307,7 +262,8 @@ Widget forWard(
|
|||||||
floor: floor,
|
floor: floor,
|
||||||
)
|
)
|
||||||
: item.modules.moduleDynamic?.major?.blocked != null
|
: item.modules.moduleDynamic?.major?.blocked != null
|
||||||
? _blockedItem(theme, item, source)
|
? _blockedItem(
|
||||||
|
theme, item.modules.moduleDynamic!.major!.blocked!)
|
||||||
: const SizedBox(height: 0);
|
: const SizedBox(height: 0);
|
||||||
case 'DYNAMIC_TYPE_PGC':
|
case 'DYNAMIC_TYPE_PGC':
|
||||||
return videoSeasonWidget(theme, source, item, context, 'pgc',
|
return videoSeasonWidget(theme, source, item, context, 'pgc',
|
||||||
|
|||||||
Reference in New Issue
Block a user