0

我有一个函数可以将一个小部件返回到我的构建器中。

我希望它返回一个 ListView,但 Appbar 下方的所有内容都会在我返回的这段代码中变白:

@override
  Widget details(BuildContext context) {
    var cell = (Widget widget) => Padding(
      padding: EdgeInsets.all(5),
      child: widget,
    );

    var locale = Localizations.localeOf(context);

    return ListView( 
      children: <Widget>[
        ListTile(title: Text("Test")),
      ],
    );
  }

调用构建器将其作为主体:

return Container(
          //padding: EdgeInsets.all(32),
          child: Column(
            children: [
              Container(
              color: Color.fromRGBO(49, 161, 181, 0.4),
              child:
                Hero(
                  tag: collectible.heroTag,
                  child: Container(
                    width: double.infinity,
                    height: 250,
                    child: FadeInImage(
                      image: collectible.detailImage,
                      placeholder: collectible.icon,
                      fadeInDuration: Duration(milliseconds: 100),
                      fadeOutDuration: Duration(milliseconds: 100),
                      fadeInCurve: Curves.linear,
                      fadeOutCurve: Curves.linear,
                      // errorBuilder: (context, obj, satckTrace) =>
                        // Image.asset('images/bildfehlt.png'),
                    ),
                    alignment: Alignment.center,
                  ),
                ),

              ),
              CheckboxListTile(
                title: Text("Got it"),
                controlAffinity: ListTileControlAffinity.leading,
                value: collectible.isObtained(settings),
                onChanged: (value) {
                  collectible.setObtained(settings, value);
                },
              ),
              collectible.details(context), // <-------- function
            ],
          ),
        );

我执行错了吗?任何其他小部件、容器或列示例都可以正常工作。

错误日志: https ://pastebin.com/geSBXcB6

4

0 回答 0