|
|
|
|
@ -1,5 +1,8 @@
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
|
|
|
|
|
|
|
|
|
class DynamicTextFieldWidget extends StatelessWidget {
|
|
|
|
|
final String labelText;
|
|
|
|
|
@ -17,11 +20,14 @@ class DynamicTextFieldWidget extends StatelessWidget {
|
|
|
|
|
final bool isInputTypeNumSigned;
|
|
|
|
|
final bool isObscureText;
|
|
|
|
|
final bool isBackgroundEnable;
|
|
|
|
|
final int? length;
|
|
|
|
|
final String? toolTip;
|
|
|
|
|
final void Function(String)? onChange;
|
|
|
|
|
|
|
|
|
|
DynamicTextFieldWidget(this.labelText, this.hintText, //this.controller,
|
|
|
|
|
{this.isObscureText = false,
|
|
|
|
|
this.onTap,
|
|
|
|
|
this.onToolTipTap,
|
|
|
|
|
this.suffixIconData,
|
|
|
|
|
this.isEnable = true,
|
|
|
|
|
this.isReadOnly = false,
|
|
|
|
|
@ -31,6 +37,8 @@ class DynamicTextFieldWidget extends StatelessWidget {
|
|
|
|
|
this.onChange,
|
|
|
|
|
this.isInputTypeNum = false,
|
|
|
|
|
this.isInputTypeNumSigned = true,
|
|
|
|
|
this.length,
|
|
|
|
|
this.toolTip = "",
|
|
|
|
|
this.isBackgroundEnable = false});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -68,13 +76,18 @@ class DynamicTextFieldWidget extends StatelessWidget {
|
|
|
|
|
enabled: isEnable,
|
|
|
|
|
scrollPadding: EdgeInsets.zero,
|
|
|
|
|
readOnly: isReadOnly,
|
|
|
|
|
keyboardType: (isInputTypeNum) ? (isInputTypeNumSigned ? const TextInputType.numberWithOptions(signed: true, decimal: true) : TextInputType.numberWithOptions(signed: true, decimal: true)) : TextInputType.text,
|
|
|
|
|
keyboardType: (isInputTypeNum)
|
|
|
|
|
? (isInputTypeNumSigned ? const TextInputType.numberWithOptions(signed: true, decimal: true) : TextInputType.numberWithOptions(signed: true, decimal: true))
|
|
|
|
|
: TextInputType.text,
|
|
|
|
|
textInputAction: TextInputAction.done,
|
|
|
|
|
//controller: controller,
|
|
|
|
|
maxLines: lines,
|
|
|
|
|
obscuringCharacter: "*",
|
|
|
|
|
obscureText: isObscureText,
|
|
|
|
|
onChanged: onChange,
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
LengthLimitingTextInputFormatter(length),
|
|
|
|
|
],
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
@ -107,6 +120,10 @@ class DynamicTextFieldWidget extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
if (isPopup) const Icon(Icons.keyboard_arrow_down_outlined, color: MyColors.darkIconColor),
|
|
|
|
|
if (onTap != null) Icon(suffixIconData ?? Icons.keyboard_arrow_down_outlined, color: MyColors.darkIconColor),
|
|
|
|
|
if (toolTip!.isNotEmpty)
|
|
|
|
|
Icon(Icons.help_outline_rounded, color: MyColors.darkIconColor).onPress(() {
|
|
|
|
|
Utils.showToast(toolTip!);
|
|
|
|
|
}).paddingOnly(left: 6),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|