You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
4.3 KiB
Dart
118 lines
4.3 KiB
Dart
|
17 hours ago
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:freerasp/freerasp.dart';
|
||
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||
|
|
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
||
|
|
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||
|
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||
|
|
import 'package:hmg_patient_app_new/services/security_service.dart';
|
||
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||
|
|
|
||
|
|
class UnsafeDevice extends StatefulWidget {
|
||
|
|
const UnsafeDevice({super.key});
|
||
|
|
|
||
|
|
@override
|
||
|
|
State<UnsafeDevice> createState() => _UnsafeDeviceState();
|
||
|
|
}
|
||
|
|
|
||
|
|
class _UnsafeDeviceState extends State<UnsafeDevice> {
|
||
|
|
@override
|
||
|
|
void initState() {
|
||
|
|
Talsec.instance.detachListener();
|
||
|
|
super.initState();
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return Scaffold(
|
||
|
|
backgroundColor: AppColors.whiteColor,
|
||
|
|
body: SafeArea(
|
||
|
|
child: Padding(
|
||
|
|
padding: EdgeInsets.symmetric(horizontal: 24.w),
|
||
|
|
child: Column(
|
||
|
|
mainAxisSize: MainAxisSize.max,
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
|
children: [
|
||
|
|
// Logo
|
||
|
|
Utils.buildImgWithAssets(icon: AppAssets.hmgLogo, width: MediaQuery.of(context).size.width * 0.7, height: 90.h, fit: BoxFit.contain),
|
||
|
|
SizedBox(height: 32.h),
|
||
|
|
// Warning Icon
|
||
|
|
Icon(
|
||
|
|
Icons.security,
|
||
|
|
size: 80.h,
|
||
|
|
color: AppColors.primaryRedColor,
|
||
|
|
),
|
||
|
|
SizedBox(height: 24.h),
|
||
|
|
// Title
|
||
|
|
Text(
|
||
|
|
'Unsafe Device Detected',
|
||
|
|
style: TextStyle(
|
||
|
|
fontSize: 24.f,
|
||
|
|
fontWeight: FontWeight.bold,
|
||
|
|
color: AppColors.primaryRedColor,
|
||
|
|
),
|
||
|
|
textAlign: TextAlign.center,
|
||
|
|
),
|
||
|
|
SizedBox(height: 16.h),
|
||
|
|
|
||
|
|
// Description
|
||
|
|
Text(
|
||
|
|
'For your security, this app cannot run on devices with security vulnerabilities.',
|
||
|
|
style: TextStyle(
|
||
|
|
fontSize: 16.f,
|
||
|
|
color: Colors.black87,
|
||
|
|
),
|
||
|
|
textAlign: TextAlign.center,
|
||
|
|
),
|
||
|
|
SizedBox(height: 24.h),
|
||
|
|
// if (getIt.get<SecurityService>().detectedThreats.isNotEmpty) ...[
|
||
|
|
// Text(
|
||
|
|
// 'Detected Issues:',
|
||
|
|
// style: TextStyle(
|
||
|
|
// fontSize: 14.f,
|
||
|
|
// fontWeight: FontWeight.bold,
|
||
|
|
// color: Colors.black87,
|
||
|
|
// ),
|
||
|
|
// ),
|
||
|
|
// SizedBox(height: 8.h),
|
||
|
|
// Container(
|
||
|
|
// padding: EdgeInsets.all(12.w),
|
||
|
|
// decoration: BoxDecoration(
|
||
|
|
// color: Colors.red.withOpacity(0.1),
|
||
|
|
// borderRadius: BorderRadius.circular(8.r),
|
||
|
|
// border: Border.all(color: Colors.red.withOpacity(0.3)),
|
||
|
|
// ),
|
||
|
|
// child: Column(
|
||
|
|
// children: getIt
|
||
|
|
// .get<SecurityService>()
|
||
|
|
// .detectedThreats
|
||
|
|
// .where((t) => t.severity == ThreatSeverity.critical)
|
||
|
|
// .take(5) // Show max 5 threats
|
||
|
|
// .map((threat) => Padding(
|
||
|
|
// padding: EdgeInsets.symmetric(vertical: 4.h),
|
||
|
|
// child: Row(
|
||
|
|
// children: [
|
||
|
|
// Icon(Icons.error_outline, size: 16.f, color: Colors.red),
|
||
|
|
// SizedBox(width: 8.w),
|
||
|
|
// Expanded(
|
||
|
|
// child: Text(
|
||
|
|
// threat.threatType,
|
||
|
|
// style: TextStyle(fontSize: 12.f),
|
||
|
|
// ),
|
||
|
|
// ),
|
||
|
|
// ],
|
||
|
|
// ),
|
||
|
|
// ))
|
||
|
|
// .toList(),
|
||
|
|
// ),
|
||
|
|
// ),
|
||
|
|
// SizedBox(height: 24.h),
|
||
|
|
// ],
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|