import 'package:doctor_app_flutter/core/service/security_service.dart'; import 'package:flutter/material.dart'; import 'package:freerasp/freerasp.dart'; import 'package:http/http.dart' as getIt; import 'locator.dart'; class UnsafeDevice extends StatefulWidget { const UnsafeDevice({super.key}); @override State createState() => _UnsafeDeviceState(); } class _UnsafeDeviceState extends State { @override void initState() { Talsec.instance.detachListener(); super.initState(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, body: SafeArea( child: Padding( padding: EdgeInsets.symmetric(horizontal: 24), child: Column( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ // Logo Center( child: Image.asset('assets/images/dr_app_logo.png'), ), SizedBox(height: 32), // Warning Icon Icon( Icons.security, size: 80, color: Color(0xFFED1C2B), ), SizedBox(height: 24), // Title Text( 'Unsafe Device Detected', style: TextStyle( fontSize: 24, fontWeight: FontWeight.bold, color: Color(0xFFED1C2B), ), textAlign: TextAlign.center, ), SizedBox(height: 16), // Description Text( 'For your security, this app cannot run on devices with security vulnerabilities. is ssss', style: TextStyle( fontSize: 16, color: Colors.black87, ), textAlign: TextAlign.center, ), SizedBox(height: 24), if (service.detectedThreats.isNotEmpty) ...[ Text( 'Detected Issues:', style: TextStyle( fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, ), ), SizedBox(height: 8), Container( padding: EdgeInsets.all(12), decoration: BoxDecoration( color: Colors.red.withOpacity(0.1), borderRadius: BorderRadius.circular(8), border: Border.all(color: Colors.red.withOpacity(0.3)), ), child: Column( children: service.detectedThreats .where((t) => t.severity == ThreatSeverity.critical) .take(5) // Show max 5 threats .map((threat) => Padding( padding: EdgeInsets.symmetric(vertical: 4), child: Row( children: [ Icon(Icons.error_outline, size: 16, color: Colors.red), SizedBox(width: 8), Expanded( child: Text( threat.threatType, style: TextStyle(fontSize: 12), ), ), ], ), )) .toList(), ), ), SizedBox(height: 24), ], ], ), ), ), ); } }