gpt4 book ai didi

dart - 需要帮助解决 Flutter pixels assertion error

转载 作者:行者123 更新时间:2023-12-05 05:14:25 25 4
gpt4 key购买 nike

我不断从流生成器 if 语句中收到此断言错误像素!=null,它不会从 if 返回任何内容,只会从 else 返回。谢谢你。很困惑

  Widget build(BuildContext context) {
print("ffff23223r");
return new StreamBuilder(
stream: FirebaseAuth.instance.currentUser().asStream(),
builder: (context, theuser) {
{
if(theuser.hasData && theuser.data.isEmailVerified){
return Container(color:Colors.red
);//always gives me error
}
else{return intro(theuser);//works fine no matter whats here }
}
});
}

错误:

Exception has occurred. 'package:flutter/src/widgets/scroll_position.dart': Failed assertion: line 661 pos 12: 'pixels != null': is not true.

static _doThrowNew(int assertionStart, int assertionEnd, Object message) native "AssertionError_throwNew";

最佳答案

我发现需要放在tabbar View 中:

 return new StreamBuilder(
stream: FirebaseAuth.instance.currentUser().asStream(),
builder: (context, theuser) {
{
return Scaffold(
body: new TabBarView(controller: controller, children: <Widget>[
theuser.hasData && theuser.data.isEmailVerified
? main2MapPage(theuser)
: new intro(theuser),
]),
backgroundColor: Colors.redAccent,
);
}
});

关于dart - 需要帮助解决 Flutter pixels assertion error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52484591/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com