|
|
|
|
@ -25,6 +25,7 @@ class AppTextFormField extends StatefulWidget {
|
|
|
|
|
final TextStyle? style;
|
|
|
|
|
final TextStyle? labelStyle;
|
|
|
|
|
final TextStyle? hintStyle;
|
|
|
|
|
final TextStyle? floatingLabelStyle;
|
|
|
|
|
final bool enable;
|
|
|
|
|
final TextAlign? textAlign;
|
|
|
|
|
final FocusNode? node;
|
|
|
|
|
@ -58,6 +59,7 @@ class AppTextFormField extends StatefulWidget {
|
|
|
|
|
this.hintText,
|
|
|
|
|
this.labelText,
|
|
|
|
|
this.hintStyle,
|
|
|
|
|
this.floatingLabelStyle,
|
|
|
|
|
this.textInputType = TextInputType.text,
|
|
|
|
|
this.initialValue, // Provide default value
|
|
|
|
|
this.enable = true,
|
|
|
|
|
@ -183,12 +185,16 @@ class _AppTextFormFieldState extends State<AppTextFormField> {
|
|
|
|
|
onChanged: widget.onChange,
|
|
|
|
|
obscureText: widget.obscureText ?? false,
|
|
|
|
|
keyboardType: widget.textInputType,
|
|
|
|
|
maxLines: widget.makeMultiLinesNull ? null:widget.textInputType == TextInputType.multiline ? 4 : 1,
|
|
|
|
|
maxLines: widget.makeMultiLinesNull
|
|
|
|
|
? null
|
|
|
|
|
: widget.textInputType == TextInputType.multiline
|
|
|
|
|
? 4
|
|
|
|
|
: 1,
|
|
|
|
|
obscuringCharacter: "*",
|
|
|
|
|
controller: widget.controller,
|
|
|
|
|
textInputAction: widget.textInputType == TextInputType.multiline ? null : widget.textInputAction ?? TextInputAction.next,
|
|
|
|
|
onEditingComplete: widget.onAction ?? () => FocusScope.of(context).nextFocus(),
|
|
|
|
|
style: widget.style ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500,color:context.isDark?AppColor.white10: AppColor.black10),
|
|
|
|
|
style: widget.style ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.black10),
|
|
|
|
|
onTap: widget.onTap,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
alignLabelWithHint: widget.alignLabelWithHint,
|
|
|
|
|
@ -208,9 +214,12 @@ class _AppTextFormFieldState extends State<AppTextFormField> {
|
|
|
|
|
? (widget.enableColor ?? AppColor.neutral40)
|
|
|
|
|
: AppColor.background(context)),
|
|
|
|
|
errorStyle: AppTextStyle.tiny.copyWith(color: context.isDark ? AppColor.red50 : AppColor.red60),
|
|
|
|
|
floatingLabelStyle: AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.neutral20),
|
|
|
|
|
floatingLabelStyle: widget.floatingLabelStyle ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.neutral20),
|
|
|
|
|
hintText: widget.hintText ?? "",
|
|
|
|
|
labelText: (widget.showSpeechToText && _speechToText.isListening) ? "Listening..." : widget.labelText ?? "",
|
|
|
|
|
// labelText: (widget.showSpeechToText && _speechToText.isListening) ? "Listening..." : widget.labelText ?? "",
|
|
|
|
|
label: Text(
|
|
|
|
|
(widget.showSpeechToText && _speechToText.isListening) ? "Listening..." : widget.labelText ?? "",
|
|
|
|
|
),
|
|
|
|
|
labelStyle: widget.labelStyle,
|
|
|
|
|
hintStyle: widget.labelStyle,
|
|
|
|
|
prefixIcon: widget.prefixIcon ??
|
|
|
|
|
|