我正在使用 Flutter 进行应用程序开发。我想在背景图像上叠加一个海报图像视图,就像下面的截图一样。
 下面的代码片段做到了这一点,但它还需要我根据海报的位置和背景图像的位置来定位所有其他小部件,包括电影标题、发布日期等,这在多个设备和方向上是不可靠的。是否有解决此问题的示例或建议?
下面的代码片段做到了这一点,但它还需要我根据海报的位置和背景图像的位置来定位所有其他小部件,包括电影标题、发布日期等,这在多个设备和方向上是不可靠的。是否有解决此问题的示例或建议?
    @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new PlatformAdaptiveAppBar(
        title: new Text(widget.movie.title),
      ),
      body: new Container(
          constraints: new BoxConstraints.expand(),
          child: new Stack(
            children: <Widget>[
              new Container(
                child: new Image(
                    image: new AdvancedNetworkImage(
                        movieGridUtil.getUrlFromPath(widget.movie.backdrop_path,
                            MovieGridImageTypes.BACKDROP),
                        useMemoryCache: false,
                        useDiskCache: true)),
                constraints: new BoxConstraints.expand(height: 250.0),
              ),
              new Positioned(
                  left: 12.0,
                  top: 220.0,
                  child: new Image(
                    width: 100.0,
                    height: 150.0,
                    image: new AdvancedNetworkImage(
                        movieGridUtil.getUrlFromPath(widget.movie.poster_path,
                            MovieGridImageTypes.POSTER),
                        useMemoryCache: false,
                        useDiskCache: true),
                  )),
            ],
          )),
    );
  }
