Open burekas7 opened 2 years ago
EDIT: I got confused with AutoSizeTextField package, and it looks like it's a simulator issue... not sure yet.
I'm experimenting the contrary. That is, when a widget is build and you don't rebuild, the autosize works OK.
But if you setState()
and rebuild the widget, autosize won't work.
For example:
@override
Widget build(BuildContext context) {
// ...
final controller = MoneyMaskedTextController(initialValue: someValue);
// ...
return Scaffold(
// ...
child: AutoSizeTextField(
onChanged: (_) => _handleChange(controller.numberValue),
autofocus: true,
style: const TextStyle(fontSize: 48, color: Colors.white),
textAlign: TextAlign.center,
controller: controller,
keyboardType: TextInputType.number,
decoration: const InputDecoration.collapsed(hintText: '0.0'),
),
// ...
);
_handleChange(controller) {
setState(() { // this rebuild will make the autosize to stop working ....})
}
@burekas7 can this be closed?
Steps to Reproduce Hi, I'm using AutoSizeText on web. After build (Refresh page, hot reload, restart etc...) AutoSizeText doesn't resize the text according to the sizes. It does work after doing 'setState' operation.
What coukd be the reason?
Thanks.
Version