import ' dart:io ' ;
import ' package:flutter/material.dart ' ;
import ' package:flutter/services.dart ' ;
import ' package:test_sa/extensions/context_extension.dart ' ;
import ' package:test_sa/extensions/int_extensions.dart ' ;
import ' package:test_sa/extensions/text_extensions.dart ' ;
import ' package:test_sa/extensions/widget_extensions.dart ' ;
import ' package:test_sa/new_views/app_style/app_color.dart ' ;
import ' package:test_sa/new_views/common_widgets/app_filled_button.dart ' ;
class UnsafeDeviceScreen extends StatefulWidget {
const UnsafeDeviceScreen ( { Key ? key } ) : super ( key: key ) ;
static const String routeName = " /unSafeDevice " ;
@ override
State < UnsafeDeviceScreen > createState ( ) = > _UnsafeDeviceScreenState ( ) ;
}
class _UnsafeDeviceScreenState extends State < UnsafeDeviceScreen > {
@ override
Widget build ( BuildContext context ) {
return Scaffold (
body: SafeArea (
child: Column (
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . center ,
mainAxisAlignment: MainAxisAlignment . center ,
children: [
21. height ,
// Center(child: Image.asset("assets/images/logos/main_mohemm_logo.png", width: 200, height: 50)),
" logo " . toSvgAsset ( height: 64 ) ,
50. height ,
" Sorry " . heading5 ( context ) . custom ( color: AppColor . textStyleColor ( context ) ) ,
21. height ,
" You are using Atoms app on an unsafe device. To be able to use the app with all it's features, Please make sure that the below points are considered: "
. heading5 ( context ) . paddingOnly ( start: 20 , end: 20 ) ,
48. height ,
passwordConstraintsUI ( " The device is not jailbroken or rooted. " , true ) . paddingOnly ( start: 24 , end: 5 ) ,
8. height ,
passwordConstraintsUI ( " The app is not installed on external storage. " , true ) . paddingOnly ( start: 24 , end: 5 ) ,
8. height ,
passwordConstraintsUI ( " Development mode is disabled. " , true ) . paddingOnly ( start: 24 , end: 5 ) ,
21. height ,
AppFilledButton ( label: context . translation . done , maxWidth: true , onPressed: ( ) async {
if ( Platform . isAndroid ) {
SystemChannels . platform . invokeMethod ( ' SystemNavigator.pop ' ) ;
} else {
// MinimizeApp.minimizeApp();
}
} ) . paddingAll ( 24 ) ,
// DefaultButton(LocaleKeys.ok.tr(), () async {
// if (Platform.isAndroid) {
// SystemChannels.platform.invokeMethod('SystemNavigator.pop');
// } else {
// // MinimizeApp.minimizeApp();
// }
// })
] ,
) ,
) ,
) ;
}
Widget passwordConstraintsUI ( String description , bool check ) {
return Row (
children: [
4. width ,
SizedBox (
width: 12 ,
height: 12 ,
child: Checkbox ( fillColor: MaterialStateProperty . all ( AppColor . backgroundDark ) , shape: const CircleBorder ( ) , value: check , onChanged: null ) ,
) ,
8. width ,
description . heading6 ( context )
] ,
) ;
}
}