feat: 图文动态详情页&评论渲染
This commit is contained in:
33
lib/common/widgets/badge.dart
Normal file
33
lib/common/widgets/badge.dart
Normal file
@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Widget pBadge(
|
||||
text,
|
||||
context,
|
||||
double? top,
|
||||
double? right,
|
||||
double? bottom,
|
||||
double? left, {
|
||||
type = 'primary',
|
||||
}) {
|
||||
Color bgColor = Theme.of(context).colorScheme.primary;
|
||||
Color color = Theme.of(context).colorScheme.onPrimary;
|
||||
if (type == 'gray') {
|
||||
bgColor = Colors.black54.withOpacity(0.4);
|
||||
color = Colors.white;
|
||||
}
|
||||
return Positioned(
|
||||
top: top,
|
||||
left: left,
|
||||
right: right,
|
||||
bottom: bottom,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 1, horizontal: 6),
|
||||
decoration:
|
||||
BoxDecoration(borderRadius: BorderRadius.circular(4), color: bgColor),
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(fontSize: 11, color: color),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
@ -2,6 +2,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/widgets/badge.dart';
|
||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||
import 'package:pilipala/http/search.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
@ -84,24 +85,13 @@ class VideoCardH extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
// Image.network( videoItem['pic'], width: double.infinity, height: double.infinity,),
|
||||
Positioned(
|
||||
right: 4,
|
||||
bottom: 4,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 1, horizontal: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(4),
|
||||
color:
|
||||
Colors.black54.withOpacity(0.4)),
|
||||
child: Text(
|
||||
Utils.timeFormat(videoItem.duration!),
|
||||
style: const TextStyle(
|
||||
fontSize: 11, color: Colors.white),
|
||||
),
|
||||
),
|
||||
)
|
||||
pBadge(Utils.timeFormat(videoItem.duration!),
|
||||
context, null, 6.0, 6.0, null,
|
||||
type: 'gray'),
|
||||
if (videoItem.rcmdReason != null &&
|
||||
videoItem.rcmdReason.content != '')
|
||||
pBadge(videoItem.rcmdReason.content,
|
||||
context, 6.0, 6.0, null, null),
|
||||
],
|
||||
);
|
||||
},
|
||||
@ -171,22 +161,22 @@ class VideoContent extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
const Spacer(),
|
||||
if (videoItem.rcmdReason != null &&
|
||||
videoItem.rcmdReason.content != '')
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 5),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.surfaceTint),
|
||||
),
|
||||
child: Text(
|
||||
videoItem.rcmdReason.content,
|
||||
style: TextStyle(
|
||||
fontSize: 9,
|
||||
color: Theme.of(context).colorScheme.surfaceTint),
|
||||
),
|
||||
),
|
||||
// if (videoItem.rcmdReason != null &&
|
||||
// videoItem.rcmdReason.content != '')
|
||||
// Container(
|
||||
// padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 5),
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(4),
|
||||
// border: Border.all(
|
||||
// color: Theme.of(context).colorScheme.surfaceTint),
|
||||
// ),
|
||||
// child: Text(
|
||||
// videoItem.rcmdReason.content,
|
||||
// style: TextStyle(
|
||||
// fontSize: 9,
|
||||
// color: Theme.of(context).colorScheme.surfaceTint),
|
||||
// ),
|
||||
// ),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
|
Reference in New Issue
Block a user