|
|
|
|
@ -1,8 +1,10 @@
|
|
|
|
|
import 'dart:developer';
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
|
|
|
@ -19,14 +21,7 @@ class MazayaAccessResultParams {
|
|
|
|
|
final String? nationalId;
|
|
|
|
|
final String? dateOfBirth;
|
|
|
|
|
|
|
|
|
|
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});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _ShieldPainter extends CustomPainter {
|
|
|
|
|
@ -37,12 +32,13 @@ class _ShieldPainter extends CustomPainter {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void paint(Canvas canvas, Size size) {
|
|
|
|
|
Paint paint = Paint()
|
|
|
|
|
..color = color
|
|
|
|
|
..style = PaintingStyle.stroke
|
|
|
|
|
..strokeWidth = 2.4
|
|
|
|
|
..strokeCap = StrokeCap.round
|
|
|
|
|
..strokeJoin = StrokeJoin.round;
|
|
|
|
|
Paint paint =
|
|
|
|
|
Paint()
|
|
|
|
|
..color = color
|
|
|
|
|
..style = PaintingStyle.stroke
|
|
|
|
|
..strokeWidth = 2.4
|
|
|
|
|
..strokeCap = StrokeCap.round
|
|
|
|
|
..strokeJoin = StrokeJoin.round;
|
|
|
|
|
|
|
|
|
|
double w = size.width;
|
|
|
|
|
double h = size.height;
|
|
|
|
|
@ -67,22 +63,13 @@ class _ShieldPainter extends CustomPainter {
|
|
|
|
|
canvas.drawPath(checkPath, paint);
|
|
|
|
|
} else {
|
|
|
|
|
// Cross path
|
|
|
|
|
canvas.drawLine(
|
|
|
|
|
Offset(w * 0.38, h * 0.38),
|
|
|
|
|
Offset(w * 0.62, h * 0.62),
|
|
|
|
|
paint,
|
|
|
|
|
);
|
|
|
|
|
canvas.drawLine(
|
|
|
|
|
Offset(w * 0.62, h * 0.38),
|
|
|
|
|
Offset(w * 0.38, h * 0.62),
|
|
|
|
|
paint,
|
|
|
|
|
);
|
|
|
|
|
canvas.drawLine(Offset(w * 0.38, h * 0.38), Offset(w * 0.62, h * 0.62), paint);
|
|
|
|
|
canvas.drawLine(Offset(w * 0.62, h * 0.38), Offset(w * 0.38, h * 0.62), paint);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
bool shouldRepaint(covariant _ShieldPainter oldDelegate) =>
|
|
|
|
|
color != oldDelegate.color || isGranted != oldDelegate.isGranted;
|
|
|
|
|
bool shouldRepaint(covariant _ShieldPainter oldDelegate) => color != oldDelegate.color || isGranted != oldDelegate.isGranted;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
@ -93,28 +80,11 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
final String? nationalId;
|
|
|
|
|
final String? dateOfBirth;
|
|
|
|
|
|
|
|
|
|
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}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
static String getDownloadLink() {
|
|
|
|
|
int channel = AppState().postParamsObject?.channel ?? 31;
|
|
|
|
|
bool isIos = Platform.isIOS;
|
|
|
|
|
if (channel == 33) {
|
|
|
|
|
return isIos
|
|
|
|
|
? "https://apps.apple.com/sa/app/al-habib-mohem/id1480157255"
|
|
|
|
|
: "https://play.google.com/store/apps/details?id=com.cloudsolutions.alhabibmohemm&hl=en";
|
|
|
|
|
} else {
|
|
|
|
|
return isIos
|
|
|
|
|
? "https://apps.apple.com/sa/app/mohemm/id1468856602"
|
|
|
|
|
: "https://play.google.com/store/apps/details?id=hmg.cloudSolutions.mohem&hl=en";
|
|
|
|
|
}
|
|
|
|
|
return channel == 33 ? "https://mohemm.hmg.com/mhmg.html" : "https://mohemm.hmg.com/mohem.html";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String _getInitials(String? name) {
|
|
|
|
|
@ -134,6 +104,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
// Resolve arguments if passed via ModalRoute
|
|
|
|
|
Object? routeArgs = ModalRoute.of(context)?.settings.arguments;
|
|
|
|
|
log("MazayaAccessResultScreen routeArgs: $routeArgs");
|
|
|
|
|
bool effectiveGranted = isGranted;
|
|
|
|
|
String effectiveName = dependentName;
|
|
|
|
|
String? effectiveInitials = dependentInitials;
|
|
|
|
|
@ -182,32 +153,15 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
InkWell(
|
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
|
onTap: () => Navigator.pop(context),
|
|
|
|
|
child: const Padding(
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.arrow_back_ios_new_rounded,
|
|
|
|
|
size: 20,
|
|
|
|
|
color: Color(0xFF1E293B),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: const Padding(padding: EdgeInsets.all(8.0), child: Icon(Icons.arrow_back_ios_new_rounded, size: 20, color: Color(0xFF1E293B))),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 4),
|
|
|
|
|
LocaleKeys.mazayaTitle.tr().toText20(
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: const Color(0xFF1E293B),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.mazayaTitle.tr().toText20(isBold: true, color: const Color(0xFF1E293B)),
|
|
|
|
|
const Spacer(),
|
|
|
|
|
InkWell(
|
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
|
onTap: () => Navigator.pop(context),
|
|
|
|
|
child: const Padding(
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.close_rounded,
|
|
|
|
|
size: 24,
|
|
|
|
|
color: Color(0xFF1E293B),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: const Padding(padding: EdgeInsets.all(8.0), child: Icon(Icons.close_rounded, size: 24, color: Color(0xFF1E293B))),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -220,9 +174,8 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
Expanded(
|
|
|
|
|
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),
|
|
|
|
|
child:
|
|
|
|
|
effectiveGranted ? _buildGrantedContent(context, isAr, fontFamily, effectiveName, initials, linkToShare) : _buildRevokedContent(context, isAr, fontFamily, effectiveName, initials),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
_buildBottomButtons(context, isAr, fontFamily, effectiveGranted, linkToShare, effectiveNationalId ?? "", effectiveDateOfBirth ?? ""),
|
|
|
|
|
@ -232,14 +185,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildGrantedContent(
|
|
|
|
|
BuildContext context,
|
|
|
|
|
bool isAr,
|
|
|
|
|
String fontFamily,
|
|
|
|
|
String name,
|
|
|
|
|
String initials,
|
|
|
|
|
String linkToShare,
|
|
|
|
|
) {
|
|
|
|
|
Widget _buildGrantedContent(BuildContext context, bool isAr, String fontFamily, String name, String initials, String linkToShare) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
@ -249,37 +195,19 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
width: 80,
|
|
|
|
|
height: 80,
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
color: Color(0xFFE6F7F2),
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: CustomPaint(
|
|
|
|
|
size: const Size(40, 40),
|
|
|
|
|
painter: _ShieldPainter(
|
|
|
|
|
color: const Color(0xFF168A89),
|
|
|
|
|
isGranted: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
decoration: const BoxDecoration(color: Color(0xFFE6F7F2), shape: BoxShape.circle),
|
|
|
|
|
child: Center(child: CustomPaint(size: const Size(40, 40), painter: _ShieldPainter(color: const Color(0xFF168A89), isGranted: true))),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
const SizedBox(height: 18),
|
|
|
|
|
|
|
|
|
|
// Title
|
|
|
|
|
LocaleKeys.mazayaAccessGranted.tr().toText22(
|
|
|
|
|
isBold: true,
|
|
|
|
|
isCentered: true,
|
|
|
|
|
color: const Color(0xFF1E293B),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.mazayaAccessGranted.tr().toText22(isBold: true, isCentered: true, color: const Color(0xFF1E293B)),
|
|
|
|
|
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
|
|
|
|
|
// Description
|
|
|
|
|
LocaleKeys.mazayaAccessGrantedDesc.tr(args: <String>[name]).toText14(
|
|
|
|
|
isCenter: true,
|
|
|
|
|
color: const Color(0xFF64748B),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.mazayaAccessGrantedDesc.tr(args: <String>[name]).toText14(isCenter: true, color: const Color(0xFF64748B)),
|
|
|
|
|
|
|
|
|
|
const SizedBox(height: 22),
|
|
|
|
|
|
|
|
|
|
@ -287,35 +215,19 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: const Color(0xFFE8F8F0),
|
|
|
|
|
borderRadius: BorderRadius.circular(14),
|
|
|
|
|
border: Border.all(color: const Color(0xFFCEEFE7), width: 1),
|
|
|
|
|
),
|
|
|
|
|
decoration: BoxDecoration(color: const Color(0xFFE8F8F0), borderRadius: BorderRadius.circular(14), border: Border.all(color: const Color(0xFFCEEFE7), width: 1)),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
const Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 2),
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.check_circle_outline_rounded,
|
|
|
|
|
color: Color(0xFF168A89),
|
|
|
|
|
size: 20,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const Padding(padding: EdgeInsets.only(top: 2), child: Icon(Icons.check_circle_outline_rounded, color: Color(0xFF168A89), size: 20)),
|
|
|
|
|
const SizedBox(width: 10),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
LocaleKeys.accessIsNowActive.tr().toText14(
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: const Color(0xFF168A89),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.accessIsNowActive.tr().toText14(isBold: true, color: const Color(0xFF168A89)),
|
|
|
|
|
const SizedBox(height: 3),
|
|
|
|
|
LocaleKeys.accessIsNowActiveDesc.tr(args: <String>[name]).toText12(
|
|
|
|
|
color: const Color(0xFF64748B),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.accessIsNowActiveDesc.tr(args: <String>[name]).toText12(color: const Color(0xFF64748B)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -333,53 +245,28 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(14),
|
|
|
|
|
border: Border.all(color: const Color(0xFFF1F5F9)),
|
|
|
|
|
boxShadow: const <BoxShadow>[
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Color(0x08000000),
|
|
|
|
|
blurRadius: 10,
|
|
|
|
|
offset: Offset(0, 3),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
boxShadow: const <BoxShadow>[BoxShadow(color: Color(0x08000000), blurRadius: 10, offset: Offset(0, 3))],
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
width: 42,
|
|
|
|
|
height: 42,
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
color: Color(0xFFE6F7F2),
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: initials.toText14(
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: const Color(0xFF168A89),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
decoration: const BoxDecoration(color: Color(0xFFE6F7F2), shape: BoxShape.circle),
|
|
|
|
|
child: Center(child: initials.toText14(isBold: true, color: const Color(0xFF168A89))),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
name.toText14(
|
|
|
|
|
isBold: true,
|
|
|
|
|
maxlines: 1,
|
|
|
|
|
color: const Color(0xFF1E293B),
|
|
|
|
|
),
|
|
|
|
|
name.toText14(isBold: true, maxlines: 1, color: const Color(0xFF1E293B)),
|
|
|
|
|
const SizedBox(height: 2),
|
|
|
|
|
LocaleKeys.dependentAccessActive.tr().toText12(
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: const Color(0xFF168A89),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.dependentAccessActive.tr().toText12(isBold: true, color: const Color(0xFF168A89)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const Icon(
|
|
|
|
|
Icons.lock_open_rounded,
|
|
|
|
|
color: Color(0xFF168A89),
|
|
|
|
|
size: 20,
|
|
|
|
|
),
|
|
|
|
|
const Icon(Icons.lock_open_rounded, color: Color(0xFF168A89), size: 20),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -390,11 +277,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding: const EdgeInsets.all(14),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(14),
|
|
|
|
|
border: Border.all(color: const Color(0xFFE2E8F0)),
|
|
|
|
|
),
|
|
|
|
|
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(14), border: Border.all(color: const Color(0xFFE2E8F0))),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
@ -404,31 +287,17 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
width: 36,
|
|
|
|
|
height: 36,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: const Color(0xFFE8F8F0),
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
child: const Center(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.smartphone_rounded,
|
|
|
|
|
color: Color(0xFF168A89),
|
|
|
|
|
size: 20,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
decoration: BoxDecoration(color: const Color(0xFFE8F8F0), borderRadius: BorderRadius.circular(10)),
|
|
|
|
|
child: const Center(child: Icon(Icons.smartphone_rounded, color: Color(0xFF168A89), size: 20)),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 10),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
LocaleKeys.shareableAppDownloadLink.tr().toText14(
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: const Color(0xFF1E293B),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.shareableAppDownloadLink.tr().toText14(isBold: true, color: const Color(0xFF1E293B)),
|
|
|
|
|
const SizedBox(height: 2),
|
|
|
|
|
LocaleKeys.shareableAppDownloadLinkDesc.tr(args: <String>[name]).toText12(
|
|
|
|
|
color: const Color(0xFF64748B),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.shareableAppDownloadLinkDesc.tr(args: <String>[name]).toText12(color: const Color(0xFF64748B)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -438,23 +307,13 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 9),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: const Color(0xFFF8FAFC),
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
border: Border.all(color: const Color(0xFFE2E8F0)),
|
|
|
|
|
),
|
|
|
|
|
decoration: BoxDecoration(color: const Color(0xFFF8FAFC), borderRadius: BorderRadius.circular(10), border: Border.all(color: const Color(0xFFE2E8F0))),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
LocaleKeys.downloadLink.tr().toText11(
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: const Color(0xFF168A89),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.downloadLink.tr().toText11(isBold: true, color: const Color(0xFF168A89)),
|
|
|
|
|
const SizedBox(height: 3),
|
|
|
|
|
linkToShare.toText12(
|
|
|
|
|
maxLine: 1,
|
|
|
|
|
color: const Color(0xFF334155),
|
|
|
|
|
),
|
|
|
|
|
linkToShare.toText12(maxLine: 1, color: const Color(0xFF334155)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -465,13 +324,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) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
@ -481,37 +334,19 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
width: 80,
|
|
|
|
|
height: 80,
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
color: Color(0xFFFEECEB),
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: CustomPaint(
|
|
|
|
|
size: const Size(40, 40),
|
|
|
|
|
painter: _ShieldPainter(
|
|
|
|
|
color: const Color(0xFFED1C24),
|
|
|
|
|
isGranted: false,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
decoration: const BoxDecoration(color: Color(0xFFFEECEB), shape: BoxShape.circle),
|
|
|
|
|
child: Center(child: CustomPaint(size: const Size(40, 40), painter: _ShieldPainter(color: const Color(0xFFED1C24), isGranted: false))),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
const SizedBox(height: 18),
|
|
|
|
|
|
|
|
|
|
// Title
|
|
|
|
|
LocaleKeys.mazayaAccessRevoked.tr().toText22(
|
|
|
|
|
isBold: true,
|
|
|
|
|
isCentered: true,
|
|
|
|
|
color: const Color(0xFF1E293B),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.mazayaAccessRevoked.tr().toText22(isBold: true, isCentered: true, color: const Color(0xFF1E293B)),
|
|
|
|
|
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
|
|
|
|
|
// Description
|
|
|
|
|
LocaleKeys.mazayaAccessRevokedDesc.tr().toText14(
|
|
|
|
|
isCenter: true,
|
|
|
|
|
color: const Color(0xFF64748B),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.mazayaAccessRevokedDesc.tr().toText14(isCenter: true, color: const Color(0xFF64748B)),
|
|
|
|
|
|
|
|
|
|
const SizedBox(height: 22),
|
|
|
|
|
|
|
|
|
|
@ -519,35 +354,19 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: const Color(0xFFFFF5F5),
|
|
|
|
|
borderRadius: BorderRadius.circular(14),
|
|
|
|
|
border: Border.all(color: const Color(0xFFFFCDD2), width: 1),
|
|
|
|
|
),
|
|
|
|
|
decoration: BoxDecoration(color: const Color(0xFFFFF5F5), borderRadius: BorderRadius.circular(14), border: Border.all(color: const Color(0xFFFFCDD2), width: 1)),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
const Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 2),
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.phone_outlined,
|
|
|
|
|
color: Color(0xFFED1C24),
|
|
|
|
|
size: 20,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const Padding(padding: EdgeInsets.only(top: 2), child: Icon(Icons.phone_outlined, color: Color(0xFFED1C24), size: 20)),
|
|
|
|
|
const SizedBox(width: 10),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
LocaleKeys.contactYourSponsor.tr().toText14(
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: const Color(0xFFED1C24),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.contactYourSponsor.tr().toText14(isBold: true, color: const Color(0xFFED1C24)),
|
|
|
|
|
const SizedBox(height: 3),
|
|
|
|
|
LocaleKeys.contactYourSponsorDesc.tr().toText12(
|
|
|
|
|
color: const Color(0xFF64748B),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.contactYourSponsorDesc.tr().toText12(color: const Color(0xFF64748B)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -565,53 +384,28 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(14),
|
|
|
|
|
border: Border.all(color: const Color(0xFFF1F5F9)),
|
|
|
|
|
boxShadow: const <BoxShadow>[
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Color(0x08000000),
|
|
|
|
|
blurRadius: 10,
|
|
|
|
|
offset: Offset(0, 3),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
boxShadow: const <BoxShadow>[BoxShadow(color: Color(0x08000000), blurRadius: 10, offset: Offset(0, 3))],
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
width: 42,
|
|
|
|
|
height: 42,
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
color: Color(0xFFFFF1F0),
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: initials.toText14(
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: const Color(0xFFED1C24),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
decoration: const BoxDecoration(color: Color(0xFFFFF1F0), shape: BoxShape.circle),
|
|
|
|
|
child: Center(child: initials.toText14(isBold: true, color: const Color(0xFFED1C24))),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
name.toText14(
|
|
|
|
|
isBold: true,
|
|
|
|
|
maxlines: 1,
|
|
|
|
|
color: const Color(0xFF1E293B),
|
|
|
|
|
),
|
|
|
|
|
name.toText14(isBold: true, maxlines: 1, color: const Color(0xFF1E293B)),
|
|
|
|
|
const SizedBox(height: 2),
|
|
|
|
|
LocaleKeys.dependentAccessBlocked.tr().toText12(
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: const Color(0xFFED1C24),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.dependentAccessBlocked.tr().toText12(isBold: true, color: const Color(0xFFED1C24)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const Icon(
|
|
|
|
|
Icons.lock_outline_rounded,
|
|
|
|
|
color: Color(0xFFED1C24),
|
|
|
|
|
size: 20,
|
|
|
|
|
),
|
|
|
|
|
const Icon(Icons.lock_outline_rounded, color: Color(0xFFED1C24), size: 20),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -619,25 +413,51 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Display-only DOB formatting for the share message: "dd-MM-yyyy", no time component.
|
|
|
|
|
// The raw value can come in as the API's "/Date(ms+tz)/" wrapper or a plain ISO datetime string
|
|
|
|
|
// with a time component - either way we only want the date part.
|
|
|
|
|
String _formatDob(String raw) {
|
|
|
|
|
String s = raw.trim();
|
|
|
|
|
if (s.isEmpty) return "";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
RegExp aspNetDateRegex = RegExp(r'/Date\((-?\d+)([+-]\d{4})?\)/');
|
|
|
|
|
Match? match = aspNetDateRegex.firstMatch(s);
|
|
|
|
|
if (match != null) {
|
|
|
|
|
int ms = int.parse(match.group(1)!);
|
|
|
|
|
return DateFormat('dd-MM-yyyy').format(DateTime.fromMillisecondsSinceEpoch(ms, isUtc: true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DateTime? parsed = DateTime.tryParse(s);
|
|
|
|
|
if (parsed != null) {
|
|
|
|
|
return DateFormat('dd-MM-yyyy').format(parsed);
|
|
|
|
|
}
|
|
|
|
|
} catch (_) {}
|
|
|
|
|
|
|
|
|
|
// Fallback: strip a time component off a plain "yyyy-MM-dd HH:mm:ss" / "yyyy-MM-ddTHH:mm:ss"
|
|
|
|
|
// string we couldn't otherwise parse, rather than showing it as-is with the time attached.
|
|
|
|
|
if (s.contains('T')) return s.split('T').first;
|
|
|
|
|
if (s.contains(' ')) return s.split(' ').first;
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Builds the invite text (link + localized instructions + credentials) and shares it
|
|
|
|
|
// together with the language-appropriate steps PDF from assets. Falls back to sharing
|
|
|
|
|
// just the text if the PDF can't be loaded/copied for any reason.
|
|
|
|
|
Future<void> _shareMazayaInvite(
|
|
|
|
|
bool isAr,
|
|
|
|
|
String linkToShare,
|
|
|
|
|
String nationalId,
|
|
|
|
|
String dateOfBirth,
|
|
|
|
|
) async {
|
|
|
|
|
String message =
|
|
|
|
|
"$linkToShare\n\n${LocaleKeys.mazayaInviteInstructions.tr()}\n\n${LocaleKeys.nationalId.tr()}: $nationalId\n${LocaleKeys.dateOfBirth.tr()}: $dateOfBirth";
|
|
|
|
|
Future<void> _shareMazayaInvite(bool isAr, String linkToShare, String nationalId, String dateOfBirth) async {
|
|
|
|
|
String nationalIdLine = nationalId.trim().isEmpty ? LocaleKeys.nationalIdOrIqamaFallback.tr() : "${LocaleKeys.nationalId.tr()}: $nationalId";
|
|
|
|
|
String message = "$linkToShare\n\n${LocaleKeys.mazayaInviteInstructions.tr()}\n\n$nationalIdLine\n${LocaleKeys.dateOfBirth.tr()}: ${_formatDob(dateOfBirth)}";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
String fileName = isAr ? "mazaya_invite_steps_ar.pdf" : "mazaya_invite_steps_en.pdf";
|
|
|
|
|
ByteData bytes = await rootBundle.load("assets/pdf/$fileName");
|
|
|
|
|
String assetFileName = isAr ? "Mazaya Access Guide Arabic.pdf" : "Mazaya Access Guide English.pdf";
|
|
|
|
|
ByteData bytes = await rootBundle.load("assets/pdf/$assetFileName");
|
|
|
|
|
Directory tempDir = await getTemporaryDirectory();
|
|
|
|
|
File pdfFile = File('${tempDir.path}/$fileName');
|
|
|
|
|
// Write to a space-free filename locally - the asset path above is what actually matters.
|
|
|
|
|
String localFileName = isAr ? "mazaya_access_guide_ar.pdf" : "mazaya_access_guide_en.pdf";
|
|
|
|
|
File pdfFile = File('${tempDir.path}/$localFileName');
|
|
|
|
|
await pdfFile.writeAsBytes(bytes.buffer.asUint8List(bytes.offsetInBytes, bytes.lengthInBytes));
|
|
|
|
|
|
|
|
|
|
log("final: $message\n\nfile: ${pdfFile.path}");
|
|
|
|
|
await SharePlus.instance.share(ShareParams(text: message, files: [XFile(pdfFile.path)]));
|
|
|
|
|
} catch (_) {
|
|
|
|
|
try {
|
|
|
|
|
@ -646,15 +466,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildBottomButtons(
|
|
|
|
|
BuildContext context,
|
|
|
|
|
bool isAr,
|
|
|
|
|
String fontFamily,
|
|
|
|
|
bool granted,
|
|
|
|
|
String linkToShare,
|
|
|
|
|
String nationalId,
|
|
|
|
|
String dateOfBirth,
|
|
|
|
|
) {
|
|
|
|
|
Widget _buildBottomButtons(BuildContext context, bool isAr, String fontFamily, bool granted, String linkToShare, String nationalId, String dateOfBirth) {
|
|
|
|
|
if (granted) {
|
|
|
|
|
return Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|