feat: suite de tiendas, sync reactivo, bitácora de errores y alertas whatsapp

This commit is contained in:
Pablinux
2026-11-22 17:41:18 -05:00
parent cc4ab12d1d
commit 6a5ebb907d
76 changed files with 2975 additions and 312 deletions
+20 -4
View File
@@ -7,6 +7,8 @@ import '../../theme/app_theme.dart';
import '../../widgets/stat_card.dart';
import '../../models/pedido.dart';
import '../notificaciones/notificaciones_screen.dart';
// Botón reactivo de sincronización y estado cloud en AppBar
import '../../widgets/sync_status_button.dart';
class HomeScreen extends StatelessWidget {
const HomeScreen({Key? key}) : super(key: key);
@@ -15,12 +17,24 @@ class HomeScreen extends StatelessWidget {
Widget build(BuildContext context) {
final provider = context.watch<AppProvider>();
final notifService = context.watch<NotificationService>();
final fmt = NumberFormat.currency(locale: 'en_US', symbol: '\$', decimalDigits: 2);
final fmt = provider.currencyFormat;
return Scaffold(
backgroundColor: AppTheme.bgColor,
body: RefreshIndicator(
onRefresh: () async => await Future.delayed(const Duration(milliseconds: 600)),
// Sincronización manual reactiva al deslizar hacia abajo
onRefresh: () async {
final res = await provider.sincronizarManual();
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(res.mensaje),
duration: const Duration(seconds: 3),
backgroundColor: res.ok ? const Color(0xFF10B981) : const Color(0xFFF59E0B),
),
);
}
},
child: CustomScrollView(
slivers: [
_buildSliverAppBar(context, provider, notifService),
@@ -62,6 +76,8 @@ class HomeScreen extends StatelessWidget {
pinned: true,
backgroundColor: AppTheme.primaryColor,
actions: [
// Indicador y botón interactivo de sincronización con la nube
const SyncStatusButton(),
Stack(
alignment: Alignment.center,
children: [
@@ -524,8 +540,8 @@ class HomeScreen extends StatelessWidget {
ElevatedButton(
onPressed: () => notifService.dispararDemo(),
style: ElevatedButton.styleFrom(
primary: Colors.white,
onPrimary: const Color(0xFF7C3AED),
backgroundColor: Colors.white,
foregroundColor: const Color(0xFF7C3AED),
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
elevation: 0,