我试图从主页导航抽屉中调用Page,但是遇到与提供程序有关的错误,该错误是我在流构建器中传递集团来更新页面的。
下面是调用页面的代码:
Navigator.push(context, PageRoutes(page:
NotificationPage()));
在构建窗口小部件中,我具有脚手架,并且主体具有以下代码:
Widget build(BuildContext context) {
final
notificationBloc=Provider.of<NotificationBloc>
(context);
return
Scaffold(
appBar: AppBar(title:Text('Tiles')),
body: Provider<NotificationBloc>(
create: (_)=>NotificationBloc(),
builder:(context,_){
return Column(
children: [
StreamBuilder<List<NotificationModel>>(
stream: notificationBloc.notifications,
builder: (context, snapshot) {
if(snapshot.hasData){
final notifications=snapshot.data;
_fadeInController.forward();
if(notifications.isEmpty){
return Container();
}
return Expanded(
child: AnimatedBuilder(
animation: _fadeInController,
builder: (context, child) {
return Opacity(
opacity: _fadeInController.value,
child: ListView.builder(
padding: const EdgeInsets.all(12),
itemCount: notifications.length,
itemBuilder: (context, index) {
final notification = notifications[index];
return NotificationTile(
notification: notification,
);
},
),
);
},
),
);
}
return Expanded(child: SizedBox());
}
),
// CustomWideFlatButton(
//onPressed: navigateToNotificationCreation,
//backgroundColor: Colors.blue.shade300,
//foregroundColor: Colors.blue.shade900,
//isRoundedAtBottom: false,
// )
],
);
}
)
);
}
但是,每次我单击抽屉图标来调用页面时,都会收到主题错误。能否请您帮忙,我尝试了多项更改并尝试在线进行研究,但没有任何解决方法