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