@ -1,4 +1,3 @@
import ' dart:developer ' ;
import ' dart:io ' ;
import ' package:easy_localization/easy_localization.dart ' ;
@ -20,8 +19,9 @@ class MazayaAccessResultParams {
final String ? downloadUrl ;
final String ? nationalId ;
final String ? dateOfBirth ;
final String ? message ;
const MazayaAccessResultParams ( { required this . isGranted , required this . dependentName , this . dependentInitials , this . downloadUrl , this . nationalId , this . dateOfBirth }) ;
const MazayaAccessResultParams ( { required this . isGranted , required this . dependentName , this . dependentInitials , this . downloadUrl , this . nationalId , this . dateOfBirth , this . message }) ;
}
class _ShieldPainter extends CustomPainter {
@ -79,8 +79,9 @@ class MazayaAccessResultScreen extends StatelessWidget {
final String ? downloadUrl ;
final String ? nationalId ;
final String ? dateOfBirth ;
final String ? message ;
const MazayaAccessResultScreen ( { Key ? key , this . isGranted = true , this . dependentName = " " , this . dependentInitials , this . downloadUrl , this . nationalId , this . dateOfBirth }) : super ( key: key ) ;
const MazayaAccessResultScreen ( { Key ? key , this . isGranted = true , this . dependentName = " " , this . dependentInitials , this . downloadUrl , this . nationalId , this . dateOfBirth , this . message }) : super ( key: key ) ;
static String getDownloadLink ( ) {
int channel = AppState ( ) . postParamsObject ? . channel ? ? 31 ;
@ -119,6 +120,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
String ? effectiveUrl = downloadUrl ;
String ? effectiveNationalId = nationalId ;
String ? effectiveDateOfBirth = dateOfBirth ;
String ? effectiveMessage = message ;
if ( routeArgs is MazayaAccessResultParams ) {
effectiveGranted = routeArgs . isGranted ;
@ -127,6 +129,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
effectiveUrl = routeArgs . downloadUrl ;
effectiveNationalId = routeArgs . nationalId ;
effectiveDateOfBirth = routeArgs . dateOfBirth ;
effectiveMessage = routeArgs . message ? ? message ;
} else if ( routeArgs is Map < String , dynamic > ) {
effectiveGranted = routeArgs [ ' isGranted ' ] ? ? isGranted ;
effectiveName = routeArgs [ ' dependentName ' ] ? ? dependentName ;
@ -134,6 +137,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
effectiveUrl = routeArgs [ ' downloadUrl ' ] ? ? downloadUrl ;
effectiveNationalId = routeArgs [ ' nationalId ' ] ? ? nationalId ;
effectiveDateOfBirth = routeArgs [ ' dateOfBirth ' ] ? ? dateOfBirth ;
effectiveMessage = routeArgs [ ' message ' ] ? ? message ;
}
effectiveName = isAr ? " التابع " : " Dependent " ;
/ / if ( effectiveName . trim ( ) . isEmpty ) {
@ -183,7 +187,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
child: SingleChildScrollView (
padding: const EdgeInsets . fromLTRB ( 20 , 16 , 20 , 20 ) ,
child:
effectiveGranted ? _buildGrantedContent ( context , isAr , fontFamily , effectiveName , initials , linkToShare ) : _buildRevokedContent ( context , isAr , fontFamily , effectiveName , initials ),
effectiveGranted ? _buildGrantedContent ( context , isAr , fontFamily , effectiveName , initials , linkToShare ) : _buildRevokedContent ( context , isAr , fontFamily , effectiveName , initials , effectiveMessage ),
) ,
) ,
_buildBottomButtons ( context , isAr , fontFamily , effectiveGranted , linkToShare , effectiveNationalId ? ? " " , effectiveDateOfBirth ? ? " " ) ,
@ -332,7 +336,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
) ;
}
Widget _buildRevokedContent ( BuildContext context , bool isAr , String fontFamily , String name , String initials ) {
Widget _buildRevokedContent ( BuildContext context , bool isAr , String fontFamily , String name , String initials , [ String ? message ] ) {
return Column (
crossAxisAlignment: CrossAxisAlignment . center ,
children: < Widget > [
@ -354,7 +358,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
const SizedBox ( height: 8 ) ,
/ / Description
LocaleKeys . mazayaAccessRevokedDesc . tr ( ) . toText14 ( isCenter: true , color: const Color ( 0xFF64748B ) ) ,
( message ! = null & & message . trim ( ) . isNotEmpty ? message . trim ( ) : LocaleKeys . mazayaAccessRevokedDesc . tr ( ) ) . toText14 ( isCenter: true , color: const Color ( 0xFF64748B ) ) ,
const SizedBox ( height: 22 ) ,