auto_size_text_field
auto_size_text_field copied to clipboard
Allow decoration: null
I started converting some of our TextField() widgets into AutoSizeTextField() widgets. In our TextField() widgets, we allowed for a null decoration like this:
Flexible(
child: TextField(
controller: _dateOrTaskNameController,
decoration: null,
),
),
Simple conversion to AutoSizeTextField() looks like this:
Flexible(
child: AutoSizeTextField(
controller: _dateOrTaskNameController,
decoration: null,
),
),
The exception is below:
I/flutter ( 6673): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ I/flutter ( 6673): The following NoSuchMethodError was thrown building LayoutBuilder: I/flutter ( 6673): The getter 'prefixText' was called on null. I/flutter ( 6673): Receiver: null I/flutter ( 6673): Tried calling: prefixText I/flutter ( 6673): I/flutter ( 6673): The relevant error-causing widget was: I/flutter ( 6673): AutoSizeTextField lib\dependency\dependency_form.dart I/flutter ( 6673): I/flutter ( 6673): When the exception was thrown, this was the stack: I/flutter ( 6673): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5) I/flutter ( 6673): #1 _AutoSizeTextFieldState._checkTextFits package:auto_size_text_field/src/auto_size_text_field.dart:752
Could we get the AutoSizeTextField widget to have the same decoration handling as the TextField widget?
Thanks @LizDW I will need to dig more into the issue. Keep you posted. It will be good if you can help dig into the source code and take look as well.
Working in progress.