material-components / material-components-flutter-codelabs

Codelabs for Material Components for Flutter
212 stars 244 forks source link

Can not assign TextEditingController to TextField #259

Closed vonthomasyang closed 2 years ago

vonthomasyang commented 2 years ago

In step add TextEditingController to TextField controller: _usernameController got a error as "invalid constant value" as below. image

What we should do for this?

guidezpl commented 2 years ago

Sorry for the late reply, the issue here is that your TextField is marked const, implying everything below it in the widget tree must also be const.