missing file stat screnn
This commit is contained in:
parent
f90f014f36
commit
634fd8d4d7
@ -431,18 +431,22 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTablesRow(StatsSummaryDTO stats) {
|
Widget _buildTablesRow(StatsSummaryDTO stats) {
|
||||||
return Row(
|
final tables = <Widget>[
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
if (stats.topPois.isNotEmpty) Expanded(child: _buildPoiTable(stats)),
|
||||||
children: [
|
if (stats.topAgendaEvents.isNotEmpty) Expanded(child: _buildAgendaTable(stats)),
|
||||||
if (stats.topPois.isNotEmpty) Expanded(child: _buildPoiTable(stats)),
|
if (stats.quizStats.isNotEmpty) Expanded(child: _buildQuizTable(stats)),
|
||||||
if (stats.topPois.isNotEmpty && stats.topAgendaEvents.isNotEmpty) const SizedBox(width: 12),
|
if (stats.gameStats.isNotEmpty) Expanded(child: _buildGameTable(stats)),
|
||||||
if (stats.topAgendaEvents.isNotEmpty) Expanded(child: _buildAgendaTable(stats)),
|
if (stats.topArticles.isNotEmpty) Expanded(child: _buildArticleTable(stats)),
|
||||||
if ((stats.topPois.isNotEmpty || stats.topAgendaEvents.isNotEmpty) && stats.quizStats.isNotEmpty) const SizedBox(width: 12),
|
if (stats.topMenuItems.isNotEmpty) Expanded(child: _buildMenuTable(stats)),
|
||||||
if (stats.quizStats.isNotEmpty) Expanded(child: _buildQuizTable(stats)),
|
if (stats.qrScans.totalScans > 0) Expanded(child: _buildQrCard(stats)),
|
||||||
if ((stats.topPois.isNotEmpty || stats.topAgendaEvents.isNotEmpty || stats.quizStats.isNotEmpty) && stats.gameStats.isNotEmpty) const SizedBox(width: 12),
|
];
|
||||||
if (stats.gameStats.isNotEmpty) Expanded(child: _buildGameTable(stats)),
|
if (tables.isEmpty) return const SizedBox();
|
||||||
],
|
final spaced = <Widget>[];
|
||||||
);
|
for (var i = 0; i < tables.length; i++) {
|
||||||
|
spaced.add(tables[i]);
|
||||||
|
if (i < tables.length - 1) spaced.add(const SizedBox(width: 12));
|
||||||
|
}
|
||||||
|
return Row(crossAxisAlignment: CrossAxisAlignment.start, children: spaced);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPoiTable(StatsSummaryDTO stats) {
|
Widget _buildPoiTable(StatsSummaryDTO stats) {
|
||||||
@ -475,6 +479,53 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
|
|||||||
]).toList());
|
]).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildArticleTable(StatsSummaryDTO stats) {
|
||||||
|
return _tableCard('Articles lus', ['Section', 'Lectures'], stats.topArticles.map((a) => [
|
||||||
|
a.sectionId ?? '—',
|
||||||
|
'${a.reads}',
|
||||||
|
]).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildMenuTable(StatsSummaryDTO stats) {
|
||||||
|
return _tableCard('Menu', ['Item', 'Taps'], stats.topMenuItems.map((m) => [
|
||||||
|
m.menuItemTitle ?? m.targetSectionId ?? '—',
|
||||||
|
'${m.taps}',
|
||||||
|
]).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildQrCard(StatsSummaryDTO stats) {
|
||||||
|
final qr = stats.qrScans;
|
||||||
|
return Card(
|
||||||
|
elevation: 0,
|
||||||
|
color: kWhite,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text('QR Scans', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: kPrimaryColor)),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
_qrRow(Icons.qr_code_scanner, 'Total', '${qr.totalScans}', kPrimaryColor),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
_qrRow(Icons.check_circle_outline, 'Valides', '${qr.validScans}', Colors.green.shade600),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
_qrRow(Icons.cancel_outlined, 'Invalides', '${qr.invalidScans}', Colors.red.shade400),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _qrRow(IconData icon, String label, String value, Color color) {
|
||||||
|
return Row(children: [
|
||||||
|
Icon(icon, size: 16, color: color),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Expanded(child: Text(label, style: TextStyle(fontSize: 13, color: kBodyTextColor))),
|
||||||
|
Text(value, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: color)),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _tableCard(String title, List<String> headers, List<List<String>> rows) {
|
Widget _tableCard(String title, List<String> headers, List<List<String>> rows) {
|
||||||
return Card(
|
return Card(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user