使用我定义如下的类确保VisibleWhenFocused时出现此错误。我已经导入了正确的文件,标题中指出了我得到的错误!
错误位于viewport.getOffsetToReveal(object, 0.0)和viewport.getOffsetToReveal(object, 1.0)。我试图找到解决方案,但在任何地方都找不到。
class EnsureVisibleWhenFocused extends StatefulWidget {
const EnsureVisibleWhenFocused({
Key key,
@required this.child,
@required this.focusNode,
this.curve: Curves.ease,
this.duration: const Duration(milliseconds: 100),
}) : super(key: key);
/// The node we will monitor to determine if the child is focused
final FocusNode focusNode;
/// The child widget that we are wrapping
final Widget child;
/// The curve we will use to scroll ourselves into view.
///
/// Defaults to Curves.ease.
final Curve curve;
/// The duration …Run Code Online (Sandbox Code Playgroud)