【问题标题】:how can make like this widget or card list flutter如何让这样的小部件或卡片列表颤动
【发布时间】:2019-01-31 11:46:15
【问题描述】:

如何制作像这样的小部件 或卡片列表

[![在此处输入图片描述][2]][2]

【问题讨论】:

  • 您可以输入您的代码来检查您的预付款。

标签: dart flutter


【解决方案1】:

这将生成您所需的 UI,根据您的要求进行装饰

Widget build(BuildContext context) {
return new Container(
  alignment: Alignment.centerLeft,
  margin: new EdgeInsets.all(8.0),
  padding: new EdgeInsets.all(8.0),
  height: 150.0,
  decoration: new BoxDecoration(
    color: Colors.lightBlue,
    borderRadius: new BorderRadius.all(new Radius.circular(10.0)),
    boxShadow: [new BoxShadow(color: Colors.black54, offset: new Offset(2.0, 2.0),
    blurRadius: 5.0)]
  ),
  child: new Row(children: <Widget>[
    new CircleAvatar(backgroundColor: Colors.white70,radius: 50.0,),
    new Expanded(child: new Padding(padding: new EdgeInsets.only(left: 8.0),
      child: new Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          new Text('Hot Pot', style: new TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold),),
          new Row(children: <Widget>[
            new Icon(Icons.star, color: Colors.white,),
            new Icon(Icons.star, color: Colors.white,),
            new Icon(Icons.star, color: Colors.white,),
            new Icon(Icons.star_half, color: Colors.white,),
            new Icon(Icons.star_border, color: Colors.white,),
          ],),
          new Wrap(spacing: 2.0,children: <Widget>[
            new Chip(label: new Text('Hot')),
            new Chip(label: new Text('Hot')),
            new Chip(label: new Text('Hot')),
          ],)
        ],),))
  ],),
);
}

【讨论】:

    【解决方案2】:

    看看这个question

    对于背景图片,使用ContainerBoxDecoration。对于左侧的图像,请使用 Image.asset 小部件。

    【讨论】:

      猜你喜欢
      • 2020-09-06
      • 2020-09-28
      • 1970-01-01
      • 2020-02-25
      • 2019-12-20
      • 2019-08-14
      • 2015-09-30
      • 1970-01-01
      • 2022-08-10
      相关资源
      最近更新 更多