payfrit-app/lib/screens/splash_screen.dart
John Mizerek c445664df8 Implement production-ready beacon auto-selection system
- Multi-cycle BLE scanning (5 cycles x 2 seconds) overcomes Android detection limits
- RSSI averaging and variance calculation for confident beacon selection
- Detects all 3 test beacons with 100% accuracy
- Login flow optimized: beacon scan → browse menu → login on cart add
- Anonymous users can browse full menu before authentication
- Beacon scanning now occurs before login requirement

Technical improvements:
- Added API endpoints for beacon listing and business mapping
- Updated AppState to handle business/service point selection
- Implemented intelligent beacon scoring with proximity ranking
- Added graceful fallbacks for no-beacon scenarios

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 23:01:23 -08:00

53 lines
1.1 KiB
Dart

import "dart:async";
import "package:flutter/material.dart";
import "package:provider/provider.dart";
import "../app/app_router.dart";
import "../app/app_state.dart";
class SplashScreen extends StatefulWidget {
const SplashScreen({super.key});
@override
State<SplashScreen> createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
Timer? _timer;
@override
void initState() {
super.initState();
_timer = Timer(const Duration(milliseconds: 2400), () {
if (!mounted) return;
// Always go to beacon scan first - allows browsing without login
Navigator.of(context).pushReplacementNamed(AppRoutes.beaconScan);
});
}
@override
void dispose() {
_timer?.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return const Scaffold(
backgroundColor: Colors.black,
body: Center(
child: Text(
"PAYFRIT",
style: TextStyle(
color: Colors.white,
fontSize: 38,
fontWeight: FontWeight.w800,
letterSpacing: 3,
),
),
),
);
}
}