import 'package:flutter/material.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class BrandDetailRecommend extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
        margin: EdgeInsets.only(left: 10, right: 10, top: 10,bottom: 8),
        decoration: BoxDecoration(
            color: HexColor.fromHex("#FFFFFF"),
            borderRadius: BorderRadius.circular(8)),
        padding: EdgeInsets.only(top: 12, bottom: 12),
        child: Column(
          children: <Widget>[
            Text(
              "爆款推荐",
              style: TextStyle(color: HexColor.fromHex("#FF1D1D1D")),
            ),
            SizedBox(
              height: 5,
            ),
            Container(
              width: 27,
              height: 2.5,
              color: HexColor.fromHex("#FFFF4242"),
            ),
            SizedBox(
              height: 9,
            ),
            Row(children: buildItem()),
          ],
        ));
  }

  ///构建子项
  buildItem() {
    List<Widget> listWidget = List();
    for (var index = 0; index < 3; index++) {
      listWidget.add(Expanded(
        flex: 1,
        child: Container(
          margin: EdgeInsets.only(left: 4, right: 4),
          child: Stack(children: <Widget>[
            Column(
              children: <Widget>[
                CachedNetworkImage(
                  imageUrl:
                      "https://alipic.lanhuapp.com/SketchPngd755e6f62dfaf7bae4da8bf384a5ef25bde99ae5e4f34424c5d404c805775bc1",
                  fit: BoxFit.fitWidth,
                ),
                Container(
                  padding:
                      EdgeInsets.only(left: 0, right: 0, top: 0, bottom: 0),
                  margin: EdgeInsets.only(left: 10, right: 10, top: 10),
                  decoration: BoxDecoration(
                      image: DecorationImage(
                          fit: BoxFit.fill,
                          image: CachedNetworkImageProvider(
                              "https://alipic.lanhuapp.com/SketchPng4f1ab85a62b33508b27e51c317ffb4f19d7dd5dcc70fadf50169cbc68d046cfb"))),
                  child: Center(
                    child: Padding(
                      padding: EdgeInsets.only(
                          top: 1, bottom: 1, left: 16, right: 16),
                      child: Text(
                        "热卖3.5万",
                        style: TextStyle(
                            fontSize: 12, color: HexColor.fromHex("#FFFFFF")),
                      ),
                    ),
                  ),
                ),
                SizedBox(
                  height: 7,
                ),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.end,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Padding(
                      padding: EdgeInsets.only(bottom: 1),
                      child: Text(
                        "¥",
                        style: TextStyle(
                            color: HexColor.fromHex("#FFFF4242"), fontSize: 10),
                      ),
                    ),
                    Text(
                      "23.9",
                      style: TextStyle(
                          fontWeight: FontWeight.bold,
                          color: HexColor.fromHex("#FFFF4242"),
                          fontSize: 15),
                    ),
                    SizedBox(
                      width: 10,
                    ),
                    Text(
                      "¥23.9",
                      style: TextStyle(
                          decoration: TextDecoration.lineThrough,
                          color: HexColor.fromHex("#FFACACAC"),
                          fontSize: 15),
                    )
                  ],
                )
              ],
            ),
          ]),
        ),
      ));
    }
    return listWidget;
  }
}
