mod: 动态内容完善
This commit is contained in:
@ -299,6 +299,7 @@ class DynamicMajorModel {
|
||||
this.opus,
|
||||
this.pgc,
|
||||
this.liveRcmd,
|
||||
this.live,
|
||||
this.none,
|
||||
this.type,
|
||||
});
|
||||
@ -309,6 +310,7 @@ class DynamicMajorModel {
|
||||
DynamicOpusModel? opus;
|
||||
DynamicArchiveModel? pgc;
|
||||
DynamicLiveModel? liveRcmd;
|
||||
DynamicLive2Model? live;
|
||||
DynamicNoneModel? none;
|
||||
// MAJOR_TYPE_DRAW 图片
|
||||
// MAJOR_TYPE_ARCHIVE 视频
|
||||
@ -331,6 +333,8 @@ class DynamicMajorModel {
|
||||
liveRcmd = json['live_rcmd'] != null
|
||||
? DynamicLiveModel.fromJson(json['live_rcmd'])
|
||||
: null;
|
||||
live =
|
||||
json['live'] != null ? DynamicLive2Model.fromJson(json['live']) : null;
|
||||
none =
|
||||
json['none'] != null ? DynamicNoneModel.fromJson(json['none']) : null;
|
||||
type = json['type'];
|
||||
@ -594,6 +598,42 @@ class DynamicLiveModel {
|
||||
}
|
||||
}
|
||||
|
||||
class DynamicLive2Model {
|
||||
DynamicLive2Model({
|
||||
this.badge,
|
||||
this.cover,
|
||||
this.descFirst,
|
||||
this.descSecond,
|
||||
this.id,
|
||||
this.jumpUrl,
|
||||
this.liveState,
|
||||
this.reserveType,
|
||||
this.title,
|
||||
});
|
||||
|
||||
Map? badge;
|
||||
String? cover;
|
||||
String? descFirst;
|
||||
String? descSecond;
|
||||
int? id;
|
||||
String? jumpUrl;
|
||||
int? liveState;
|
||||
int? reserveType;
|
||||
String? title;
|
||||
|
||||
DynamicLive2Model.fromJson(Map<String, dynamic> json) {
|
||||
badge = json['badge'];
|
||||
cover = json['cover'];
|
||||
descFirst = json['desc_first'];
|
||||
descSecond = json['desc_second'];
|
||||
id = json['id'];
|
||||
jumpUrl = json['jump_url'];
|
||||
liveState = json['liv_state'];
|
||||
reserveType = json['reserve_type'];
|
||||
title = json['title'];
|
||||
}
|
||||
}
|
||||
|
||||
// 动态状态 转发、评论、点赞
|
||||
class ModuleStatModel {
|
||||
ModuleStatModel({
|
||||
|
46
lib/pages/dynamics/widgets/additional_panel.dart
Normal file
46
lib/pages/dynamics/widgets/additional_panel.dart
Normal file
@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
|
||||
Widget addWidget(item, context, type, {floor = 1}) {
|
||||
Map<dynamic, dynamic> dynamicProperty = {
|
||||
'ADDITIONAL_TYPE_UGC': item.modules.moduleDynamic.additional.ugc,
|
||||
};
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 15, top: 10, right: 15, bottom: 8),
|
||||
color: Theme.of(context).dividerColor.withOpacity(0.08),
|
||||
child: Row(
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: 120,
|
||||
height: 75,
|
||||
src: dynamicProperty[type].cover,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
dynamicProperty[type].title,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
dynamicProperty[type].descSecond,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
@ -3,7 +3,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
import 'additional_panel.dart';
|
||||
import 'article_panel.dart';
|
||||
import 'live_panel.dart';
|
||||
import 'live_rcmd_panel.dart';
|
||||
import 'pic_panel.dart';
|
||||
import 'rich_node_panel.dart';
|
||||
@ -88,6 +90,8 @@ Widget forWard(item, context, ctr, source, {floor = 1}) {
|
||||
// 直播
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
return liveRcmdPanel(item, context, floor: floor);
|
||||
case 'DYNAMIC_TYPE_LIVE':
|
||||
return livePanel(item, context, floor: floor);
|
||||
// 合集
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
return videoSeasonWidget(item, context, 'ugcSeason');
|
||||
@ -119,9 +123,18 @@ Widget forWard(item, context, ctr, source, {floor = 1}) {
|
||||
Text(item.modules.moduleDynamic.desc.text)
|
||||
],
|
||||
)
|
||||
: const SizedBox(height: 0);
|
||||
: item.modules.moduleDynamic.additional != null
|
||||
? addWidget(
|
||||
item,
|
||||
context,
|
||||
item.modules.moduleDynamic.additional.type,
|
||||
floor: floor,
|
||||
)
|
||||
: const SizedBox(height: 0);
|
||||
case 'DYNAMIC_TYPE_PGC':
|
||||
return videoSeasonWidget(item, context, 'pgc', floor: floor);
|
||||
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||
return videoSeasonWidget(item, context, 'pgc', floor: floor);
|
||||
case 'DYNAMIC_TYPE_NONE':
|
||||
return Row(
|
||||
children: [
|
||||
|
99
lib/pages/dynamics/widgets/live_panel.dart
Normal file
99
lib/pages/dynamics/widgets/live_panel.dart
Normal file
@ -0,0 +1,99 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
import 'rich_node_panel.dart';
|
||||
|
||||
Widget livePanel(item, context, {floor = 1}) {
|
||||
dynamic content = item.modules.moduleDynamic.major;
|
||||
TextStyle authorStyle =
|
||||
TextStyle(color: Theme.of(context).colorScheme.primary);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (floor == 2) ...[
|
||||
Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {},
|
||||
child: Text(
|
||||
'@${item.modules.moduleAuthor.name}',
|
||||
style: authorStyle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
Utils.dateFormat(item.modules.moduleAuthor.pubTs),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
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) ...[
|
||||
Text.rich(richNode(item, context)),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
GestureDetector(
|
||||
onTap: () {},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: 120,
|
||||
height: 75,
|
||||
src: content.live.cover,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
content.live.title,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
content.live.descFirst,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Text(
|
||||
content.live.badge['text'],
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user