64 lines
2.0 KiB
Dart
64 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:arcx/app/app_theme.dart';
|
|
import 'package:arcx/data/local/models/models.dart';
|
|
import 'package:arcx/features/scoring/presentation/widgets/target_face_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: hasHits
|
|
? CustomPaint(
|
|
painter: TargetFacePainter(
|
|
hitPoints: stats.hitPoints,
|
|
hitColor: AppTheme.hitPoint,
|
|
),
|
|
child: const SizedBox.expand(),
|
|
)
|
|
: CustomPaint(
|
|
painter: TargetFacePainter(
|
|
hitPoints: const [],
|
|
showAllHits: false,
|
|
),
|
|
child: const SizedBox.expand(),
|
|
),
|
|
),
|
|
),
|
|
if (!hasHits)
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 8),
|
|
child: Text(
|
|
'暂无落点数据,完成一次记分后展示',
|
|
style: TextStyle(
|
|
fontSize: 13,
|
|
color: AppTheme.textSecondary,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|