feat: submenu tactico (camaras, rastreo OSM/CartoDB), comunicacion, consola datos SQLite, clientes tipo_servicio y documentacion estandar
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'dart:math' as math;
|
||||
import 'package:flutter/material.dart';
|
||||
import '../theme.dart';
|
||||
import '../db/dao/incidentes_dao.dart';
|
||||
@@ -160,9 +161,14 @@ class _ReportesPageState extends State<ReportesPage> {
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Tarjetas KPI de resumen
|
||||
// Comentario explicativo: Cálculo responsivo con protección contra anchos negativos (math.max) para evitar errores BoxConstraints en primer renderizado
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
if (constraints.maxWidth <= 0) return const SizedBox.shrink();
|
||||
final isDesktop = constraints.maxWidth > 700;
|
||||
final cardWidth = isDesktop
|
||||
? math.max(0.0, (constraints.maxWidth - 36) / 4)
|
||||
: math.max(0.0, (constraints.maxWidth - 12) / 2);
|
||||
return Wrap(
|
||||
spacing: 12,
|
||||
runSpacing: 12,
|
||||
@@ -172,28 +178,28 @@ class _ReportesPageState extends State<ReportesPage> {
|
||||
valor: '$total',
|
||||
icono: Icons.analytics_outlined,
|
||||
color: AppColors.primary,
|
||||
width: isDesktop ? (constraints.maxWidth - 36) / 4 : (constraints.maxWidth - 12) / 2,
|
||||
width: cardWidth,
|
||||
),
|
||||
_buildStatCard(
|
||||
title: 'Resueltos ($tasaEfectividad%)',
|
||||
valor: '$resueltos',
|
||||
icono: Icons.task_alt,
|
||||
color: AppColors.clienteOk,
|
||||
width: isDesktop ? (constraints.maxWidth - 36) / 4 : (constraints.maxWidth - 12) / 2,
|
||||
width: cardWidth,
|
||||
),
|
||||
_buildStatCard(
|
||||
title: 'En Atención / Pendientes',
|
||||
valor: '$pendientes',
|
||||
icono: Icons.warning_amber_rounded,
|
||||
color: pendientes > 0 ? AppColors.alarmaActiva : AppColors.outline,
|
||||
width: isDesktop ? (constraints.maxWidth - 36) / 4 : (constraints.maxWidth - 12) / 2,
|
||||
width: cardWidth,
|
||||
),
|
||||
_buildStatCard(
|
||||
title: 'Falsas Alarmas',
|
||||
valor: '$falsas',
|
||||
icono: Icons.verified_user_outlined,
|
||||
color: AppColors.secondary,
|
||||
width: isDesktop ? (constraints.maxWidth - 36) / 4 : (constraints.maxWidth - 12) / 2,
|
||||
width: cardWidth,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user