feat: Agente Ventas SIGMAC — app de rutas y pedidos de campo
App Flutter 2.11 para vendedores de ruta de Telcotronics. Incluye ruta del día con mapa custom, catálogo, pedidos CRUD, firma digital, scanner QR/barcode, selector de clientes escalable, notificaciones in-app y soporte multiplataforma (Android + Linux desktop). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import 'dart:io' show Platform;
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'scanner_screen.dart';
|
||||
|
||||
/// Abre el scanner de cámara en móvil/web, o un diálogo de entrada manual en Linux/Windows.
|
||||
/// Retorna el valor escaneado/ingresado, o null si el usuario canceló.
|
||||
Future<String?> abrirScanner(BuildContext context, {String titulo = 'Escanear código'}) {
|
||||
if (!kIsWeb && (Platform.isLinux || Platform.isWindows)) {
|
||||
return _mostrarInputManual(context, titulo: titulo);
|
||||
}
|
||||
return Navigator.push<String>(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => ScannerScreen(titulo: titulo)),
|
||||
);
|
||||
}
|
||||
|
||||
Future<String?> _mostrarInputManual(BuildContext context, {required String titulo}) {
|
||||
final ctrl = TextEditingController();
|
||||
return showDialog<String>(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Row(
|
||||
children: [
|
||||
const Icon(Icons.qr_code, size: 22),
|
||||
const SizedBox(width: 8),
|
||||
Text(titulo, style: const TextStyle(fontSize: 16)),
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text(
|
||||
'Escaneo de cámara no disponible en escritorio.\nIngresa el código manualmente:',
|
||||
style: TextStyle(fontSize: 13, color: Colors.black54),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
TextField(
|
||||
controller: ctrl,
|
||||
autofocus: true,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Código / SKU',
|
||||
prefixIcon: Icon(Icons.qr_code),
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
onSubmitted: (v) {
|
||||
if (v.trim().isNotEmpty) Navigator.pop(ctx, v.trim());
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(ctx), child: const Text('Cancelar')),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
final v = ctrl.text.trim();
|
||||
if (v.isNotEmpty) Navigator.pop(ctx, v);
|
||||
},
|
||||
child: const Text('Buscar'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user