Skip to content

Commit 66afa68

Browse files
committed
Added endingWidget in TextInput widget
1 parent efc9463 commit 66afa68

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

modules/ensemble/lib/widget/input/form_textfield.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ abstract class BaseTextInput extends StatefulWidget
147147
_controller.enableClearText = Utils.optionalBool(value),
148148
'dismissibleKeyboard': (value) =>
149149
_controller.dismissibleKeyboard = Utils.getBool(value, fallback: _controller.dismissibleKeyboard),
150+
'endingWidget': (widget) =>
151+
_controller.endingWidget = widget,
150152
'obscureToggle': (value) =>
151153
_controller.obscureToggle = Utils.optionalBool(value),
152154
'obscured': (widget) => _controller.obscureText == true,
@@ -228,6 +230,9 @@ class TextInputController extends FormFieldController with HasTextPlaceholder {
228230
bool? enableClearText;
229231
bool dismissibleKeyboard = true;
230232

233+
// Ending widget for the input field
234+
dynamic endingWidget;
235+
231236
// applicable only for TextInput
232237
bool? obscureText;
233238

@@ -473,6 +478,12 @@ class TextInputState extends FormFieldWidgetState<BaseTextInput>
473478
);
474479
}
475480

481+
if(widget.controller.endingWidget != null) {
482+
decoration = decoration.copyWith(
483+
suffixIcon: scopeManager!.buildWidgetFromDefinition(widget.controller.endingWidget),
484+
);
485+
}
486+
476487
return InputWrapper(
477488
type: TextInput.type,
478489
controller: widget._controller,

0 commit comments

Comments
 (0)