如何将自定义小部件的内容推送到下一页

时间:2019-01-06 20:12:16

标签: dart flutter state custom-widgets

我创建了小部件,并在带有Gridview.count的列中调用了参数,但是我想将相同的参数推送到另一个屏幕。请我怎么做?谢谢

child: new Column(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: <Widget>[
              GridView.count(
                crossAxisCount: 2,
                primary: false,
                crossAxisSpacing: 10.0,
                childAspectRatio: 0.75,
                mainAxisSpacing: 10.0,
                shrinkWrap: true,
                children: <Widget>[
                  Hero(
                    tag: 'f2',
                    child: flashCard('images/flashSales/f2.jpg', 'Iphone 8, 126gb ram','Ghs 2,150', 'Newsite, Takoradi', '8 Available', true),
                  ),

                ],
              ),
            ]),
      )
    ]));

}

  Widget flashCard(String pixPath, String heading, String price,
  String location, String available, bool inStock) {
return Container(
  width: 170.0,
  child: new Card(
    elevation: 2.0,
    child: Wrap(
      children: <Widget>[
        Container(
          height: 140.0,
            decoration: BoxDecoration(
                image: DecorationImage(
                    image: AssetImage(pixPath),
                  fit: BoxFit.cover,),

            ),
        ), 

1 个答案:

答案 0 :(得分:0)

这个问题已经被问过了,有多种选择。

请在此处查看类似问题的答案:https://stackoverflow.com/a/54015932/7803650