opt: stat组件传参
This commit is contained in:
@ -6,7 +6,7 @@ class StatDanMu extends StatelessWidget {
|
||||
final dynamic danmu;
|
||||
final String? size;
|
||||
|
||||
const StatDanMu({Key? key, this.theme, this.danmu, this.size})
|
||||
const StatDanMu({Key? key, this.theme = 'gray', this.danmu, this.size})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
@ -17,21 +17,46 @@ class StatDanMu extends StatelessWidget {
|
||||
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
|
||||
};
|
||||
Color color = colorObject[theme]!;
|
||||
return StatIconText(
|
||||
icon: Icons.subtitles_outlined,
|
||||
text: Utils.numFormat(danmu!),
|
||||
color: color,
|
||||
size: size,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class StatIconText extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String text;
|
||||
final Color color;
|
||||
final String? size;
|
||||
|
||||
const StatIconText({
|
||||
Key? key,
|
||||
required this.icon,
|
||||
required this.text,
|
||||
required this.color,
|
||||
this.size,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.subtitles_outlined,
|
||||
icon,
|
||||
size: 14,
|
||||
color: color,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
Utils.numFormat(danmu!),
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: size == 'medium' ? 12 : 11,
|
||||
color: color,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -6,8 +6,12 @@ class StatView extends StatelessWidget {
|
||||
final dynamic view;
|
||||
final String? size;
|
||||
|
||||
const StatView({Key? key, this.theme, this.view, this.size})
|
||||
: super(key: key);
|
||||
const StatView({
|
||||
Key? key,
|
||||
this.theme = 'gray',
|
||||
this.view,
|
||||
this.size,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -17,16 +21,41 @@ class StatView extends StatelessWidget {
|
||||
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
|
||||
};
|
||||
Color color = colorObject[theme]!;
|
||||
return StatIconText(
|
||||
icon: Icons.play_circle_outlined,
|
||||
text: Utils.numFormat(view!),
|
||||
color: color,
|
||||
size: size,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class StatIconText extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String text;
|
||||
final Color color;
|
||||
final String? size;
|
||||
|
||||
const StatIconText({
|
||||
Key? key,
|
||||
required this.icon,
|
||||
required this.text,
|
||||
required this.color,
|
||||
this.size,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.play_circle_outlined,
|
||||
icon,
|
||||
size: 13,
|
||||
color: color,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
Utils.numFormat(view!),
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: size == 'medium' ? 12 : 11,
|
||||
color: color,
|
||||
|
Reference in New Issue
Block a user