Flutter web:期望类型为“SkDeletable”的值,但得到类型为“Null”的值

时间:2021-04-19 13:21:20

标签: flutter dart flutter-web

在 Flutter web 中遇到此错误:Expected a value of type 'SkDeletable', but got one of type 'Null' 尝试构建卡片时。

它适用于:release mode 但不适用于 debug mode。有谁知道这是从哪里来的?除了导致它的小部件(CustomCard

)之外,错误日志并没有说明太多

这是我的代码:

CustomCard(
              cardWidth: _cardWidth,
              cardHeight: _cardHeight,
              serviceIcon: servicesBackgrounds[3],
              serviceTitle: servicesTitles[3],
              serviceDescription: servicesDescriptions[3],
            ),

//----------------------------------------- --------------------------------------//

final double _height = MediaQuery.of(context).size.height;
final double _width = MediaQuery.of(context).size.width;
Container(
    width: widget.cardWidth,
    height: widget.cardHeight,
    padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
    child: Card(
      semanticContainer: true,
      clipBehavior: Clip.antiAliasWithSaveLayer,
      shape:
          RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
      elevation: 2,
      child: Container(
        decoration: BoxDecoration(
            image: DecorationImage(
                image: ExactAssetImage(widget.serviceIcon),
                fit: BoxFit.cover),
            color: darkBlue,
            borderRadius: BorderRadius.circular(10),
            boxShadow: isHover
                ? [
                    BoxShadow(
                        color: crimson,
                        blurRadius: 24.0,
                        offset: Offset(5.0, 15.0))
                  ]
                : []),
        child: BackdropFilter(
          filter: ImageFilter.blur(sigmaX: 0, sigmaY: 0),
          child: Container(
            decoration: BoxDecoration(color: darkBlue.withOpacity(0.8)),
            //alignment: Alignment.center,
            child: Stack(
              children: [
                Positioned(
                  top: _height * 0.02,
                  right: _width * 0.1,
                  left: _width * 0.1,
                  child: Text(widget.serviceTitle,
                      textAlign: TextAlign.center,
                      style: brandTextStyle(white, 25)),
                ),
                Positioned(
                  right: _width * 0.1,
                  left: _width * 0.1,
                  bottom: _height * 0.1,
                  child: Text(widget.serviceDescription,
                      textAlign: TextAlign.center,
                      style: typerTextStyle(white, 14)),
                )
              ],
            ),
          ),
        ),
      ),
    ),
  ),

0 个答案:

没有答案