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),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user