大佬教程收集整理的这篇文章主要介绍了你好,我在运行后收到此错误,但在颤振中对此有任何解决方案,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的代码:
小部件构建(BuildContext 上下文){
var s=CubicCounter.get(context);
返回
区块提供者(
创建:(BuildContext 上下文)=> CubicCounter(),
孩子:BlocConsumer
floaTingActionbutton:
floaTingActionbutton(onpressed: () {
if (s.open) {
s.setopen(false);
s.bottomSheet.currentState!.showBottomSheet((context) =>
Container(
wIDth: double.infinity,color: colors.greY[200],child: padding(
padding: const EdgeInsets.all(20.0),child: Form(
key: s.formKey,child: column(
mainAxisSize: MainAxisSize.min,children: [
textF(preIcon: Icons.title,Hinttext: "title",COntrol: title,tap: ""),SizedBox(height: 10,),textF(preIcon: Icons.date_range,Hinttext: "Date",COntrol: date,tap: ontap),textF(preIcon: Icons.timelapse_rounded,Hinttext: "Time",COntrol: time,tap: time_pick)
],));
}
else {
s.setopen(true);
// Navigator.pop(context);
if (title.text != null && date.text != null &&
time.text != null) {
s.insertToDatabase(time: time.text,title: title.text,date: date.text);
title.text ="";
date.text ="";
time.text="";
}
}
},child: Icon(s.open ? Icons.edit : Icons.add),bottomNavigationbar:
BottomNavigationbar(
onTap: (int indeX) {
s.seTindex(indeX);
},currenTindex: s.index,items: [
BottomNavigationbarItem(
icon: Icon(Icons.add_circle_outlinE),label: "Create",BottomNavigationbarItem(
icon: Icon(Icons.donE),label: "done"),BottomNavigationbarItem(
icon: Icon(Icons.archive_outlined),label: "Archive")
],)
),Listener: (BuildContext context,Object? statE) { },);
}
错误:
在构建 Nav(dirty) 时抛出了以下断言: BlocProvIDer.of() 使用不包含 CubicCounter 的上下文调用。
No ancestor Could be found starTing from the context that was passed to BlocProvIDer.of<CubicCounter>().
This can happen if the context you used comes from a Widget above the BlocProvIDer.
The context used was: Nav(dirty)
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的你好,我在运行后收到此错误,但在颤振中对此有任何解决方案全部内容,希望文章能够帮你解决你好,我在运行后收到此错误,但在颤振中对此有任何解决方案所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。