@ -369,7 +369,7 @@ Widget inputWidget(
Expanded (
child: Column (
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: isRtl ? CrossAxisAlignment . end : CrossAxisAlignment. start ,
crossAxisAlignment: CrossAxisAlignment. start ,
children: [
Directionality (
textDirection: Directionality . of ( context ) ,
@ -596,222 +596,219 @@ Widget newInputWidget(
} ) {
return Builder (
builder: ( context ) {
final isRtl = Directionality . of ( context ) = = TextDirection . rtl ;
return Directionality (
textDirection: Directionality . of ( context ) ,
child: Container (
padding: padding ,
/ / padding: removePadding & & isAllowLeadingIcon & & prefix = = null
/ / ? const EdgeInsets . only ( top: 8 , bottom: 8 , left: 8 , right: 8 )
/ / : removePadding & & ! hasSelection
/ / ? const EdgeInsets . only ( top: 8 , bottom: 8 , left: 0 , right: 0 )
/ / : removePadding & & hasSelection
/ / ? null
/ / : const EdgeInsets . symmetric ( horizontal: 16 , vertical: 15 ) ,
alignment: Alignment . center ,
decoration: BoxDecoration (
borderRadius: isAllowRadius ? BorderRadius . circular ( 15 ) : null ,
color: Colors . white ,
border: isBorderAllowed ? Border . all ( color: const Color ( 0xffefefef ) , width: 1 ) : null ,
) ,
child: Row (
textDirection: Directionality . of ( context ) ,
children: [
if ( isAllowLeadingIcon & & leadingIcon ! = null )
isCountryDropDown
? _CustomCountryDropdown (
logo: SvgPicture . asset (
prefix = = " 966 " ? " assets/images/svg/ksa.svg " : " assets/images/svg/uae.svg " ,
width: 40 ,
height: 40 ,
fit: BoxFit . cover ,
) ,
countryList: countryList ,
onCountryChange: onCountryChange ,
isRtl: isRtl ,
)
: Container (
height: 40 ,
/ / final isRtl = Directionality . of ( context ) = = TextDirection . ltr ;
return Container (
padding: padding ,
/ / padding: removePadding & & isAllowLeadingIcon & & prefix = = null
/ / ? const EdgeInsets . only ( top: 8 , bottom: 8 , left: 8 , right: 8 )
/ / : removePadding & & ! hasSelection
/ / ? const EdgeInsets . only ( top: 8 , bottom: 8 , left: 0 , right: 0 )
/ / : removePadding & & hasSelection
/ / ? null
/ / : const EdgeInsets . symmetric ( horizontal: 16 , vertical: 15 ) ,
alignment: Alignment . center ,
decoration: BoxDecoration (
borderRadius: isAllowRadius ? BorderRadius . circular ( 15 ) : null ,
color: Colors . white ,
border: isBorderAllowed ? Border . all ( color: const Color ( 0xffefefef ) , width: 1 ) : null ,
) ,
child: Row (
textDirection: Directionality . of ( context ) ,
children: [
if ( isAllowLeadingIcon & & leadingIcon ! = null )
isCountryDropDown
? _CustomCountryDropdown (
logo: SvgPicture . asset (
prefix = = " 966 " ? " assets/images/svg/ksa.svg " : " assets/images/svg/uae.svg " ,
width: 40 ,
margin: isRtl ? const EdgeInsets . only ( left: 10 ) : const EdgeInsets . only ( right: 10 ) ,
padding: isLeadingCountry ? null : const EdgeInsets . all ( 8 ) ,
decoration: const BoxDecoration (
color: Color ( 0xFFEFEFF0 ) ,
borderRadius: BorderRadius . all ( Radius . circular ( 10 ) ) ,
) ,
child: SvgPicture . asset (
leadingIcon ,
width: 24 ,
height: 24 ,
fit: BoxFit . cover ,
) ,
height: 40 ,
fit: BoxFit . cover ,
) ,
Expanded (
child: Column (
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text (
_labelText ,
style: context . dynamicTextStyle (
fontSize: 12 ,
fontWeight: FontWeight . w500 ,
color: const Color ( 0xff898A8D ) ,
letterSpacing: - 0.2 ,
height: 18 / 12 ,
countryList: countryList ,
onCountryChange: onCountryChange ,
isRtl: Directionality . of ( context ) = = TextDirection . rtl ,
)
: Container (
height: 40 ,
width: 40 ,
margin: const EdgeInsets . only ( right: 10 ) ,
padding: isLeadingCountry ? null : const EdgeInsets . all ( 8 ) ,
decoration: const BoxDecoration (
color: Color ( 0xFFEFEFF0 ) ,
borderRadius: BorderRadius . all ( Radius . circular ( 10 ) ) ,
) ,
child: SvgPicture . asset (
leadingIcon ,
width: 24 ,
height: 24 ,
fit: BoxFit . cover ,
) ,
) ,
hasSelection
? GestureDetector (
onTap: isEnable & & ! isReadOnly
? ( ) async {
if ( selectionType = = SelectionType . dropdown ) {
final renderBox = context . findRenderObject ( ) as RenderBox ;
final offset = renderBox . localToGlobal ( Offset . zero ) ;
final selected = await showMenu < String > (
context: context ,
position: RelativeRect . fromLTRB (
offset . dx ,
offset . dy + renderBox . size . height ,
offset . dx + renderBox . size . width ,
0 ,
) ,
items: dropdownItems
? . map (
( e ) = > PopupMenuItem < String > (
value: e ,
child: Text ( e ) ,
) ,
)
. toList ( ) ? ?
[ ] ,
shape: RoundedRectangleBorder (
borderRadius: BorderRadius . circular ( 12 ) ,
) ,
) ;
Expanded (
child: Column (
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text (
_labelText ,
style: context . dynamicTextStyle (
fontSize: 12 ,
fontWeight: FontWeight . w500 ,
color: const Color ( 0xff898A8D ) ,
letterSpacing: - 0.2 ,
height: 18 / 12 ,
) ,
) ,
hasSelection
? GestureDetector (
onTap: isEnable & & ! isReadOnly
? ( ) async {
if ( selectionType = = SelectionType . dropdown ) {
final renderBox = context . findRenderObject ( ) as RenderBox ;
final offset = renderBox . localToGlobal ( Offset . zero ) ;
final selected = await showMenu < String > (
context: context ,
position: RelativeRect . fromLTRB (
offset . dx ,
offset . dy + renderBox . size . height ,
offset . dx + renderBox . size . width ,
0 ,
) ,
items: dropdownItems
? . map (
( e ) = > PopupMenuItem < String > (
value: e ,
child: Text ( e ) ,
) ,
)
. toList ( ) ? ?
[ ] ,
shape: RoundedRectangleBorder (
borderRadius: BorderRadius . circular ( 12 ) ,
) ,
) ;
if ( selected ! = null & & onChange ! = null ) {
onChange ( selected ) ;
}
} else if ( selectionType = = SelectionType . calendar ) {
bool isGregorian = true ;
/ / final picked = await showDatePicker ( context: context , initialDate: DateTime . now ( ) , firstDate: DateTime ( 1900 ) , lastDate: DateTime ( 2100 ) ) ;
final picked = await showHijriGregBottomSheet (
context ,
switcherIcon: SvgPicture . asset ( " assets/images/svg/language.svg " , width: 24 ) ,
/ / fontFamily: FontUtils . getFontFamily ( context ) ,
language: lang ,
initialDate: DateTime . now ( ) ,
okWidget: Padding (
padding: const EdgeInsets . only ( right: 8.0 ) ,
child: SvgPicture . asset (
" assets/images/svg/confirm.svg " ,
width: 24 ,
height: 24 ,
) ,
if ( selected ! = null & & onChange ! = null ) {
onChange ( selected ) ;
}
} else if ( selectionType = = SelectionType . calendar ) {
bool isGregorian = true ;
/ / final picked = await showDatePicker ( context: context , initialDate: DateTime . now ( ) , firstDate: DateTime ( 1900 ) , lastDate: DateTime ( 2100 ) ) ;
final picked = await showHijriGregBottomSheet (
context ,
switcherIcon: SvgPicture . asset ( " assets/images/svg/language.svg " , width: 24 ) ,
/ / fontFamily: FontUtils . getFontFamily ( context ) ,
language: lang ,
initialDate: DateTime . now ( ) ,
okWidget: Padding (
padding: const EdgeInsets . only ( right: 8.0 ) ,
child: SvgPicture . asset (
" assets/images/svg/confirm.svg " ,
width: 24 ,
height: 24 ,
) ,
cancelWidget: Padding (
padding: const EdgeInsets . only ( right: 8.0 ) ,
child: SvgPicture . asset (
" assets/images/svg/cancel.svg " ,
colorFilter: ColorFilter . mode (
Colors . white ,
BlendMode . srcIn ,
) ,
width: 24 ,
height: 24 ,
) ,
cancelWidget: Padding (
padding: const EdgeInsets . only ( right: 8.0 ) ,
child: SvgPicture . asset (
" assets/images/svg/cancel.svg " ,
colorFilter: ColorFilter . mode (
Colors . white ,
BlendMode . srcIn ,
) ,
width: 24 ,
height: 24 ,
) ,
onCalendarTypeChanged: ( bool value ) {
isGregorian = value ;
} ,
) ;
if ( picked ! = null & & onChange ! = null ) {
print ( picked . toIso8601String ( ) ) ;
if ( onCalendarTypeChanged ! = null ) {
print ( isGregorian . toString ( ) ) ;
onCalendarTypeChanged . call ( isGregorian ) ;
}
onChange ( picked . toIso8601String ( ) ) ;
) ,
onCalendarTypeChanged: ( bool value ) {
isGregorian = value ;
} ,
) ;
if ( picked ! = null & & onChange ! = null ) {
print ( picked . toIso8601String ( ) ) ;
if ( onCalendarTypeChanged ! = null ) {
print ( isGregorian . toString ( ) ) ;
onCalendarTypeChanged . call ( isGregorian ) ;
}
onChange ( picked . toIso8601String ( ) ) ;
}
}
: null ,
child: Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
Expanded (
child: Text ( ( selectedValue = = null | | selectedValue . isEmpty ) ? _hintText : selectedValue ,
textAlign: isRtl ? TextAlign . right : TextAlign . left ,
textDirection: isRtl ? TextDirection . rtl : TextDirection . ltr ,
style: context . dynamicTextStyle (
fontSize: 14 ,
height: 21 / 14 ,
fontWeight: FontWeight . w500 ,
color: ( selectedValue ! = null & & selectedValue . isNotEmpty ) ? const Color ( 0xff2E3039 ) : const Color ( 0xffB0B0B0 ) ,
letterSpacing: - 0.2 ,
) ) ,
) ,
if ( hasSelectionCustomIcon & & selectionCustomIcon ! = null )
SvgPicture . asset ( selectionCustomIcon , width: 24 , height: 24 )
else
const Icon ( Icons . keyboard_arrow_down_outlined ) ,
] ,
) ,
)
: TextField (
enabled: isEnable ,
scrollPadding: EdgeInsets . zero ,
keyboardType: keyboardType ,
controller: _controller ,
readOnly: isReadOnly ,
textAlignVertical: TextAlignVertical . top ,
textAlign: isRtl ? TextAlign . right : TextAlign . left ,
textDirection: isRtl ? TextDirection . rtl : TextDirection . ltr ,
onChanged: onChange ,
focusNode: focusNode ,
autofocus: autoFocus ,
style: context . dynamicTextStyle (
}
: null ,
child: Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
Expanded (
child: Text ( ( selectedValue = = null | | selectedValue . isEmpty ) ? _hintText : selectedValue ,
textAlign: TextAlign . left ,
textDirection: TextDirection . ltr ,
style: context . dynamicTextStyle (
fontSize: 14 ,
height: 21 / 14 ,
fontWeight: FontWeight . w500 ,
color: ( selectedValue ! = null & & selectedValue . isNotEmpty ) ? const Color ( 0xff2E3039 ) : const Color ( 0xffB0B0B0 ) ,
letterSpacing: - 0.2 ,
) ) ,
) ,
if ( hasSelectionCustomIcon & & selectionCustomIcon ! = null )
SvgPicture . asset ( selectionCustomIcon , width: 24 , height: 24 )
else
const Icon ( Icons . keyboard_arrow_down_outlined ) ,
] ,
) ,
)
: TextField (
enabled: isEnable ,
scrollPadding: EdgeInsets . zero ,
keyboardType: keyboardType ,
controller: _controller ,
readOnly: isReadOnly ,
textAlignVertical: TextAlignVertical . top ,
textAlign: TextAlign . left ,
textDirection: TextDirection . ltr ,
onChanged: onChange ,
focusNode: focusNode ,
autofocus: autoFocus ,
style: context . dynamicTextStyle (
fontSize: 14 ,
height: 21 / 14 ,
fontWeight: FontWeight . w500 ,
color: const Color ( 0xff2E3039 ) ,
letterSpacing: - 0.2 ,
) ,
decoration: InputDecoration (
isDense: true ,
hintText: _hintText ,
hintStyle: context . dynamicTextStyle (
fontSize: 14 ,
height: 21 / 14 ,
height: 21 / 1 6 ,
fontWeight: FontWeight . w500 ,
color: const Color ( 0xff2E3039 ) ,
color: const Color ( 0xff 898A8D ) ,
letterSpacing: - 0.2 ,
) ,
decoration: InputDecoration (
isDense: true ,
hintText: _hintText ,
hintStyle: context . dynamicTextStyle (
fontSize: 14 ,
height: 21 / 16 ,
fontWeight: FontWeight . w500 ,
color: const Color ( 0xff898A8D ) ,
letterSpacing: - 0.2 ,
) ,
prefixIconConstraints: const BoxConstraints ( minWidth: 45 ) ,
prefixIcon: prefix = = null
? null
: Text (
" + " + prefix ,
style: context . dynamicTextStyle (
fontSize: 14 ,
height: 21 / 14 ,
fontWeight: FontWeight . w500 ,
color: const Color ( 0xff2E303A ) ,
letterSpacing: - 0.2 ,
) ,
prefixIconConstraints: const BoxConstraints ( minWidth: 45 ) ,
prefixIcon: prefix = = null
? null
: Text (
" + " + prefix ,
style: context . dynamicTextStyle (
fontSize: 14 ,
height: 21 / 14 ,
fontWeight: FontWeight . w500 ,
color: const Color ( 0xff2E303A ) ,
letterSpacing: - 0.2 ,
) ,
contentPadding: EdgeInsets . zero ,
border: InputBorder . none ,
focusedB order: InputBorder . none ,
enabl edBorder: InputBorder . none ,
) ,
) ,
contentPadding: EdgeInsets . zero ,
border: InputBorder . none ,
focusedBorder: InputBorder . none ,
enabledBorder: InputBorder . none ,
) ,
] ,
) ,
) ,
] ,
) ,
] ,
) ,
) ,
] ,
) ,
) ;
} ,