mod: 动态页面内容补充
This commit is contained in:
@ -1,46 +1,150 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
|
||||
/// TODO 点击跳转
|
||||
Widget addWidget(item, context, type, {floor = 1}) {
|
||||
Map<dynamic, dynamic> dynamicProperty = {
|
||||
'ADDITIONAL_TYPE_UGC': item.modules.moduleDynamic.additional.ugc,
|
||||
// 直播预约
|
||||
'ADDITIONAL_TYPE_RESERVE': item.modules.moduleDynamic.additional.reserve,
|
||||
// 商品
|
||||
'ADDITIONAL_TYPE_GOODS': item.modules.moduleDynamic.additional.goods,
|
||||
// 比赛信息
|
||||
'ADDITIONAL_TYPE_MATCH': item.modules.moduleDynamic.additional.match,
|
||||
// 游戏信息
|
||||
'ADDITIONAL_TYPE_COMMON': item.modules.moduleDynamic.additional.common,
|
||||
};
|
||||
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,
|
||||
Color bgColor = floor == 1
|
||||
? Theme.of(context).dividerColor.withOpacity(0.08)
|
||||
: Theme.of(context).colorScheme.background;
|
||||
switch (type) {
|
||||
case 'ADDITIONAL_TYPE_UGC':
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 15, top: 10, right: 15, bottom: 8),
|
||||
color: bgColor,
|
||||
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,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
dynamicProperty[type].descSecond,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
),
|
||||
);
|
||||
case 'ADDITIONAL_TYPE_RESERVE':
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(top: 8),
|
||||
padding:
|
||||
const EdgeInsets.only(left: 15, top: 12, right: 15, bottom: 10),
|
||||
color: bgColor,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(dynamicProperty[type].title),
|
||||
Text.rich(TextSpan(
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.fontSize),
|
||||
children: [
|
||||
TextSpan(text: dynamicProperty[type].desc1['text']),
|
||||
TextSpan(text: dynamicProperty[type].desc2['text']),
|
||||
]))
|
||||
],
|
||||
),
|
||||
// TextButton(onPressed: () {}, child: Text('123'))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
case 'ADDITIONAL_TYPE_GOODS':
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(top: 6),
|
||||
padding: const EdgeInsets.only(left: 15, top: 10, right: 15, bottom: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: 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 SizedBox();
|
||||
case 'ADDITIONAL_TYPE_COMMON':
|
||||
return SizedBox();
|
||||
default:
|
||||
return Text('11');
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,13 @@ Widget forWard(item, context, ctr, source, {floor = 1}) {
|
||||
: const EdgeInsets.only(left: 12, right: 12),
|
||||
child: picWidget(item, context),
|
||||
),
|
||||
if (item.modules.moduleDynamic.additional != null)
|
||||
addWidget(
|
||||
item,
|
||||
context,
|
||||
item.modules.moduleDynamic.additional.type,
|
||||
floor: floor,
|
||||
)
|
||||
],
|
||||
);
|
||||
// 视频
|
||||
|
Reference in New Issue
Block a user