From c286635d85a99f22faa6726ecff6f935c8dfc43f Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Mon, 9 Jun 2025 14:11:31 +0200 Subject: [PATCH] name hin text take null, ifg null then dont display hint --- .../mih_text_form_field.dart | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/Frontend/lib/mih_components/mih_package_components/mih_text_form_field.dart b/Frontend/lib/mih_components/mih_package_components/mih_text_form_field.dart index 082f4ee0..438f45d6 100644 --- a/Frontend/lib/mih_components/mih_package_components/mih_text_form_field.dart +++ b/Frontend/lib/mih_components/mih_package_components/mih_text_form_field.dart @@ -9,7 +9,7 @@ class MihTextFormField extends StatefulWidget { final Color inputColor; final TextEditingController controller; final bool? hasError; - final String hintText; + final String? hintText; final double? borderRadius; final bool? multiLineInput; final bool? readOnly; @@ -98,31 +98,34 @@ class _MihTextFormFieldState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - widget.hintText, - textAlign: TextAlign.left, - style: TextStyle( - color: widget.fillColor, - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - Visibility( - visible: !widget.requiredText, - child: Text( - "(Optional)", - textAlign: TextAlign.right, + Visibility( + visible: widget.hintText != null, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + widget.hintText ?? "", + textAlign: TextAlign.left, style: TextStyle( color: widget.fillColor, fontSize: 15, fontWeight: FontWeight.bold, ), ), - ), - ], + Visibility( + visible: !widget.requiredText, + child: Text( + "(Optional)", + textAlign: TextAlign.right, + style: TextStyle( + color: widget.fillColor, + fontSize: 15, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), ), const SizedBox(height: 4), FormField(