如何在flutter中为列分配图像背景

时间:2019-03-13 16:52:33

标签: dart flutter flutter-layout

我想知道如何添加图像,以作为背景在我的活动挂牌中的一列中波动。

关于我要在何处添加图像的代码如下(从子新列到最后):

 FlipCard(
            direction: FlipDirection.HORIZONTAL, // default
            front: Container(
              decoration: new BoxDecoration(
                border: new Border.all(color: Colors.black),
                borderRadius: BorderRadius.circular(10.0),
              ),
              margin: EdgeInsets.all(10.0),
              child: new Column(
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  new Column(
                    children: <Widget>[
                      new Container(
                          margin: EdgeInsets.all(10),
                          width: 190.0,
                          height: 190.0,
                          decoration: new BoxDecoration(
                              shape: BoxShape.circle,
                              border: new Border.all(color: Colors.black),
                              image: new DecorationImage(
                                  fit: BoxFit.fill,
                                  image: new NetworkImage(
                                      "https://pbs.twimg.com/profile_images/610120554738266112/I4pl2ygE_400x400.jpg")
                              )
                          )
                      ),
                      new Text('Lars Løkke',
                        style: new TextStyle(
                          fontSize: 20.0,
                        ),
                      ),
                      new Text('Venstre',
                        style: new TextStyle(
                          fontSize: 15,
                        ),
                      ),
                    ],
                  ),

在图片中可以看到完整的布局,并用蓝色勾勒出我想要图像背景的位置:

Layout image

希望您能帮助我,谢谢。

1 个答案:

答案 0 :(得分:0)

简单包装-<products> <product> <categoryName>Telewizory</categoryName> <brandName>Sony</brandName> <productCode>133</productCode> <productId>14165691</productId> <productFullName>Design Thinking dla przedsiębiorców i małych firm.</productFullName> <productEan>3</productEan> <productEuroPriceNetto>203.33</productEuroPriceNetto> <productFrontendPriceNetto>220.22</productFrontendPriceNetto> <productFastestSupplierQuantity>0</productFastestSupplierQuantity> <deliveryEstimatedDays>5</deliveryEstimatedDays> </product> <product> <categoryName>Telewizory</categoryName> <brandName>Sony</brandName> <productCode>133</productCode> <productId>1416569122</productId> <productFullName>Design not Thinking dla przedsiębiorców i małych firm.</productFullName> <productEan></productEan> <productEuroPriceNetto>300.33</productEuroPriceNetto> <productFrontendPriceNetto>22.85</productFrontendPriceNetto> <productFastestSupplierQuantity>24</productFastestSupplierQuantity> <deliveryEstimatedDays>2</deliveryEstimatedDays> </product> </products> 和-$reader = new XMLReader(); $reader->open($url); $count = 0; $this_value = ''; //$products = array(); while($reader->read()) { switch ($reader->nodeType) { case XMLReader::ELEMENT: // deal with self-closing tags if ($reader->isEmptyElement) { ${$reader->name} = ''; $products[$count][$reader->name] = ''; } break; case XMLReader::TEXT: case XMLReader::CDATA: // save the value for storage when we get to the end of the element $this_value = $reader->value; break; case XMLReader::END_ELEMENT: if ($reader->name == 'product') { $count++; // print_r(array($categoryName, $brandName, $productCode, $productId, $productFullName, $productEan, $productEuroPriceNetto, $productFrontendPriceNetto, $productFastestSupplierQuantity, $deliveryEstimatedDays)); } elseif ($reader->name != 'products') { ${$reader->name} = $this_value; //$products[$count][$reader->name] = $this_value; // set this_value to a blank string to allow for empty tags $this_value = ''; } break; case XMLReader::WHITESPACE: case XMLReader::SIGNIFICANT_WHITESPACE: default: // nothing to do break; } } $reader->close();

代码:

Column

输出:

enter image description here