|
|
|
|
@ -5,9 +5,20 @@ import 'package:hmg_patient_app_new/core/app_state.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/enums.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
|
|
/// Global context from the navigator key — available after first route is built.
|
|
|
|
|
/// Used by toText* extensions to resolve theme-aware colors.
|
|
|
|
|
BuildContext? get _globalContext => getIt.get<NavigationService>().context;
|
|
|
|
|
|
|
|
|
|
Color get _defaultTextColor {
|
|
|
|
|
final ctx = _globalContext;
|
|
|
|
|
if (ctx == null) return AppColors.textColor;
|
|
|
|
|
return ctx.textColor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension CapExtension on String {
|
|
|
|
|
String get toCamelCase => "${this[0].toUpperCase()}${substring(1)}";
|
|
|
|
|
|
|
|
|
|
@ -31,61 +42,40 @@ extension EmailValidator on String {
|
|
|
|
|
fontSize: 8.f,
|
|
|
|
|
fontStyle: fontStyle ?? FontStyle.normal,
|
|
|
|
|
fontWeight: fontWeight ?? (isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
color: color ?? AppColors.blackColor,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
letterSpacing: 0,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText10(
|
|
|
|
|
{bool isEnglishOnly = false,
|
|
|
|
|
Color? color,
|
|
|
|
|
FontWeight? weight,
|
|
|
|
|
bool isBold = false,
|
|
|
|
|
bool isUnderLine = false,
|
|
|
|
|
bool isCenter = false,
|
|
|
|
|
int? maxlines,
|
|
|
|
|
FontStyle? fontStyle,
|
|
|
|
|
TextOverflow? textOverflow,
|
|
|
|
|
double letterSpacing = 0}) =>
|
|
|
|
|
Text(
|
|
|
|
|
Widget toText9({Color? color, FontWeight? weight, bool isBold = false, bool isUnderLine = false, bool isCenter = false, int? maxlines, FontStyle? fontStyle, TextOverflow? textOverflow, double letterSpacing = 0}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : null,
|
|
|
|
|
maxLines: maxlines,
|
|
|
|
|
overflow: textOverflow,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 10.f,
|
|
|
|
|
fontSize: 9.f,
|
|
|
|
|
fontStyle: fontStyle ?? FontStyle.normal,
|
|
|
|
|
fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
color: color ?? AppColors.blackColor,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
letterSpacing: letterSpacing,
|
|
|
|
|
decoration: isUnderLine ? TextDecoration.underline : null,
|
|
|
|
|
fontFamily: isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins',
|
|
|
|
|
decorationColor: color ?? AppColors.blackColor),
|
|
|
|
|
decorationColor: color ?? _defaultTextColor),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText9(
|
|
|
|
|
{Color? color,
|
|
|
|
|
FontWeight? weight,
|
|
|
|
|
bool isBold = false,
|
|
|
|
|
bool isUnderLine = false,
|
|
|
|
|
bool isCenter = false,
|
|
|
|
|
int? maxlines,
|
|
|
|
|
FontStyle? fontStyle,
|
|
|
|
|
TextOverflow? textOverflow,
|
|
|
|
|
double letterSpacing = 0}) =>
|
|
|
|
|
Text(
|
|
|
|
|
Widget toText10({bool isEnglishOnly = false, Color? color, FontWeight? weight, bool isBold = false, bool isUnderLine = false, bool isCenter = false, int? maxlines, FontStyle? fontStyle, TextOverflow? textOverflow, double letterSpacing = 0}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : null,
|
|
|
|
|
maxLines: maxlines,
|
|
|
|
|
overflow: textOverflow,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 9.f,
|
|
|
|
|
fontSize: 10.f,
|
|
|
|
|
fontStyle: fontStyle ?? FontStyle.normal,
|
|
|
|
|
fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
color: color ?? AppColors.blackColor,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
letterSpacing: letterSpacing,
|
|
|
|
|
decoration: isUnderLine ? TextDecoration.underline : null,
|
|
|
|
|
decorationColor: color ?? AppColors.blackColor),
|
|
|
|
|
fontFamily: isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins',
|
|
|
|
|
decorationColor: color ?? _defaultTextColor),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText11({Color? color, FontWeight? weight, bool isUnderLine = false, bool isCenter = false, bool isBold = false, int maxLine = 0, double letterSpacing = 0}) => Text(
|
|
|
|
|
@ -96,33 +86,23 @@ extension EmailValidator on String {
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11.f,
|
|
|
|
|
fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
color: color ?? AppColors.blackColor,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
letterSpacing: letterSpacing,
|
|
|
|
|
decoration: isUnderLine ? TextDecoration.underline : null,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText12(
|
|
|
|
|
{bool isEnglishOnly = false, Color? color,
|
|
|
|
|
bool isUnderLine = false,
|
|
|
|
|
TextAlign textAlignment = TextAlign.start,
|
|
|
|
|
bool isBold = false,
|
|
|
|
|
FontWeight? fontWeight,
|
|
|
|
|
bool isCenter = false,
|
|
|
|
|
double? height,
|
|
|
|
|
double? letterSpacing,
|
|
|
|
|
int maxLine = 0}) =>
|
|
|
|
|
Text(
|
|
|
|
|
Widget toText12({bool isEnglishOnly = false, Color? color, bool isUnderLine = false, TextAlign textAlignment = TextAlign.start, bool isBold = false, FontWeight? fontWeight, bool isCenter = false, double? height, double? letterSpacing, int maxLine = 0}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : textAlignment,
|
|
|
|
|
maxLines: (maxLine > 0) ? maxLine : null,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12.f,
|
|
|
|
|
fontWeight: fontWeight ?? (isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
color: color ?? AppColors.blackColor,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
letterSpacing: letterSpacing ?? 0,
|
|
|
|
|
height: height,
|
|
|
|
|
decorationColor: isUnderLine ? AppColors.blackColor : null,
|
|
|
|
|
decorationColor: isUnderLine ? color ?? _defaultTextColor : null,
|
|
|
|
|
decoration: isUnderLine ? TextDecoration.underline : null,
|
|
|
|
|
fontFamily: isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins',
|
|
|
|
|
),
|
|
|
|
|
@ -136,25 +116,13 @@ extension EmailValidator on String {
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12.f,
|
|
|
|
|
fontWeight: isBold ? FontWeight.bold : FontWeight.normal,
|
|
|
|
|
color: color ?? AppColors.blackColor,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
letterSpacing: 0,
|
|
|
|
|
decoration: isUnderLine ? TextDecoration.underline : null,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toTextAuto({
|
|
|
|
|
Color? color,
|
|
|
|
|
bool isUnderLine = false,
|
|
|
|
|
bool isBold = false,
|
|
|
|
|
bool isCenter = false,
|
|
|
|
|
int maxLine = 0,
|
|
|
|
|
double fontSize = 12,
|
|
|
|
|
double letterSpacing = 0.64,
|
|
|
|
|
double height = 1,
|
|
|
|
|
TextOverflow? textOverflow,
|
|
|
|
|
FontWeight? fontWeight,
|
|
|
|
|
}) =>
|
|
|
|
|
AutoSizeText(
|
|
|
|
|
Widget toTextAuto({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0, double fontSize = 12, double letterSpacing = 0.64, double height = 1, TextOverflow? textOverflow, FontWeight? fontWeight}) => AutoSizeText(
|
|
|
|
|
this,
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : null,
|
|
|
|
|
maxLines: (maxLine > 0) ? maxLine : null,
|
|
|
|
|
@ -164,7 +132,7 @@ extension EmailValidator on String {
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: fontSize,
|
|
|
|
|
fontWeight: fontWeight ?? (isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
color: color ?? AppColors.blackColor,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
letterSpacing: letterSpacing,
|
|
|
|
|
decoration: isUnderLine ? TextDecoration.underline : null,
|
|
|
|
|
),
|
|
|
|
|
@ -177,38 +145,25 @@ extension EmailValidator on String {
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.f,
|
|
|
|
|
fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
color: color ?? AppColors.blackColor,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
letterSpacing: letterSpacing,
|
|
|
|
|
decoration: isUnderLine ? TextDecoration.underline : null),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText14({
|
|
|
|
|
bool isEnglishOnly = false,
|
|
|
|
|
Color? color,
|
|
|
|
|
bool isUnderLine = false,
|
|
|
|
|
bool isBold = false,
|
|
|
|
|
bool isCenter = false,
|
|
|
|
|
FontWeight? weight,
|
|
|
|
|
int? maxlines,
|
|
|
|
|
double? letterSpacing = 0,
|
|
|
|
|
double? height,
|
|
|
|
|
String? fontFamily,
|
|
|
|
|
TextOverflow? textOverflow,
|
|
|
|
|
}) =>
|
|
|
|
|
Text(
|
|
|
|
|
Widget toText14({bool isEnglishOnly = false, Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, FontWeight? weight, int? maxlines, double? letterSpacing = 0, double? height, String? fontFamily, TextOverflow? textOverflow}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : null,
|
|
|
|
|
maxLines: maxlines,
|
|
|
|
|
overflow: textOverflow,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: color ?? AppColors.blackColor,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
fontSize: 14.f,
|
|
|
|
|
letterSpacing: letterSpacing,
|
|
|
|
|
height: height,
|
|
|
|
|
fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
decoration: isUnderLine ? TextDecoration.underline : null,
|
|
|
|
|
fontFamily: fontFamily ?? (isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins'),
|
|
|
|
|
decorationColor: color ?? AppColors.blackColor),
|
|
|
|
|
decorationColor: color ?? _defaultTextColor),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText15({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, FontWeight? weight, int? maxlines, double? letterSpacing = -1}) => Text(
|
|
|
|
|
@ -216,32 +171,19 @@ extension EmailValidator on String {
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : null,
|
|
|
|
|
maxLines: maxlines,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: color ?? AppColors.blackColor,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
fontSize: 15.f,
|
|
|
|
|
letterSpacing: letterSpacing,
|
|
|
|
|
fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
decoration: isUnderLine ? TextDecoration.underline : null),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText16({bool isEnglishOnly = false, Color? color,
|
|
|
|
|
bool isUnderLine = false,
|
|
|
|
|
bool isBold = false,
|
|
|
|
|
bool isCenter = false,
|
|
|
|
|
int? maxlines,
|
|
|
|
|
double? height,
|
|
|
|
|
TextAlign? textAlign,
|
|
|
|
|
FontWeight? weight,
|
|
|
|
|
TextOverflow? textOverflow,
|
|
|
|
|
String? fontFamily,
|
|
|
|
|
double? letterSpacing = -0.4,
|
|
|
|
|
Color decorationColor = AppColors.errorColor}) =>
|
|
|
|
|
Text(
|
|
|
|
|
Widget toText16({bool isEnglishOnly = false, Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int? maxlines, double? height, TextAlign? textAlign, FontWeight? weight, TextOverflow? textOverflow, String? fontFamily, double? letterSpacing = -0.4, Color? decorationColor}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
maxLines: maxlines,
|
|
|
|
|
textAlign: isCenter ? textAlign ?? TextAlign.center : null,
|
|
|
|
|
// locale: Locale('en', 'US'),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: color ?? AppColors.blackColor,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
fontSize: 16.f,
|
|
|
|
|
letterSpacing: letterSpacing,
|
|
|
|
|
height: height,
|
|
|
|
|
@ -255,74 +197,93 @@ extension EmailValidator on String {
|
|
|
|
|
Widget toText17({bool isEnglishOnly = false, Color? color, bool isBold = false, bool isCenter = false}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : null,
|
|
|
|
|
style: TextStyle(color: color ?? AppColors.blackColor, fontSize: 17.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, fontFamily: isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins'),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
fontSize: 17.f,
|
|
|
|
|
letterSpacing: -1,
|
|
|
|
|
fontWeight: isBold ? FontWeight.bold : FontWeight.normal,
|
|
|
|
|
fontFamily: isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins'),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText18({Color? color, FontWeight? weight, bool isBold = false, bool isCenter = false, int? maxlines, TextOverflow? textOverflow}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
maxLines: maxlines,
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : null,
|
|
|
|
|
this,
|
|
|
|
|
overflow: textOverflow,
|
|
|
|
|
style: TextStyle(fontSize: 18.f, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? AppColors.blackColor, letterSpacing: -0.4),
|
|
|
|
|
style: TextStyle(fontSize: 18.f, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? _defaultTextColor, letterSpacing: -0.4),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText19({Color? color, bool isBold = false}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
style: TextStyle(fontSize: 19.f, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, color: color ?? AppColors.blackColor, letterSpacing: -0.4),
|
|
|
|
|
style: TextStyle(fontSize: 19.f, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, color: color ?? _defaultTextColor, letterSpacing: -0.4),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText20({
|
|
|
|
|
Color? color,
|
|
|
|
|
FontWeight? weight,
|
|
|
|
|
bool isBold = false,
|
|
|
|
|
}) =>
|
|
|
|
|
Text(
|
|
|
|
|
Widget toText20({Color? color, FontWeight? weight, bool isBold = false}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
style: TextStyle(fontSize: 20.f, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? AppColors.blackColor, letterSpacing: -0.4),
|
|
|
|
|
style: TextStyle(fontSize: 20.f, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? _defaultTextColor, letterSpacing: -0.4),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText21({Color? color, bool isBold = false, FontWeight? weight, int? maxlines}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
maxLines: maxlines,
|
|
|
|
|
style: TextStyle(color: color ?? AppColors.blackColor, fontSize: 21.f, letterSpacing: -1, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal)),
|
|
|
|
|
style: TextStyle(color: color ?? _defaultTextColor, fontSize: 21.f, letterSpacing: -1, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal)),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText22({Color? color, bool isBold = false, bool isCenter = false}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : null,
|
|
|
|
|
style: TextStyle(height: 1, color: color ?? AppColors.blackColor, fontSize: 22.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
style: TextStyle(height: 1, color: color ?? _defaultTextColor, fontSize: 22.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText24({Color? color, bool isBold = false, bool isCenter = false, FontWeight? fontWeight, double? letterSpacing}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : null,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
height: 23 / 24, color: color ?? AppColors.blackColor, fontSize: 24.f, letterSpacing: letterSpacing ?? -1, fontWeight: isBold ? FontWeight.bold : fontWeight ?? FontWeight.normal),
|
|
|
|
|
height: 23 / 24,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
fontSize: 24.f,
|
|
|
|
|
letterSpacing: letterSpacing ?? -1,
|
|
|
|
|
fontWeight: isBold ? FontWeight.bold : fontWeight ?? FontWeight.normal),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText26({Color? color, bool isBold = false, double? height, bool isCenter = false, FontWeight? weight, double? letterSpacing}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : null,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
height: height ?? 23 / 26, color: color ?? AppColors.blackColor, fontSize: 26.f, letterSpacing: letterSpacing ?? -1, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal)),
|
|
|
|
|
height: height ?? 23 / 26,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
fontSize: 26.f,
|
|
|
|
|
letterSpacing: letterSpacing ?? -1,
|
|
|
|
|
fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal)),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText28({bool isEnglishOnly = false, Color? color, bool isBold = false, double? height, bool isCenter = false, double? letterSpacing}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : null,
|
|
|
|
|
style: TextStyle(height: height ?? 23 / 28, color: color ?? AppColors.blackColor, fontSize: 28.f, letterSpacing: letterSpacing ?? -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, fontFamily: isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins'),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
height: height ?? 23 / 28,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
fontSize: 28.f,
|
|
|
|
|
letterSpacing: letterSpacing ?? -1,
|
|
|
|
|
fontWeight: isBold ? FontWeight.bold : FontWeight.normal,
|
|
|
|
|
fontFamily: isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins'),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText32({bool isEnglishOnly = false, FontWeight? weight, Color? color, bool isBold = false, bool isCenter = false}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
textAlign: isCenter ? TextAlign.center : null,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
height: 32 / 32, color: color ?? AppColors.blackColor, fontSize: 32.f, letterSpacing: -1, fontFamily: isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins', fontWeight: isBold ? FontWeight.bold : weight ?? FontWeight.normal),
|
|
|
|
|
height: 32 / 32,
|
|
|
|
|
color: color ?? _defaultTextColor,
|
|
|
|
|
fontSize: 32.f,
|
|
|
|
|
letterSpacing: -1,
|
|
|
|
|
fontFamily: isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins',
|
|
|
|
|
fontWeight: isBold ? FontWeight.bold : weight ?? FontWeight.normal),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toText44({Color? color, bool isBold = false}) => Text(
|
|
|
|
|
this,
|
|
|
|
|
style: TextStyle(height: 32 / 32, color: color ?? AppColors.blackColor, fontSize: 44.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
style: TextStyle(height: 32 / 32, color: color ?? _defaultTextColor, fontSize: 44.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget toSectionHeading({String upperHeading = "", String lowerHeading = ""}) {
|
|
|
|
|
@ -331,7 +292,6 @@ extension EmailValidator on String {
|
|
|
|
|
String heading = this;
|
|
|
|
|
if (heading.isNotEmpty) {
|
|
|
|
|
List<String> data = heading.split(" ");
|
|
|
|
|
|
|
|
|
|
if (data.length > 1) {
|
|
|
|
|
upper = data[0];
|
|
|
|
|
data.removeAt(0);
|
|
|
|
|
@ -340,13 +300,8 @@ extension EmailValidator on String {
|
|
|
|
|
lower = data[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (upperHeading.isNotEmpty) {
|
|
|
|
|
upper = upperHeading;
|
|
|
|
|
}
|
|
|
|
|
if (lowerHeading.isNotEmpty) {
|
|
|
|
|
lower = lowerHeading;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (upperHeading.isNotEmpty) upper = upperHeading;
|
|
|
|
|
if (lowerHeading.isNotEmpty) lower = lowerHeading;
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
@ -370,32 +325,19 @@ extension EmailValidator on String {
|
|
|
|
|
|
|
|
|
|
String getMonth(int month) {
|
|
|
|
|
switch (month) {
|
|
|
|
|
case 1:
|
|
|
|
|
return "January";
|
|
|
|
|
case 2:
|
|
|
|
|
return "February";
|
|
|
|
|
case 3:
|
|
|
|
|
return "March";
|
|
|
|
|
case 4:
|
|
|
|
|
return "April";
|
|
|
|
|
case 5:
|
|
|
|
|
return "May";
|
|
|
|
|
case 6:
|
|
|
|
|
return "June";
|
|
|
|
|
case 7:
|
|
|
|
|
return "July";
|
|
|
|
|
case 8:
|
|
|
|
|
return "August";
|
|
|
|
|
case 9:
|
|
|
|
|
return "September";
|
|
|
|
|
case 10:
|
|
|
|
|
return "October";
|
|
|
|
|
case 11:
|
|
|
|
|
return "November";
|
|
|
|
|
case 12:
|
|
|
|
|
return "December";
|
|
|
|
|
default:
|
|
|
|
|
return "";
|
|
|
|
|
case 1: return "January";
|
|
|
|
|
case 2: return "February";
|
|
|
|
|
case 3: return "March";
|
|
|
|
|
case 4: return "April";
|
|
|
|
|
case 5: return "May";
|
|
|
|
|
case 6: return "June";
|
|
|
|
|
case 7: return "July";
|
|
|
|
|
case 8: return "August";
|
|
|
|
|
case 9: return "September";
|
|
|
|
|
case 10: return "October";
|
|
|
|
|
case 11: return "November";
|
|
|
|
|
case 12: return "December";
|
|
|
|
|
default: return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -409,8 +351,8 @@ extension EmailValidator on String {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension DynamicTextStyleExtension on BuildContext {
|
|
|
|
|
TextStyle dynamicTextStyle(
|
|
|
|
|
{double? fontSize,
|
|
|
|
|
TextStyle dynamicTextStyle({
|
|
|
|
|
double? fontSize,
|
|
|
|
|
FontWeight? fontWeight,
|
|
|
|
|
Color? color,
|
|
|
|
|
double? letterSpacing,
|
|
|
|
|
@ -426,7 +368,7 @@ extension DynamicTextStyleExtension on BuildContext {
|
|
|
|
|
TextBaseline? textBaseline,
|
|
|
|
|
FontStyle? fontStyle,
|
|
|
|
|
String? fontFamily,
|
|
|
|
|
bool isLanguageSwitcher = false}) {
|
|
|
|
|
}) {
|
|
|
|
|
AppState appState = getIt.get<AppState>();
|
|
|
|
|
final family = appState.getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins';
|
|
|
|
|
return TextStyle(
|
|
|
|
|
@ -450,53 +392,32 @@ extension DynamicTextStyleExtension on BuildContext {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class FontUtils {
|
|
|
|
|
/// Get the appropriate font family based on the current language
|
|
|
|
|
static bool getFontFamily(BuildContext context) {
|
|
|
|
|
// final projectViewModel = Provider.of<ProjectViewModel>(context, listen: false);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Get the appropriate font family for a specific language
|
|
|
|
|
static String getFontFamilyForLanguage(bool isArabic) {
|
|
|
|
|
return isArabic ? 'GESSTwo' : 'Poppins';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension CountryExtension on CountryEnum {
|
|
|
|
|
String get displayName {
|
|
|
|
|
switch (this) {
|
|
|
|
|
case CountryEnum.saudiArabia:
|
|
|
|
|
return "Kingdom Of Saudi Arabia";
|
|
|
|
|
case CountryEnum.unitedArabEmirates:
|
|
|
|
|
return "United Arab Emirates";
|
|
|
|
|
case CountryEnum.saudiArabia: return "Kingdom Of Saudi Arabia";
|
|
|
|
|
case CountryEnum.unitedArabEmirates: return "United Arab Emirates";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String get nameArabic {
|
|
|
|
|
switch (this) {
|
|
|
|
|
case CountryEnum.saudiArabia:
|
|
|
|
|
return "المملكة العربية السعودية";
|
|
|
|
|
case CountryEnum.unitedArabEmirates:
|
|
|
|
|
return "الإمارات العربية المتحدة";
|
|
|
|
|
case CountryEnum.saudiArabia: return "المملكة العربية السعودية";
|
|
|
|
|
case CountryEnum.unitedArabEmirates: return "الإمارات العربية المتحدة";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String get iconPath {
|
|
|
|
|
switch (this) {
|
|
|
|
|
case CountryEnum.saudiArabia:
|
|
|
|
|
return AppAssets.ksa;
|
|
|
|
|
case CountryEnum.unitedArabEmirates:
|
|
|
|
|
return AppAssets.uae;
|
|
|
|
|
case CountryEnum.saudiArabia: return AppAssets.ksa;
|
|
|
|
|
case CountryEnum.unitedArabEmirates: return AppAssets.uae;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String get countryCode {
|
|
|
|
|
switch (this) {
|
|
|
|
|
case CountryEnum.saudiArabia:
|
|
|
|
|
return "966";
|
|
|
|
|
case CountryEnum.unitedArabEmirates:
|
|
|
|
|
return "971";
|
|
|
|
|
case CountryEnum.saudiArabia: return "966";
|
|
|
|
|
case CountryEnum.unitedArabEmirates: return "971";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -516,30 +437,22 @@ extension CountryExtension on CountryEnum {
|
|
|
|
|
|
|
|
|
|
extension GenderTypeExtension on GenderTypeEnum {
|
|
|
|
|
String get value => this == GenderTypeEnum.male ? "M" : "F";
|
|
|
|
|
|
|
|
|
|
String get type => this == GenderTypeEnum.male ? "Male" : "Female";
|
|
|
|
|
|
|
|
|
|
String get typeAr => this == GenderTypeEnum.male ? "ذكر" : "أنثى";
|
|
|
|
|
|
|
|
|
|
static GenderTypeEnum? fromValue(String? value) {
|
|
|
|
|
switch (value) {
|
|
|
|
|
case "M":
|
|
|
|
|
return GenderTypeEnum.male;
|
|
|
|
|
case "F":
|
|
|
|
|
return GenderTypeEnum.female;
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
case "M": return GenderTypeEnum.male;
|
|
|
|
|
case "F": return GenderTypeEnum.female;
|
|
|
|
|
default: return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GenderTypeEnum? fromType(String? type) {
|
|
|
|
|
switch (type) {
|
|
|
|
|
case "Male":
|
|
|
|
|
return GenderTypeEnum.male;
|
|
|
|
|
case "Female":
|
|
|
|
|
return GenderTypeEnum.female;
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
case "Male": return GenderTypeEnum.male;
|
|
|
|
|
case "Female": return GenderTypeEnum.female;
|
|
|
|
|
default: return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -547,70 +460,48 @@ extension GenderTypeExtension on GenderTypeEnum {
|
|
|
|
|
extension MaritalStatusTypeExtension on MaritalStatusTypeEnum {
|
|
|
|
|
String get value {
|
|
|
|
|
switch (this) {
|
|
|
|
|
case MaritalStatusTypeEnum.single:
|
|
|
|
|
return "U";
|
|
|
|
|
case MaritalStatusTypeEnum.married:
|
|
|
|
|
return "M";
|
|
|
|
|
case MaritalStatusTypeEnum.divorced:
|
|
|
|
|
return "D";
|
|
|
|
|
case MaritalStatusTypeEnum.widowed:
|
|
|
|
|
return "W";
|
|
|
|
|
case MaritalStatusTypeEnum.single: return "U";
|
|
|
|
|
case MaritalStatusTypeEnum.married: return "M";
|
|
|
|
|
case MaritalStatusTypeEnum.divorced: return "D";
|
|
|
|
|
case MaritalStatusTypeEnum.widowed: return "W";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String get type {
|
|
|
|
|
switch (this) {
|
|
|
|
|
case MaritalStatusTypeEnum.single:
|
|
|
|
|
return "Single";
|
|
|
|
|
case MaritalStatusTypeEnum.married:
|
|
|
|
|
return "Married";
|
|
|
|
|
case MaritalStatusTypeEnum.divorced:
|
|
|
|
|
return "Divorced";
|
|
|
|
|
case MaritalStatusTypeEnum.widowed:
|
|
|
|
|
return "Widowed";
|
|
|
|
|
case MaritalStatusTypeEnum.single: return "Single";
|
|
|
|
|
case MaritalStatusTypeEnum.married: return "Married";
|
|
|
|
|
case MaritalStatusTypeEnum.divorced: return "Divorced";
|
|
|
|
|
case MaritalStatusTypeEnum.widowed: return "Widowed";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String get typeAr {
|
|
|
|
|
switch (this) {
|
|
|
|
|
case MaritalStatusTypeEnum.single:
|
|
|
|
|
return "أعزب";
|
|
|
|
|
case MaritalStatusTypeEnum.married:
|
|
|
|
|
return "متزوج";
|
|
|
|
|
case MaritalStatusTypeEnum.divorced:
|
|
|
|
|
return "مطلق";
|
|
|
|
|
case MaritalStatusTypeEnum.widowed:
|
|
|
|
|
return "أرمل";
|
|
|
|
|
case MaritalStatusTypeEnum.single: return "أعزب";
|
|
|
|
|
case MaritalStatusTypeEnum.married: return "متزوج";
|
|
|
|
|
case MaritalStatusTypeEnum.divorced: return "مطلق";
|
|
|
|
|
case MaritalStatusTypeEnum.widowed: return "أرمل";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static MaritalStatusTypeEnum? fromValue(String? value) {
|
|
|
|
|
switch (value) {
|
|
|
|
|
case "U":
|
|
|
|
|
return MaritalStatusTypeEnum.single;
|
|
|
|
|
case "M":
|
|
|
|
|
return MaritalStatusTypeEnum.married;
|
|
|
|
|
case "D":
|
|
|
|
|
return MaritalStatusTypeEnum.divorced;
|
|
|
|
|
case "W":
|
|
|
|
|
return MaritalStatusTypeEnum.widowed;
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
case "U": return MaritalStatusTypeEnum.single;
|
|
|
|
|
case "M": return MaritalStatusTypeEnum.married;
|
|
|
|
|
case "D": return MaritalStatusTypeEnum.divorced;
|
|
|
|
|
case "W": return MaritalStatusTypeEnum.widowed;
|
|
|
|
|
default: return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static MaritalStatusTypeEnum? fromType(String? type) {
|
|
|
|
|
switch (type) {
|
|
|
|
|
case "Single":
|
|
|
|
|
return MaritalStatusTypeEnum.single;
|
|
|
|
|
case "Married":
|
|
|
|
|
return MaritalStatusTypeEnum.married;
|
|
|
|
|
case "Divorced":
|
|
|
|
|
return MaritalStatusTypeEnum.divorced;
|
|
|
|
|
case "Widowed":
|
|
|
|
|
return MaritalStatusTypeEnum.widowed;
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
case "Single": return MaritalStatusTypeEnum.single;
|
|
|
|
|
case "Married": return MaritalStatusTypeEnum.married;
|
|
|
|
|
case "Divorced": return MaritalStatusTypeEnum.divorced;
|
|
|
|
|
case "Widowed": return MaritalStatusTypeEnum.widowed;
|
|
|
|
|
default: return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|