繁体   English   中英

参数类型“Widget Function(BuildContext, Object?)”不能分配给参数类型“Widget Function(BuildContext, dynamic, VxStatus?

[英]The argument type 'Widget Function(BuildContext, Object?)' can't be assigned to the parameter type '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),
        ],
      ),
    );
  }
}
'''

这一行:

 builder: (context, _ ){

你声明了一个 function,这个 function 需要 3 个 arguments,但是你只传递了 2,添加第三个参数:

 builder: (context, _, __) {

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM