Flutter TextFormField无法输入 软键盘弹出即消失问题求助
Flutter项目TextFormField软键盘弹出即消失、无法输入问题
问题现象
- 未对业务代码做任何修改的前提下,项目中InputField输入框无法输入任何内容
- 点击输入框时软键盘弹出后会立刻消失
- 已尝试各类常规排查方案,哪怕是结构最简的输入框依然无法正常工作
- 待确认点:是否需要在Android端做额外配置,问题是否由框架/SDK版本更新导致
对应STORequestScreen页面实现代码
class STORequestScreen extends StatefulWidget { final List<String> locationData; final List<String> structureCodes; STORequestScreen( {Key? key, required this.locationData, required this.structureCodes}) : super(key: key); @override _STORequestScreenState createState() => _STORequestScreenState(); } class _STORequestScreenState extends State<STORequestScreen> { List<String> locations = []; List<String> structureCodes = []; @override void initState() { super.initState(); locations = widget.locationData; structureCodes = widget.structureCodes; EasyLoading.dismiss(); } @override Widget build(BuildContext context) { return Container( child: ListView(shrinkWrap: true, children: [ CustomAppBar(), const SizedBox( height: 10, ), const Align( alignment: Alignment.center, child: Text("STO Request", style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500)), ), const SizedBox( height: 10, ), const Padding( padding: EdgeInsets.only(left: 10, bottom: 20), child: Align( alignment: Alignment.centerLeft, child: Text("Details", style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), ), ), TextFormField( decoration: InputDecoration(labelText: 'Location'), ) ])); } }
点击TextFormField时抓取的控制台运行日志
I/ViewRootImpl@219eef1[MainActivity](15081): ViewPostIme pointer 0 I/ViewRootImpl@219eef1[MainActivity](15081): ViewPostIme pointer 1 D/InputMethodManager(15081): prepareNavigationBarInfo() DecorView@c70c075[MainActivity] D/InputMethodManager(15081): getNavigationBarColor() -855310 V/InputMethodManager(15081): Starting input: tba=com.example.mgc ic=io.flutter.plugin.editing.InputConnectionAdaptor@d1857f4 mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager(15081): startInputInner - Id : 0 I/InputMethodManager(15081): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport(15081): Input channel constructed: 'ClientS', fd=105 D/InputTransport(15081): Input channel destroyed: 'ClientS', fd=108 D/InputMethodManager(15081): SSI - flag : 0 Pid : 15081 view : com.example.mgc D/InputMethodManager(15081): view is not EditText D/InputMethodManager(15081): prepareNavigationBarInfo() DecorView@c70c075[MainActivity] D/InputMethodManager(15081): getNavigationBarColor() -855310 D/InputConnectionAdaptor(15081): The input method toggled cursor monitoring on D/InputMethodManager(15081): HSIFW - flag : 0 D/InsetsSourceConsumer(15081): setRequestedVisible: visible=true, type=13, host=com.example.mgc/com.example.mgc.MainActivity, from=android.view.InsetsSourceConsumer.show:226 android.view.InsetsController.showDirectly:1451 android.view.InsetsController.controlAnimationUnchecked:1118 android.view.InsetsController.applyAnimation:1431 android.view.InsetsController.show:970 android.view.ViewRootImpl$ViewRootHandler.handleMessage:6253 android.os.Handler.dispatchMessage:106 android.os.Looper.loop:247 android.app.ActivityThread.main:8676 java.lang.reflect.Method.invoke:-2 D/InsetsAnimationCtrlImpl(15081): cancel: control=android.view.InsetsAnimationControlImpl@828f192, types=8, mFinished=false D/InsetsAnimationCtrlImpl(15081): finish: control=android.view.InsetsAnimationControlImpl@828f192, types=8, mCancelled=true, mCancelRequested=false D/InsetsSourceConsumer(15081): setRequestedVisible: visible=false, type=13, host=com.example.mgc/com.example.mgc.MainActivity, from=android.view.InsetsSourceConsumer.hide:233 android.view.ImeInsetsSourceConsumer.hide:101 android.view.InsetsController.hideDirectly:1444 android.view.InsetsController.controlAnimationUnchecked:1120 android.view.InsetsController.applyAnimation:1431 android.view.InsetsController.hide:992 android.view.ViewRootImpl$ViewRootHandler.handleMessage:6257 android.os.Handler.dispatchMessage:106 android.os.Looper.loop:247 android.app.ActivityThread.main:8676 java.lang.reflect.Method.invoke:-2 I/SurfaceControl(15081): nativeRelease nativeObject s[503336847008] I/SurfaceControl(15081): nativeRelease nativeObject e[503336847008] D/InputConnectionAdaptor(15081): The input method toggled cursor monitoring off D/InsetsAnimationCtrlImpl(15081): finish: control=android.view.InsetsAnimationControlImpl@66094de, types=8, mCancelled=false, mCancelRequested=false I/SurfaceControl(15081): nativeRelease nativeObject s[503336844224] I/SurfaceControl(15081): nativeRelease nativeObject e[503336844224]
内容的提问来源于stack exchange,提问作者Kumu
相关产品推荐
相关产品推荐

