feat: suite de tiendas, sync reactivo, bitácora de errores y alertas whatsapp
This commit is contained in:
@@ -29,7 +29,7 @@ class _CatalogoScreenState extends State<CatalogoScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final provider = context.watch<AppProvider>();
|
||||
final fmt = NumberFormat.currency(locale: 'en_US', symbol: '\$', decimalDigits: 2);
|
||||
final fmt = provider.currencyFormat;
|
||||
|
||||
final filtrados = provider.productos.where((p) {
|
||||
final matchCat = _categoriaSeleccionada == 'Todos' || p.categoria == _categoriaSeleccionada;
|
||||
|
||||
@@ -38,8 +38,8 @@ class _ClienteSelectorScreenState extends State<ClienteSelectorScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// Autofocus al abrir
|
||||
WidgetsBinding.instance!.addPostFrameCallback((_) => _focusNode.requestFocus());
|
||||
// Autofocus al abrir (WidgetsBinding.instance no nulo en Flutter 3)
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _focusNode.requestFocus());
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -17,7 +17,7 @@ class _FirmaScreenState extends State<FirmaScreen> {
|
||||
bool _firmado = false;
|
||||
bool _guardando = false;
|
||||
|
||||
final _fmt = NumberFormat.currency(locale: 'en_US', symbol: '\$', decimalDigits: 2);
|
||||
NumberFormat get _fmt => context.watch<AppProvider>().currencyFormat;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -253,7 +253,10 @@ class _LoginScreenState extends State<LoginScreen>
|
||||
],
|
||||
const SizedBox(height: 16),
|
||||
_buildButton(provider.loading),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
// Acceso rápido para evaluador de Google Play / App Store
|
||||
_buildDemoAccessButton(),
|
||||
const SizedBox(height: 10),
|
||||
_buildRegistroLinks(),
|
||||
const SizedBox(height: 12),
|
||||
Center(
|
||||
@@ -462,7 +465,7 @@ class _LoginScreenState extends State<LoginScreen>
|
||||
label: const Text('Cuenta local',
|
||||
style: TextStyle(fontSize: 12)),
|
||||
style: OutlinedButton.styleFrom(
|
||||
primary: _kTextMuted,
|
||||
foregroundColor: _kTextMuted,
|
||||
side: const BorderSide(color: _kBorder),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
@@ -479,7 +482,7 @@ class _LoginScreenState extends State<LoginScreen>
|
||||
label: const Text('Nueva Cloud',
|
||||
style: TextStyle(fontSize: 12)),
|
||||
style: OutlinedButton.styleFrom(
|
||||
primary: _kAccent,
|
||||
foregroundColor: _kAccent,
|
||||
side: const BorderSide(color: _kAccent),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
@@ -523,8 +526,8 @@ class _LoginScreenState extends State<LoginScreen>
|
||||
child: ElevatedButton(
|
||||
onPressed: loading ? null : _ingresar,
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.transparent,
|
||||
onPrimary: Colors.white,
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: Colors.white,
|
||||
shadowColor: Colors.transparent,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
@@ -548,4 +551,31 @@ class _LoginScreenState extends State<LoginScreen>
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ── Botón de acceso de evaluación / Demo para tiendas ───────────────
|
||||
// Facilita la revisión técnica de Google Play Store y Apple App Store
|
||||
// autocompletando la cuenta demo preconfigurada (demo@empresa.com / 123456)
|
||||
Widget _buildDemoAccessButton() {
|
||||
return Center(
|
||||
child: TextButton.icon(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_emailCtrl.text = 'demo@empresa.com';
|
||||
_passCtrl.text = '123456';
|
||||
});
|
||||
_ingresar();
|
||||
},
|
||||
icon: const Icon(Icons.verified_user_outlined, size: 15, color: _kAccent),
|
||||
label: const Text(
|
||||
'Acceso Demo (Revisión de Tienda)',
|
||||
style: TextStyle(
|
||||
color: _kAccent,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,8 +797,8 @@ class _RegistroCloudScreenState extends State<RegistroCloudScreen> {
|
||||
child: ElevatedButton(
|
||||
onPressed: onPressed,
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.transparent,
|
||||
onPrimary: Colors.white,
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: Colors.white,
|
||||
shadowColor: Colors.transparent,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
|
||||
@@ -336,8 +336,8 @@ class _RegistroScreenState extends State<RegistroScreen> {
|
||||
child: ElevatedButton(
|
||||
onPressed: _loading ? null : _crear,
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.transparent,
|
||||
onPrimary: Colors.white,
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: Colors.white,
|
||||
shadowColor: Colors.transparent,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
|
||||
@@ -13,7 +13,7 @@ class PedidoDetailScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final provider = context.read<AppProvider>();
|
||||
final fmt = NumberFormat.currency(locale: 'en_US', symbol: '\$', decimalDigits: 2);
|
||||
final fmt = provider.currencyFormat;
|
||||
final estadoColor = AppTheme.estadoColor(pedido.estado.label);
|
||||
final dateStr = DateFormat('d \'de\' MMMM yyyy, HH:mm', 'es').format(pedido.fecha);
|
||||
|
||||
@@ -45,6 +45,9 @@ class PedidoDetailScreen extends StatelessWidget {
|
||||
// Header card
|
||||
_buildHeaderCard(estadoColor, dateStr),
|
||||
const SizedBox(height: 14),
|
||||
// Tarjeta de estado de sincronización hacia la nube central
|
||||
_buildSyncCard(context, provider),
|
||||
const SizedBox(height: 14),
|
||||
// Cliente
|
||||
_buildClienteCard(),
|
||||
const SizedBox(height: 14),
|
||||
@@ -115,6 +118,109 @@ class PedidoDetailScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// Construye la tarjeta informativa de estado de transmisión con la nube SIGMA
|
||||
Widget _buildSyncCard(BuildContext context, AppProvider provider) {
|
||||
final syncEstado = pedido.syncEstado;
|
||||
final isSincronizado = syncEstado == 'SINCRONIZADO';
|
||||
final isError = syncEstado == 'ERROR';
|
||||
|
||||
final bg = isSincronizado
|
||||
? const Color(0xFF10B981).withOpacity(0.08)
|
||||
: isError
|
||||
? const Color(0xFFEF4444).withOpacity(0.08)
|
||||
: const Color(0xFFF59E0B).withOpacity(0.08);
|
||||
|
||||
final border = isSincronizado
|
||||
? const Color(0xFF10B981).withOpacity(0.25)
|
||||
: isError
|
||||
? const Color(0xFFEF4444).withOpacity(0.25)
|
||||
: const Color(0xFFF59E0B).withOpacity(0.25);
|
||||
|
||||
final iconColor = isSincronizado
|
||||
? const Color(0xFF10B981)
|
||||
: isError
|
||||
? const Color(0xFFEF4444)
|
||||
: const Color(0xFFD97706);
|
||||
|
||||
final icon = isSincronizado
|
||||
? Icons.cloud_done_rounded
|
||||
: isError
|
||||
? Icons.cloud_off_rounded
|
||||
: Icons.cloud_upload_outlined;
|
||||
|
||||
final title = isSincronizado
|
||||
? 'Pedido sincronizado en la nube'
|
||||
: isError
|
||||
? 'Error al subir a la nube'
|
||||
: 'Almacenado localmente (Offline)';
|
||||
|
||||
final desc = isSincronizado
|
||||
? 'Transmitido correctamente a API-SIGMA-CLOUD y registrado en el ERP.'
|
||||
: isError
|
||||
? 'Falló la conexión o la API central rechazó la carga.'
|
||||
: 'Se sincronizará automáticamente cuando el dispositivo tenga conexión.';
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: bg,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: border),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, color: iconColor, size: 26),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(fontSize: 13, fontWeight: FontWeight.bold, color: iconColor),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
desc,
|
||||
style: const TextStyle(fontSize: 11, color: Color(0xFF475569)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (!isSincronizado && provider.modoOnline) ...[
|
||||
const SizedBox(width: 8),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: iconColor,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(color: iconColor.withOpacity(0.4)),
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
final ok = await provider.reintentarSubidaPedido(pedido.id);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
ok
|
||||
? '¡Pedido ${pedido.id} subido con éxito a la nube!'
|
||||
: 'No se pudo subir el pedido. Revisa tu conexión a internet.',
|
||||
),
|
||||
backgroundColor: ok ? const Color(0xFF10B981) : const Color(0xFFEF4444),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('Subir', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 12)),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildClienteCard() {
|
||||
return _sectionCard(
|
||||
title: 'Cliente',
|
||||
|
||||
@@ -21,7 +21,7 @@ class _PedidoFormScreenState extends State<PedidoFormScreen> {
|
||||
String _productoQuery = '';
|
||||
bool _showSearch = false;
|
||||
|
||||
final _fmt = NumberFormat.currency(locale: 'en_US', symbol: '\$', decimalDigits: 2);
|
||||
NumberFormat get _fmt => context.watch<AppProvider>().currencyFormat;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -349,7 +349,7 @@ class _PedidoFormScreenState extends State<PedidoFormScreen> {
|
||||
icon: const Icon(Icons.delete_outline, size: 16),
|
||||
label: const Text('Limpiar', style: TextStyle(fontSize: 12)),
|
||||
onPressed: provider.limpiarCarrito,
|
||||
style: TextButton.styleFrom(primary: AppTheme.dangerColor),
|
||||
style: TextButton.styleFrom(foregroundColor: AppTheme.dangerColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -6,6 +6,8 @@ import '../../theme/app_theme.dart';
|
||||
import '../../models/pedido.dart';
|
||||
import 'pedido_form_screen.dart';
|
||||
import 'pedido_detail_screen.dart';
|
||||
// Botón interactivo de sincronización para AppBar
|
||||
import '../../widgets/sync_status_button.dart';
|
||||
|
||||
class PedidosScreen extends StatefulWidget {
|
||||
const PedidosScreen({Key? key}) : super(key: key);
|
||||
@@ -16,7 +18,7 @@ class PedidosScreen extends StatefulWidget {
|
||||
|
||||
class _PedidosScreenState extends State<PedidosScreen> with SingleTickerProviderStateMixin {
|
||||
late TabController _tab;
|
||||
final _fmt = NumberFormat.currency(locale: 'en_US', symbol: '\$', decimalDigits: 2);
|
||||
NumberFormat get _fmt => context.watch<AppProvider>().currencyFormat;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -39,6 +41,8 @@ class _PedidosScreenState extends State<PedidosScreen> with SingleTickerProvider
|
||||
appBar: AppBar(
|
||||
title: const Text('Pedidos', style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
actions: [
|
||||
// Botón reactivo de sincronización para comprobar y forzar subidas
|
||||
const SyncStatusButton(),
|
||||
IconButton(icon: const Icon(Icons.search), onPressed: () {}),
|
||||
IconButton(icon: const Icon(Icons.filter_list), onPressed: () {}),
|
||||
],
|
||||
@@ -97,23 +101,48 @@ class _PedidosScreenState extends State<PedidosScreen> with SingleTickerProvider
|
||||
}
|
||||
|
||||
Widget _buildList(BuildContext context, List<Pedido> pedidos, AppProvider provider) {
|
||||
if (pedidos.isEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.receipt_long_outlined, size: 64, color: Colors.grey.shade300),
|
||||
const SizedBox(height: 12),
|
||||
const Text('No hay pedidos', style: TextStyle(color: AppTheme.textSecondary, fontSize: 15)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 80),
|
||||
itemCount: pedidos.length,
|
||||
itemBuilder: (context, i) => _buildPedidoCard(context, pedidos[i], provider),
|
||||
// Soportar pull-to-refresh en lista de pedidos para sincronización en tiempo real
|
||||
return RefreshIndicator(
|
||||
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: pedidos.isEmpty
|
||||
? ListView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
children: [
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.25),
|
||||
Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.receipt_long_outlined, size: 64, color: Colors.grey.shade300),
|
||||
const SizedBox(height: 12),
|
||||
const Text('No hay pedidos', style: TextStyle(color: AppTheme.textSecondary, fontSize: 15)),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
'Desliza hacia abajo para actualizar',
|
||||
style: TextStyle(color: Colors.grey.shade400, fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: ListView.builder(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 80),
|
||||
itemCount: pedidos.length,
|
||||
itemBuilder: (context, i) => _buildPedidoCard(context, pedidos[i], provider),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -198,16 +227,24 @@ class _PedidosScreenState extends State<PedidosScreen> with SingleTickerProvider
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: estadoColor.withOpacity(0.12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
pedido.estado.label,
|
||||
style: TextStyle(fontSize: 11, color: estadoColor, fontWeight: FontWeight.w700),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: estadoColor.withOpacity(0.12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
pedido.estado.label,
|
||||
style: TextStyle(fontSize: 11, color: estadoColor, fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
// Badge visual del estado de sincronización hacia API-SIGMA-CLOUD
|
||||
_buildSyncBadge(pedido.syncEstado),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -276,4 +313,69 @@ class _PedidosScreenState extends State<PedidosScreen> with SingleTickerProvider
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Construye el indicador visual de sincronización para cada tarjeta de pedido
|
||||
Widget _buildSyncBadge(String syncEstado) {
|
||||
if (syncEstado == 'SINCRONIZADO') {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF10B981).withOpacity(0.12),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: const [
|
||||
Icon(Icons.cloud_done_rounded, size: 12, color: Color(0xFF10B981)),
|
||||
SizedBox(width: 3),
|
||||
Text(
|
||||
'Nube',
|
||||
style: TextStyle(fontSize: 10, color: Color(0xFF10B981), fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (syncEstado == 'ERROR') {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFEF4444).withOpacity(0.12),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: const [
|
||||
Icon(Icons.error_outline_rounded, size: 12, color: Color(0xFFEF4444)),
|
||||
SizedBox(width: 3),
|
||||
Text(
|
||||
'Error sync',
|
||||
style: TextStyle(fontSize: 10, color: Color(0xFFEF4444), fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// PENDIENTE
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF59E0B).withOpacity(0.12),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: const [
|
||||
Icon(Icons.cloud_upload_outlined, size: 12, color: Color(0xFFD97706)),
|
||||
SizedBox(width: 3),
|
||||
Text(
|
||||
'Pendiente',
|
||||
style: TextStyle(fontSize: 10, color: Color(0xFFD97706), fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ import 'package:provider/provider.dart';
|
||||
import '../../providers/app_provider.dart';
|
||||
import '../../theme/app_theme.dart';
|
||||
import '../../models/pedido.dart';
|
||||
import '../../models/moneda.dart';
|
||||
// Utilidades de validación regex para teléfonos y servicio de alertas vía Sigma-Robot
|
||||
import '../../utils/phone_utils.dart';
|
||||
import '../../services/whatsapp_service.dart';
|
||||
|
||||
class PerfilScreen extends StatelessWidget {
|
||||
const PerfilScreen({Key? key}) : super(key: key);
|
||||
@@ -12,7 +16,7 @@ class PerfilScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final provider = context.watch<AppProvider>();
|
||||
final vendedor = provider.vendedor;
|
||||
final fmt = NumberFormat.currency(locale: 'en_US', symbol: '\$', decimalDigits: 2);
|
||||
final fmt = provider.currencyFormat;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppTheme.bgColor,
|
||||
@@ -29,9 +33,10 @@ class PerfilScreen extends StatelessWidget {
|
||||
const SizedBox(height: 20),
|
||||
_buildPedidosResumen(context, provider, fmt),
|
||||
const SizedBox(height: 20),
|
||||
_buildInfoCard(vendedor),
|
||||
// Tarjeta de información con soporte de edición de teléfono para WhatsApp
|
||||
_buildInfoCard(context, vendedor, provider),
|
||||
const SizedBox(height: 20),
|
||||
_buildConfigSection(context),
|
||||
_buildConfigSection(context, provider),
|
||||
const SizedBox(height: 20),
|
||||
_buildLogoutBtn(context, provider),
|
||||
const SizedBox(height: 40),
|
||||
@@ -254,15 +259,84 @@ class PerfilScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoCard(vendedor) {
|
||||
Widget _buildInfoCard(BuildContext context, vendedor, AppProvider provider) {
|
||||
final tieneWhatsAppValido = PhoneUtils.esWhatsAppValido(vendedor.telefono);
|
||||
final telefonoFormateado = vendedor.telefono.isNotEmpty
|
||||
? PhoneUtils.formatearVisual(vendedor.telefono)
|
||||
: 'Sin configurar';
|
||||
|
||||
return _card(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('Información de contacto', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14)),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text('Información de contacto', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14)),
|
||||
TextButton.icon(
|
||||
style: TextButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
minimumSize: Size.zero,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
icon: const Icon(Icons.edit, size: 14, color: AppTheme.primaryColor),
|
||||
label: const Text('Editar WhatsApp', style: TextStyle(fontSize: 11, color: AppTheme.primaryColor)),
|
||||
onPressed: () => _mostrarDialogoWhatsApp(context, provider),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_infoTile(Icons.email_outlined, 'Correo', vendedor.email),
|
||||
_infoTile(Icons.phone_outlined, 'Teléfono', vendedor.telefono),
|
||||
// Fila interactiva para el teléfono con indicador de estado WhatsApp
|
||||
InkWell(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
onTap: () => _mostrarDialogoWhatsApp(context, provider),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.phone_outlined, size: 18, color: AppTheme.primaryColor),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('Teléfono / WhatsApp', style: TextStyle(fontSize: 10, color: AppTheme.textSecondary)),
|
||||
Text(telefonoFormateado, style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||
decoration: BoxDecoration(
|
||||
color: tieneWhatsAppValido ? Colors.green.withOpacity(0.12) : Colors.amber.withOpacity(0.15),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
tieneWhatsAppValido ? Icons.verified : Icons.warning_amber_rounded,
|
||||
size: 12,
|
||||
color: tieneWhatsAppValido ? Colors.green.shade700 : Colors.amber.shade800,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
tieneWhatsAppValido ? 'Vinculado' : 'Sin validar',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: tieneWhatsAppValido ? Colors.green.shade800 : Colors.amber.shade900,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
_infoTile(Icons.map_outlined, 'Zona', vendedor.zona),
|
||||
],
|
||||
),
|
||||
@@ -288,12 +362,28 @@ class PerfilScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildConfigSection(BuildContext context) {
|
||||
Widget _buildConfigSection(BuildContext context, AppProvider provider) {
|
||||
final vendedor = provider.vendedor;
|
||||
final tieneWhatsApp = PhoneUtils.esWhatsAppValido(vendedor.telefono);
|
||||
|
||||
final opciones = [
|
||||
{'icon': Icons.notifications_outlined, 'label': 'Notificaciones', 'trailing': true},
|
||||
// Opción dedicada para configurar y probar alertas WhatsApp mediante Sigma-Robot
|
||||
{
|
||||
'icon': Icons.mark_chat_read_outlined,
|
||||
'label': 'Alertas WhatsApp (Sigma-Robot)',
|
||||
'value': tieneWhatsApp ? PhoneUtils.formatearVisual(vendedor.telefono) : 'Configurar',
|
||||
'onTap': () => _mostrarDialogoWhatsApp(context, provider),
|
||||
},
|
||||
{
|
||||
'icon': Icons.attach_money,
|
||||
'label': 'Moneda',
|
||||
'value': '${provider.moneda.codigo} (${provider.moneda.simbolo})',
|
||||
'onTap': () => _mostrarSelectorMoneda(context, provider),
|
||||
},
|
||||
{'icon': Icons.language, 'label': 'Idioma', 'value': 'Español'},
|
||||
{'icon': Icons.help_outline, 'label': 'Ayuda y soporte', 'arrow': true},
|
||||
{'icon': Icons.info_outline, 'label': 'Acerca de la app', 'value': 'v1.0.0'},
|
||||
{'icon': Icons.info_outline, 'label': 'Acerca de la app', 'value': 'v1.0.1'},
|
||||
];
|
||||
|
||||
return _card(
|
||||
@@ -311,14 +401,313 @@ class PerfilScreen extends StatelessWidget {
|
||||
? Switch(value: true, onChanged: (_) {}, activeColor: AppTheme.primaryColor)
|
||||
: o['arrow'] == true
|
||||
? const Icon(Icons.chevron_right, color: AppTheme.textSecondary)
|
||||
: Text(o['value'] as String? ?? '', style: const TextStyle(fontSize: 12, color: AppTheme.textSecondary)),
|
||||
onTap: () {},
|
||||
: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(o['value'] as String? ?? '', style: const TextStyle(fontSize: 12, color: AppTheme.textSecondary)),
|
||||
if (o['onTap'] != null) ...[
|
||||
const SizedBox(width: 4),
|
||||
const Icon(Icons.chevron_right, size: 16, color: AppTheme.textSecondary),
|
||||
],
|
||||
],
|
||||
),
|
||||
onTap: (o['onTap'] as VoidCallback?) ?? () {},
|
||||
)).toList(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ── Modal de Configuración y Alertas de WhatsApp ───────────────
|
||||
// Permite al usuario registrar o actualizar su número móvil con selección de código
|
||||
// de país, previsualización regex en tiempo real y envío de mensaje de prueba vía Sigma-Robot
|
||||
void _mostrarDialogoWhatsApp(BuildContext context, AppProvider provider) {
|
||||
final vendedor = provider.vendedor;
|
||||
String codigoPais = PhoneUtils.defaultCountryCode;
|
||||
|
||||
// Detectar si el teléfono actual ya tiene un código de país conocido
|
||||
String textoInicial = vendedor.telefono;
|
||||
for (final p in PhoneUtils.paisesDisponibles) {
|
||||
final digitos = PhoneUtils.extraerSoloDigitos(textoInicial);
|
||||
if (digitos.startsWith(p.codigo)) {
|
||||
codigoPais = p.codigo;
|
||||
textoInicial = digitos.substring(p.codigo.length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final phoneCtrl = TextEditingController(text: textoInicial);
|
||||
bool enviandoPrueba = false;
|
||||
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
builder: (ctx) {
|
||||
return StatefulBuilder(
|
||||
builder: (ctx, setModalState) {
|
||||
final textoIngresado = phoneCtrl.text.trim();
|
||||
final normalizado = PhoneUtils.normalizarWhatsApp(textoIngresado, pais: codigoPais);
|
||||
final esValido = PhoneUtils.esWhatsAppValido(normalizado);
|
||||
final paisActual = PhoneUtils.paisesDisponibles.firstWhere(
|
||||
(p) => p.codigo == codigoPais,
|
||||
orElse: () => PhoneUtils.paisesDisponibles.first,
|
||||
);
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20,
|
||||
right: 20,
|
||||
top: 20,
|
||||
bottom: MediaQuery.of(ctx).viewInsets.bottom + 20,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green.withOpacity(0.12),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: const Icon(Icons.mark_chat_read, color: Colors.green, size: 24),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Alertas por WhatsApp',
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
|
||||
),
|
||||
Text(
|
||||
'Notificaciones vía Sigma-Robot Gateway',
|
||||
style: TextStyle(color: AppTheme.textSecondary, fontSize: 11),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () => Navigator.pop(ctx),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'Código de país y número móvil:',
|
||||
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: AppTheme.textPrimary),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Selector de Código de País
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey.shade300),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton<String>(
|
||||
value: codigoPais,
|
||||
items: PhoneUtils.paisesDisponibles.map((p) {
|
||||
return DropdownMenuItem(
|
||||
value: p.codigo,
|
||||
child: Text('${p.bandera} +${p.codigo}', style: const TextStyle(fontSize: 13)),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (nuevo) {
|
||||
if (nuevo != null) {
|
||||
setModalState(() => codigoPais = nuevo);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
// Entrada de número de teléfono
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
controller: phoneCtrl,
|
||||
keyboardType: TextInputType.phone,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Ej. 0991234567',
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(10)),
|
||||
suffixIcon: esValido
|
||||
? const Icon(Icons.check_circle, color: Colors.green, size: 20)
|
||||
: null,
|
||||
),
|
||||
onChanged: (_) => setModalState(() {}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
// Previsualización y validación Regex en vivo
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: esValido ? Colors.green.shade50 : Colors.amber.shade50,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: esValido ? Colors.green.shade200 : Colors.amber.shade200),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
esValido ? Icons.verified : Icons.info_outline,
|
||||
size: 16,
|
||||
color: esValido ? Colors.green.shade700 : Colors.amber.shade800,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
esValido ? 'Número normalizado para WhatsApp' : 'Formato incompleto',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: esValido ? Colors.green.shade800 : Colors.amber.shade900,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
normalizado.isNotEmpty
|
||||
? 'Destino: +$normalizado (${paisActual.nombre})'
|
||||
: 'Ingresa tu número (se auto-formatea con código +$codigoPais)',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: esValido ? Colors.green.shade900 : Colors.grey.shade700,
|
||||
fontFamily: 'monospace',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
// Botones de acción: Probar Alerta y Guardar
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
icon: enviandoPrueba
|
||||
? const SizedBox(width: 14, height: 14, child: CircularProgressIndicator(strokeWidth: 2))
|
||||
: const Icon(Icons.send_outlined, size: 16),
|
||||
label: const Text('Probar Alerta', style: TextStyle(fontSize: 12)),
|
||||
onPressed: (!esValido || enviandoPrueba)
|
||||
? null
|
||||
: () async {
|
||||
setModalState(() => enviandoPrueba = true);
|
||||
final res = await WhatsAppService.enviarAlertaPrueba(
|
||||
telefono: normalizado,
|
||||
nombreVendedor: vendedor.nombre,
|
||||
codigoPais: codigoPais,
|
||||
);
|
||||
setModalState(() => enviandoPrueba = false);
|
||||
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(res.ok
|
||||
? '✅ Alerta enviada con éxito a +$normalizado'
|
||||
: '⚠️ No se pudo enviar: ${res.error}'),
|
||||
backgroundColor: res.ok ? Colors.green.shade700 : Colors.red.shade700,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.primaryColor,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
),
|
||||
onPressed: !esValido
|
||||
? null
|
||||
: () async {
|
||||
await provider.actualizarTelefonoVendedor(normalizado);
|
||||
if (context.mounted) {
|
||||
Navigator.pop(ctx);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Número de WhatsApp guardado: +$normalizado'),
|
||||
backgroundColor: Colors.green.shade700,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('Guardar', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 13)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _mostrarSelectorMoneda(BuildContext context, AppProvider provider) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
builder: (ctx) {
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.fromLTRB(16, 20, 16, 8),
|
||||
child: Text('Selecciona la moneda',
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
|
||||
),
|
||||
...Moneda.disponibles.map((m) {
|
||||
final seleccionada = m.codigo == provider.moneda.codigo;
|
||||
return ListTile(
|
||||
leading: Text(m.simbolo,
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: AppTheme.primaryColor)),
|
||||
title: Text(m.nombre, style: const TextStyle(fontSize: 14)),
|
||||
subtitle: Text(m.codigo, style: const TextStyle(fontSize: 11, color: AppTheme.textSecondary)),
|
||||
trailing: seleccionada
|
||||
? const Icon(Icons.check_circle, color: AppTheme.successColor)
|
||||
: null,
|
||||
onTap: () {
|
||||
provider.setMoneda(m);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLogoutBtn(BuildContext context, AppProvider provider) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
|
||||
@@ -20,10 +20,12 @@ class _ScannerScreenState extends State<ScannerScreen> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onDetect(Barcode barcode, MobileScannerArguments? args) {
|
||||
if (_scanned || barcode.rawValue == null || barcode.rawValue!.isEmpty) return;
|
||||
void _onDetect(BarcodeCapture capture) {
|
||||
if (_scanned || capture.barcodes.isEmpty) return;
|
||||
final rawValue = capture.barcodes.first.rawValue;
|
||||
if (rawValue == null || rawValue.isEmpty) return;
|
||||
_scanned = true;
|
||||
Navigator.pop(context, barcode.rawValue);
|
||||
Navigator.pop(context, rawValue);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -36,24 +38,21 @@ class _ScannerScreenState extends State<ScannerScreen> {
|
||||
elevation: 0,
|
||||
title: Text(widget.titulo),
|
||||
actions: [
|
||||
ValueListenableBuilder<TorchState>(
|
||||
valueListenable: _controller.torchState,
|
||||
ValueListenableBuilder<MobileScannerState>(
|
||||
valueListenable: _controller,
|
||||
builder: (_, state, __) => IconButton(
|
||||
tooltip: state == TorchState.on ? 'Apagar linterna' : 'Encender linterna',
|
||||
tooltip: state.torchState == TorchState.on ? 'Apagar linterna' : 'Encender linterna',
|
||||
icon: Icon(
|
||||
state == TorchState.on ? Icons.flash_on : Icons.flash_off,
|
||||
color: state == TorchState.on ? Colors.yellow : Colors.white,
|
||||
state.torchState == TorchState.on ? Icons.flash_on : Icons.flash_off,
|
||||
color: state.torchState == TorchState.on ? Colors.yellow : Colors.white,
|
||||
),
|
||||
onPressed: _controller.toggleTorch,
|
||||
),
|
||||
),
|
||||
ValueListenableBuilder<CameraFacing>(
|
||||
valueListenable: _controller.cameraFacingState,
|
||||
builder: (_, facing, __) => IconButton(
|
||||
tooltip: 'Cambiar cámara',
|
||||
icon: const Icon(Icons.cameraswitch, color: Colors.white),
|
||||
onPressed: _controller.switchCamera,
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Cambiar cámara',
|
||||
icon: const Icon(Icons.cameraswitch, color: Colors.white),
|
||||
onPressed: () => _controller.switchCamera(),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user