To use TextField in Row, wrap it with Expanded, as follows:
Row( children: [ Text("+86",style: TextStyle(fontSize: MediaQueryUtil.px2f(34),color: ColorUtils.font24,decoration: TextDecoration.none)), VerticalDivider( thickness: 2, color: ColorUtils.font24, indent: MediaQueryUtil.px2f(25), endIndent: MediaQueryUtil.px2f(25), ), Expanded( child:TextField( controller: textController, InputFormatters: [WhitelistingTextInputFormatter digitsOnly, LengthLimitingTextInputFormatter (11)], / / only allow input digital decoration: InputDecoration(border: InputBorder. None, hintText: "Please enter the mobile phone number"),),)],)Copy the code
TextField limits character input
WhitelistingTextInputFormatter. DigitsOnly limit input digital LengthLimitingTextInputFormatter maximum length (11) Using maxLength directly generates the maximum number occupancy control size in the lower right corner
TextField( controller: textController, inputFormatters:[WhitelistingTextInputFormatter.digitsOnly,LengthLimitingTextInputFormatter(11)], HintText: "please enter the mobile phone number"),)Copy the code
. Record future updates