统一Badge组件 #9
This commit is contained in:
@ -161,13 +161,14 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
),
|
||||
if (bangumiItem != null &&
|
||||
bangumiItem!.rating != null)
|
||||
pBadge(
|
||||
'评分 ${!widget.loadingStatus ? widget.bangumiDetail!.rating!['score']! : bangumiItem!.rating!['score']!}',
|
||||
context,
|
||||
null,
|
||||
6,
|
||||
6,
|
||||
null),
|
||||
PBadge(
|
||||
text:
|
||||
'评分 ${!widget.loadingStatus ? widget.bangumiDetail!.rating!['score']! : bangumiItem!.rating!['score']!}',
|
||||
top: null,
|
||||
right: 6,
|
||||
bottom: 6,
|
||||
left: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
|
||||
@ -97,10 +97,21 @@ class BangumiCardV extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
if (bangumiItem.badge != null)
|
||||
pBadge(bangumiItem.badge, context, 6, 6, null, null),
|
||||
PBadge(
|
||||
text: bangumiItem.badge,
|
||||
top: 6,
|
||||
right: 6,
|
||||
bottom: null,
|
||||
left: null),
|
||||
if (bangumiItem.order != null)
|
||||
pBadge(bangumiItem.order, context, null, null, 6, 6,
|
||||
type: 'gray'),
|
||||
PBadge(
|
||||
text: bangumiItem.order,
|
||||
top: null,
|
||||
right: null,
|
||||
bottom: 6,
|
||||
left: 6,
|
||||
type: 'gray',
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
|
||||
@ -77,10 +77,21 @@ Widget liveRcmdPanel(item, context, {floor = 1}) {
|
||||
src: item.modules.moduleDynamic.major.liveRcmd.cover,
|
||||
),
|
||||
),
|
||||
pBadge(watchedShow['text_large'], context, 6, 56, null, null,
|
||||
type: 'gray'),
|
||||
pBadge(
|
||||
liveStatus == 1 ? '直播中' : '直播结束', context, 6, 6, null, null),
|
||||
PBadge(
|
||||
text: watchedShow['text_large'],
|
||||
top: 6,
|
||||
right: 56,
|
||||
bottom: null,
|
||||
left: null,
|
||||
type: 'gray',
|
||||
),
|
||||
PBadge(
|
||||
text: liveStatus == 1 ? '直播中' : '直播结束',
|
||||
top: 6,
|
||||
right: 6,
|
||||
bottom: null,
|
||||
left: null,
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
|
||||
@ -85,7 +85,14 @@ Widget picWidget(item, context) {
|
||||
children: list,
|
||||
),
|
||||
if (len == 1 && origAspectRatio < 0.4)
|
||||
pBadge('长图', context, null, null, 6.0, 6.0, type: 'gray')
|
||||
const PBadge(
|
||||
text: '长图',
|
||||
top: null,
|
||||
right: null,
|
||||
bottom: 6.0,
|
||||
left: 6.0,
|
||||
type: 'gray',
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -89,7 +89,13 @@ Widget videoSeasonWidget(item, context, type, {floor = 1}) {
|
||||
),
|
||||
),
|
||||
if (content.badge != null && type == 'pgc')
|
||||
pBadge(content.badge['text'], context, 8.0, 10.0, null, null),
|
||||
PBadge(
|
||||
text: content.badge['text'],
|
||||
top: 8.0,
|
||||
right: 10.0,
|
||||
bottom: null,
|
||||
left: null,
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
|
||||
@ -147,23 +147,26 @@ class HistoryItem extends StatelessWidget {
|
||||
if (!BusinessType
|
||||
.hiddenDurationType.hiddenDurationType
|
||||
.contains(videoItem.history.business))
|
||||
pBadge(
|
||||
videoItem.progress == -1
|
||||
? '已看完'
|
||||
: '${Utils.timeFormat(videoItem.progress!)}/${Utils.timeFormat(videoItem.duration!)}',
|
||||
context,
|
||||
null,
|
||||
6.0,
|
||||
6.0,
|
||||
null,
|
||||
type: 'gray'),
|
||||
PBadge(
|
||||
text: videoItem.progress == -1
|
||||
? '已看完'
|
||||
: '${Utils.timeFormat(videoItem.progress!)}/${Utils.timeFormat(videoItem.duration!)}',
|
||||
right: 6.0,
|
||||
bottom: 6.0,
|
||||
type: 'gray',
|
||||
),
|
||||
// 右上角
|
||||
if (BusinessType.showBadge.showBadge
|
||||
.contains(videoItem.history.business) ||
|
||||
videoItem.history.business ==
|
||||
BusinessType.live.type)
|
||||
pBadge(videoItem.badge, context, 6.0, 6.0,
|
||||
null, null),
|
||||
PBadge(
|
||||
text: videoItem.badge,
|
||||
top: 6.0,
|
||||
right: 6.0,
|
||||
bottom: null,
|
||||
left: null,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/widgets/badge.dart';
|
||||
import 'package:pilipala/models/live/item.dart';
|
||||
import 'package:pilipala/pages/video/detail/reply/widgets/reply_item.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
|
||||
@ -121,7 +121,12 @@ class LiveContent extends StatelessWidget {
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const UpTag(),
|
||||
const PBadge(
|
||||
text: 'UP',
|
||||
size: 'small',
|
||||
stack: 'normal',
|
||||
fs: 9,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
liveItem.uname,
|
||||
|
||||
@ -41,8 +41,13 @@ Widget searchMbangumiPanel(BuildContext context, ctr, list) {
|
||||
height: 148,
|
||||
src: i.cover,
|
||||
),
|
||||
pBadge(i.mediaType == 1 ? '番剧' : '国创', context, 6.0, 4.0,
|
||||
null, null)
|
||||
PBadge(
|
||||
text: i.mediaType == 1 ? '番剧' : '国创',
|
||||
top: 6.0,
|
||||
right: 4.0,
|
||||
bottom: null,
|
||||
left: null,
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/badge.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/models/common/reply_type.dart';
|
||||
import 'package:pilipala/models/video/reply/item.dart';
|
||||
@ -139,7 +140,13 @@ class ReplyItem extends StatelessWidget {
|
||||
height: 11,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
if (replyItem!.isUp!) const UpTag(),
|
||||
if (replyItem!.isUp!)
|
||||
const PBadge(
|
||||
text: 'UP',
|
||||
size: 'small',
|
||||
stack: 'normal',
|
||||
fs: 9,
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
@ -208,8 +215,15 @@ class ReplyItem extends StatelessWidget {
|
||||
children: [
|
||||
if (replyItem!.isTop!)
|
||||
const WidgetSpan(
|
||||
alignment: PlaceholderAlignment.top,
|
||||
child: UpTag(tagText: 'TOP')),
|
||||
alignment: PlaceholderAlignment.top,
|
||||
child: PBadge(
|
||||
text: 'TOP',
|
||||
size: 'small',
|
||||
stack: 'normal',
|
||||
type: 'line',
|
||||
fs: 9,
|
||||
),
|
||||
),
|
||||
buildContent(context, replyItem!, replyReply, null),
|
||||
],
|
||||
),
|
||||
@ -392,7 +406,12 @@ class ReplyItemRow extends StatelessWidget {
|
||||
if (replies![i].isUp)
|
||||
const WidgetSpan(
|
||||
alignment: PlaceholderAlignment.top,
|
||||
child: UpTag(),
|
||||
child: PBadge(
|
||||
text: 'UP',
|
||||
size: 'small',
|
||||
stack: 'normal',
|
||||
fs: 9,
|
||||
),
|
||||
),
|
||||
buildContent(
|
||||
context, replies![i], replyReply, replyItem),
|
||||
@ -759,32 +778,3 @@ InlineSpan buildContent(
|
||||
// spanChilds.add(TextSpan(text: matchMember));
|
||||
return TextSpan(children: spanChilds);
|
||||
}
|
||||
|
||||
class UpTag extends StatelessWidget {
|
||||
final String? tagText;
|
||||
const UpTag({super.key, this.tagText = 'UP'});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Color primary = Theme.of(context).colorScheme.primary;
|
||||
return Container(
|
||||
width: 24,
|
||||
height: 14,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
color: tagText == 'UP' ? primary : null,
|
||||
border: Border.all(color: primary)),
|
||||
margin: const EdgeInsets.only(right: 4),
|
||||
child: Center(
|
||||
child: Text(
|
||||
tagText!,
|
||||
style: TextStyle(
|
||||
fontSize: 9,
|
||||
color: tagText == 'UP'
|
||||
? Theme.of(context).colorScheme.onPrimary
|
||||
: primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user