我的应用程序中有一个 TextFieldController,但是每次我使用键盘在其中输入任何内容时,整个应用程序都会重新加载并显示错误,
Error: setState() called after dispose(): _SlidingPanelState#65b14(lifecycle state: defunct, not mounted)
Run Code Online (Sandbox Code Playgroud)
该错误似乎与SlidingPanel相关,但我不确定它为什么会干扰 TextFieldController。
SliverToBoxAdapter(
child: Container(
height: 100,
padding: const EdgeInsets.all(20.0),
child: TextField(
decoration: InputDecoration(
border: InputBorder.none,
labelText: 'Enter Name',
hintText: 'Enter Your Name'),
),
),
),
Run Code Online (Sandbox Code Playgroud)
在你的 _SlidingPanelState 中找到
setState(() {);
Run Code Online (Sandbox Code Playgroud)
并改变它
if (mounted) {
setState(() {);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
63 次 |
| 最近记录: |