|
|
|
@ -12,7 +12,6 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
import 'package:hmg_patient_app_new/widgets/dropdown/country_dropdown_widget.dart';
|
|
|
|
import 'package:hmg_patient_app_new/widgets/dropdown/country_dropdown_widget.dart';
|
|
|
|
import 'package:hmg_patient_app_new/widgets/time_picker_widget.dart';
|
|
|
|
import 'package:hmg_patient_app_new/widgets/time_picker_widget.dart';
|
|
|
|
import 'dart:ui' as ui;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TextInputWidget extends StatelessWidget {
|
|
|
|
class TextInputWidget extends StatelessWidget {
|
|
|
|
final String labelText;
|
|
|
|
final String labelText;
|
|
|
|
@ -295,59 +294,70 @@ class TextInputWidget extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
|
|
Widget _buildTextField(BuildContext context) {
|
|
|
|
Widget _buildTextField(BuildContext context) {
|
|
|
|
double fontS = fontSize ?? 14.f;
|
|
|
|
double fontS = fontSize ?? 14.f;
|
|
|
|
|
|
|
|
final isArabic = getIt.get<AppState>().isArabic();
|
|
|
|
|
|
|
|
|
|
|
|
return Builder(
|
|
|
|
return Builder(
|
|
|
|
builder: (context) {
|
|
|
|
builder: (context) {
|
|
|
|
return Localizations.override(
|
|
|
|
return Directionality(
|
|
|
|
context: context,
|
|
|
|
textDirection: isArabic ? TextDirection.rtl : TextDirection.ltr,
|
|
|
|
locale: const Locale('en', 'US'), // Force English locale for TextField
|
|
|
|
child: Localizations.override(
|
|
|
|
child: TextField(
|
|
|
|
context: context,
|
|
|
|
hintLocales: const [Locale('en', 'US')],
|
|
|
|
locale: const Locale('en', 'US'), // Force English locale for TextField
|
|
|
|
enabled: isEnable,
|
|
|
|
child: TextField(
|
|
|
|
scrollPadding: EdgeInsets.zero,
|
|
|
|
hintLocales: const [Locale('en', 'US')],
|
|
|
|
keyboardType: isMultiline ? TextInputType.multiline : (isWalletAmountInput! ? const TextInputType.numberWithOptions(decimal: true) : keyboardType),
|
|
|
|
enabled: isEnable,
|
|
|
|
controller: controller,
|
|
|
|
scrollPadding: EdgeInsets.zero,
|
|
|
|
readOnly: isReadOnly,
|
|
|
|
keyboardType: isMultiline ? TextInputType.multiline : (isWalletAmountInput! ? const TextInputType.numberWithOptions(decimal: true) : keyboardType),
|
|
|
|
textAlignVertical: TextAlignVertical.top,
|
|
|
|
controller: controller,
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
readOnly: isReadOnly,
|
|
|
|
textDirection: TextDirection.ltr,
|
|
|
|
textAlignVertical: TextAlignVertical.top,
|
|
|
|
onChanged: onChange,
|
|
|
|
textAlign: isArabic ? TextAlign.right : TextAlign.left,
|
|
|
|
focusNode: focusNode ?? _focusNode,
|
|
|
|
textDirection: TextDirection.ltr,
|
|
|
|
autofocus: autoFocus,
|
|
|
|
onChanged: onChange,
|
|
|
|
textInputAction: TextInputAction.done,
|
|
|
|
focusNode: focusNode ?? _focusNode,
|
|
|
|
cursorHeight: isWalletAmountInput! ? 40.h : 20.h,
|
|
|
|
autofocus: autoFocus,
|
|
|
|
maxLength: isWalletAmountInput! ? 7 : 100,
|
|
|
|
textInputAction: TextInputAction.done,
|
|
|
|
inputFormatters: isWalletAmountInput!
|
|
|
|
cursorHeight: isWalletAmountInput! ? 40.h : 20.h,
|
|
|
|
? [
|
|
|
|
maxLength: isWalletAmountInput! ? 7 : 100,
|
|
|
|
_ThousandSeparatorInputFormatter(),
|
|
|
|
inputFormatters: isWalletAmountInput!
|
|
|
|
]
|
|
|
|
? [
|
|
|
|
: null,
|
|
|
|
_ThousandSeparatorInputFormatter(),
|
|
|
|
onTapOutside: (event) {
|
|
|
|
]
|
|
|
|
FocusManager.instance.primaryFocus?.unfocus();
|
|
|
|
: null,
|
|
|
|
},
|
|
|
|
onTapOutside: (event) {
|
|
|
|
onSubmitted: onSubmitted,
|
|
|
|
FocusManager.instance.primaryFocus?.unfocus();
|
|
|
|
minLines: isMultiline ? minLines : 1,
|
|
|
|
},
|
|
|
|
maxLines: isMultiline ? maxLines : 1,
|
|
|
|
onSubmitted: onSubmitted,
|
|
|
|
style: TextStyle(
|
|
|
|
minLines: isMultiline ? minLines : 1,
|
|
|
|
fontSize: fontS,
|
|
|
|
maxLines: isMultiline ? maxLines : 1,
|
|
|
|
height: isMultiline ? 1.2 : (isWalletAmountInput! ? 1 / 4 : 0),
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
fontSize: fontS,
|
|
|
|
color: AppColors.textColor,
|
|
|
|
height: isMultiline ? 1.2 : (isWalletAmountInput! ? 1 / 4 : 0),
|
|
|
|
letterSpacing: -1,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
// fontFamily: keyboardType == TextInputType.number ? getIt.get<AppState>().isArabic() ? 'GESSTwo' : 'Poppins' : 'Poppins',
|
|
|
|
color: AppColors.textColor,
|
|
|
|
fontFamily: fontFamily,
|
|
|
|
letterSpacing: -1,
|
|
|
|
locale: const Locale('en', 'US'), // Force English locale for text style
|
|
|
|
fontFamily: fontFamily,
|
|
|
|
),
|
|
|
|
locale: const Locale('en', 'US'), // Force English locale for text style
|
|
|
|
decoration: InputDecoration(
|
|
|
|
),
|
|
|
|
counterText: "",
|
|
|
|
decoration: InputDecoration(
|
|
|
|
isDense: true,
|
|
|
|
counterText: "",
|
|
|
|
hintText: hintText,
|
|
|
|
isDense: true,
|
|
|
|
hintStyle: TextStyle(fontSize: 14.f, height: 21 / 16, fontWeight: FontWeight.w600, color: hintColor != null ? AppColors.textColor : Color(0xff898A8D), letterSpacing: -0.75),
|
|
|
|
hintText: hintText,
|
|
|
|
prefixIconConstraints: BoxConstraints(minWidth: 30.h),
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
prefixIcon: prefix == null ? null : "+${prefix!}".toText14(letterSpacing: -1, color: AppColors.textColor, isBold: true),
|
|
|
|
fontFamily: isArabic ? 'CairoArabic' : 'Poppins',
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
fontSize: 14.f,
|
|
|
|
border: InputBorder.none,
|
|
|
|
height: 21 / 16,
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
color: hintColor != null ? AppColors.textColor : Color(0xff898A8D),
|
|
|
|
|
|
|
|
letterSpacing: -0.75,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
prefixIconConstraints: BoxConstraints(minWidth: 30.h),
|
|
|
|
|
|
|
|
prefixIcon: prefix == null ? null : "+${prefix!}".toText14(letterSpacing: -1, color: AppColors.textColor, isBold: true),
|
|
|
|
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|