61 lines
1.8 KiB
Dart
61 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:arcx/app/app_theme.dart';
|
|
import 'package:arcx/features/scoring/presentation/widgets/hit_point_painter.dart';
|
|
import 'package:arcx/features/stats/application/stats.dart';
|
|
|
|
class HeatmapCard extends StatelessWidget {
|
|
const HeatmapCard({super.key, required this.stats});
|
|
|
|
final StatsSummary stats;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final hasHits = stats.hitPoints.isNotEmpty;
|
|
return Card(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const Text(
|
|
'落点热力图',
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
|
),
|
|
const SizedBox(height: 12),
|
|
Center(
|
|
child: AspectRatio(
|
|
aspectRatio: 1,
|
|
child: Stack(
|
|
fit: StackFit.expand,
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Image.asset(
|
|
'assets/images/target_face.png',
|
|
fit: BoxFit.fill,
|
|
),
|
|
CustomPaint(
|
|
painter: HitPointPainter(
|
|
hitPoints: stats.hitPoints,
|
|
hitColor: AppTheme.hitPoint,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
if (!hasHits)
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 8),
|
|
child: Text(
|
|
'暂无落点数据,完成一次记分后展示',
|
|
style: TextStyle(fontSize: 13, color: AppTheme.textSecondary),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|