I'm using TextFormField in flutter app. In my app everywhere It's working fine, But just in one screen it giving me an error. When I click on TextFormField then Keyboard opened and instantly hide automatically. Here is my code for TextFormField.
TextFormField(
controller: offerController,
maxLines: 1,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
style: GoogleFonts.arimo(
textStyle: const TextStyle(
color: Color(ColorConstants.TEXT_COLOR_GREY),
fontSize: 14.0,
fontWeight: FontWeight.w400,
),
),
decoration: InputDecoration(
border: InputBorder.none,
enabledBorder: InputBorder.none,
hintText: "Add the Offer Value",
hintStyle: GoogleFonts.arimo(
textStyle: const TextStyle(
color:
Color(ColorConstants.COLOR_BFBFBF),
fontSize: 14.0,
fontWeight: FontWeight.w400,
),
),
),
)
Add this to your textFormField.
keyboardType: TextInputType.numberWithOptions(signed: true),
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
],
onTap(){
FocusNode.requestFocus();
}
In this case, if you use the ios emulator, you can see the this link Flutter - Keyboard not showing when TextFormField is selected
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.