参数类型“Widget Function(BuildContext, Object?)”无法分配给参数类型 'Widget Function(BuildContext,dynamic,VxStatus?
[Issue 1 :)'. ][1]
参数类型“Widget Function(BuildContext,Object?)”无法分配给参数类型“Widget Function(BuildContext,dynamic,VxStatus?”
尝试使用 Vxbuilder 或 Vxconsumer 更新购物车总数,但会弹出此错误
class _CartTotal extends StatelessWidget {
final CartModel _cart = (VxState.store as MyStore).cart;
@override
Widget build(BuildContext context) {
return SizedBox(
height: 200,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
VxBuilder(
mutations: {RemoveMutation},
//notifications: {},
builder: (context, _ ){
return "\$${_cart.totalPrice}"
.text
.xl5
.color(context.theme.accentColor)
.make();
},
);
30.widthBox,
TextButton(
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: "Buying not supported yet".text.center.make(),
));
},
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(context.theme.buttonColor)),
child: "Buy".text.xl3.color(Colors.black).make())
.w32(context),
],
),
);
}
}
'''
[Issue 1 :)'. ][1]
The argument type 'Widget Function(BuildContext, Object?)' can't be assigned to the parameter type 'Widget Function(BuildContext, dynamic, VxStatus?
Trying to update the cart total using Vxbuilder or Vxconsumer but this errors pops in
class _CartTotal extends StatelessWidget {
final CartModel _cart = (VxState.store as MyStore).cart;
@override
Widget build(BuildContext context) {
return SizedBox(
height: 200,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
VxBuilder(
mutations: {RemoveMutation},
//notifications: {},
builder: (context, _ ){
return "\${_cart.totalPrice}"
.text
.xl5
.color(context.theme.accentColor)
.make();
},
);
30.widthBox,
TextButton(
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: "Buying not supported yet".text.center.make(),
));
},
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(context.theme.buttonColor)),
child: "Buy".text.xl3.color(Colors.black).make())
.w32(context),
],
),
);
}
}
'''
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这一行:
您正在声明一个函数,该函数需要 3 个参数,但您只传递 2 个参数,添加第三个参数:
This line:
You are declaring a function, this function takes 3 arguments, but you are only passing 2, add a third argument: