mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-17 23:56:13 +08:00
39 lines
857 B
Dart
39 lines
857 B
Dart
import 'package:PiliPlus/models/common/stat_type.dart';
|
|
import 'package:PiliPlus/utils/num_util.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class StatWidget extends StatelessWidget {
|
|
final StatType type;
|
|
final dynamic value;
|
|
final Color? color;
|
|
final double iconSize;
|
|
|
|
const StatWidget({
|
|
super.key,
|
|
required this.type,
|
|
required this.value,
|
|
this.color,
|
|
this.iconSize = 13,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Color color = this.color ??
|
|
Theme.of(context).colorScheme.outline.withValues(alpha: 0.8);
|
|
return Row(
|
|
spacing: 2,
|
|
children: [
|
|
Icon(
|
|
type.iconData,
|
|
size: iconSize,
|
|
color: color,
|
|
),
|
|
Text(
|
|
NumUtil.numFormat(value),
|
|
style: TextStyle(fontSize: 12, color: color),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|