结果未正确显示抖动

问题描述 投票:0回答:1

我有3个屏幕A,B,C,其中一个屏幕包含分支区域的区域列表视图,例如晨会,showrrom显示器等。当我单击晨会或展厅显示器等区域时,它将转到屏幕B屏幕B包含图像的列表视图和一些详细信息,当我单击屏幕B中的列表视图项时,它将进入屏幕C,其中显示3个详细信息,例如图像,描述,回复。这是应用程序的流程

但是如果我从屏幕B中打开图像,它仅显示早上会议的图像,但是在其他区域中,它仅显示正在加载图像和详细信息,这是问题。>

我下面有屏幕录像,请查看

问题

enter image description here

屏幕C的代码

class AreaImageDetailsScreenState extends State<AreaImageDetailsScreen> {
  final _scaffoldKey = GlobalKey<ScaffoldState>();
  String imageid;

  AreaImageDetailsScreenState(String imageid);

  String Description;
  String image_path;
  String Image_Rating;
  String replay;
  var rating = 0.0;

  @override
  void initState() {
    getImageView(imageid);
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build

    return Scaffold(
        key: _scaffoldKey,
        appBar: AppBar(
          title: Text(
            "Image Details",
            style: TextStyle(color: Colors.white, fontSize: 15),
          ),
          backgroundColor: Color.fromRGBO(23, 84, 119, 1),
        ),
        body: SingleChildScrollView(
          child: Container(
            padding: EdgeInsets.all(10),
            child: Column(
              mainAxisSize: MainAxisSize.max,
              children: <Widget>[
                Container(
                  width: 350,
                  height: 250,
                  decoration: BoxDecoration(
                    shape: BoxShape.rectangle,
                  ),
                  padding: EdgeInsets.all(10),
                  child: FadeInImage.assetNetwork(
                    image: image_path.toString(),
                    placeholder: "assets/images/loading.gif",
                    // your assets image path
                    fit: BoxFit.cover,
                  ),
                ),
                Expanded(
//              padding: EdgeInsets.all(5),
                  flex: 0,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      Expanded(
                          flex: 3,
                          child: Padding(
                            padding: EdgeInsets.all(8),
                            child: Text('Description',
                                style: TextStyle(
                                    color: Colors.redAccent,
                                    fontSize: 15,
                                    fontWeight: FontWeight.bold)),
                          )),
                    ],
                  ),
                ),
                Container(
                  padding: EdgeInsets.all(5),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      Expanded(
                          flex: 1,
                          child: Padding(
                            padding: EdgeInsets.all(5),
                            child: Text(
                              Description ?? 'No description yet',
                              style: TextStyle(
                                color: Colors.black,
                                fontSize: 15,
                              ),
                            ),
                          )),
                    ],
                  ),
                ),
                Container(
                  padding: EdgeInsets.all(5),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      Expanded(
                        flex: 1,
                        child: Padding(
                          padding: EdgeInsets.all(5),
                          child: Text('Reply',
                              style: TextStyle(
                                  color: Colors.deepOrange,
                                  fontSize: 15,
                                  fontWeight: FontWeight.bold)),
                        ),
                      ),
                    ],
                  ),
                ),

                //Remarks Section
                Container(
                  padding: EdgeInsets.all(5),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      Expanded(
                          flex: 2,
                          child: Padding(
                            padding: EdgeInsets.all(5),
                            child: Text(
                              replay ?? 'No reply yet',
                              style:
                                  TextStyle(fontSize: 15, color: Colors.black),
                            ),
                          )),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ));
  }

  Future<String> getImageView(String imageid)  async {
    Future token = SharedPrefrence().getToken();
    token.then((data) async {
      var token = data;
      var response = await http.post(Urls.Image_Details,
          headers: {
            "Content-Type": "application/json",
            "Authorization": "Bearer $token",
          },
          body: json.encode({
            "imageId": imageid,
          }));

      if (response.statusCode == 200) {
        try {
          print("test");
          var resp = response.body;

          print("response" + resp);
          Map<String, dynamic> value = json.decode(resp);

          var name = value['doc']['image'];
          Description = name["Description"].toString();
          image_path = name["image_path"].toString();
          replay = value['doc']["replays"][0]["replay"].toString();
//          setState(() {
//
//          });
        } catch (e) {
          e.toString();
        }
      } else {
        CustomDialogs().showErrorAlert(_scaffoldKey.currentContext,
            "Network Not Found...Check Your Internet Connection...");
      }
    });
  }
}
    

我有3个屏幕A,B,C,其中一个屏幕包含分支区域中的区域列表视图,例如晨会,showrrom显示器等。当我单击晨会或展厅显示器等区域时,它将转到.. 。

flutter flutter-layout
1个回答
0
投票

构造函数获取一个字符串,但它不执行任何操作。您可能会发现状态控件AreaImageDetailsScreen获得了imageId,然后尝试将其传递给状态对象。猜测是因为您仅共享状态对象。

© www.soinside.com 2019 - 2024. All rights reserved.