颤动时切换振荡

switch oscillation on flutter

这是我的第一个问题,我是新手。我在打开 flutter 时遇到问题。

我像示例一样做了这个简单的代码,但是在某个时刻,当我快速切换时,开关开始振荡。我该如何解决这个问题?谢谢

bool _switchValue = false;

@override
Widget build(BuildContext context) {

return new Scaffold(
  body: new Container(
    padding: new EdgeInsets.all(32.0),
    child: new Column(
      children: <Widget>[
         new Switch(
          value: _switchValue,
          onChanged: (bool value) { setState(() {
            _switchValue = value;
              }
            );
          },
        )
      ],
     )
   )
 );
}

这是一个已知错误,已通过更新修复。

错误在这里讨论:https://github.com/flutter/flutter/issues/17773

如果您想通过编辑 packages/flutter/lib/src/material/toggleable.dart 文件自行修复它,请在此处提交修复:https://github.com/flutter/flutter/pull/17821