import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:zhiying_base_widget/widgets/home/home_quick_entry/cached_network_image_util.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:cached_network_image/cached_network_image.dart';

class HotRankingGoods extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
        Container(
          padding: EdgeInsets.all(15.w),
          margin:
              EdgeInsets.only(top: 8.w, bottom: 8.w, left: 25.w, right: 25.w),
          decoration: BoxDecoration(
              color: Colors.white, borderRadius: BorderRadius.circular(15.w)),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Container(
                width: 254.w,
                height: 254.w,
                color: Colors.amber,
              ),
              Expanded(
                  child: Container(
                margin: EdgeInsets.only(left: 20.w),
                child: Column(
                  mainAxisSize: MainAxisSize.max,
                  children: <Widget>[
                    Container(
                      height: 70.h,
                      child: Row(
                        children: <Widget>[
                          Expanded(
                              child: RichText(
                                  overflow: TextOverflow.ellipsis,
                                  maxLines: 2,
                                  text: TextSpan(children: <InlineSpan>[
                                    WidgetSpan(
                                        child: Container(
                                      decoration: BoxDecoration(
                                          color: Colors.red,
                                          borderRadius:
                                              BorderRadius.circular(4)),
                                      child: Padding(
                                        padding: EdgeInsets.only(
                                            left: 4.w, right: 4.w),
                                        child: Text(
                                          "京东",
                                          style: TextStyle(
                                              color: HexColor.fromHex(
                                                "#FFFFFF",
                                              ),
                                              fontSize: 18.sp),
                                        ),
                                      ),
                                    )),
                                    WidgetSpan(
                                        child: SizedBox(
                                      width: 4.h,
                                    )),
                                    TextSpan(
                                        text:
                                            "Segway Ninebot mini Pro九号平衡车智能代步...",
                                        style: TextStyle(
                                            color: Colors.black,
                                            fontSize: 30.sp))
                                  ])))
                        ],
                      ),
                    ),
                    Row(
                      children: <Widget>[
                        Container(
                          margin: EdgeInsets.only(top: 4, bottom: 4),
                          decoration: BoxDecoration(color: Colors.red),
                          child: Padding(
                            padding: const EdgeInsets.only(
                                left: 8, right: 8, top: 2, bottom: 2),
                            child: Text(
                              "50元券",
                              style: TextStyle(
                                  color: Colors.white, fontSize: 22.sp),
                            ),
                          ),
                        ),
                        SizedBox(
                          width: 10.sp,
                        ),
                        Container(
                          margin: EdgeInsets.only(top: 4, bottom: 4),
                          decoration: BoxDecoration(color: Colors.red),
                          child: Padding(
                            padding: const EdgeInsets.only(
                                left: 8, right: 8, top: 2, bottom: 2),
                            child: Text(
                              "50元券",
                              style: TextStyle(
                                  color: Colors.white, fontSize: 22.sp),
                            ),
                          ),
                        )
                      ],
                    ),
                    Padding(
                      padding: const EdgeInsets.only(top: 4, bottom: 4),
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.end,
                        children: <Widget>[
                          Padding(
                            padding: EdgeInsets.only(bottom: 6.sp),
                            child: Text(
                              "¥",
                              style:
                                  TextStyle(color: Colors.red, fontSize: 20.sp),
                            ),
                          ),
                          Text(
                            "1409",
                            style:
                                TextStyle(color: Colors.red, fontSize: 40.sp),
                          ),
                          SizedBox(
                            width: 6,
                          ),
                          Padding(
                            padding: EdgeInsets.only(bottom: 4.sp),
                            child: Text(
                              "¥1409",
                              style: TextStyle(
                                  color: Colors.red,
                                  fontSize: 22.sp,
                                  decoration: TextDecoration.lineThrough),
                            ),
                          ),
                        ],
                      ),
                    ),
                    Row(
                      children: <Widget>[
                        Expanded(
                            child: Stack(
                          alignment: Alignment.centerLeft,
                          children: <Widget>[
                            Row(
                              children: <Widget>[
                                Expanded(
                                    child: Container(
                                  height: 40.w,
                                  padding: EdgeInsets.only(
                                    left: 64.w,
                                  ),
                                  margin: EdgeInsets.only(right: 20),
                                  color: Colors.red,
                                  child: Text(
                                    "热销1231.1万件",
                                    style: TextStyle(
                                        color: Colors.white, fontSize: 22.sp),
                                  ),
                                ))
                              ],
                            ),
                            Container(
                              color: Colors.amber,
                              width: 48.w,
                              height: 48.w,
                              child: CachedNetworkImage(
                                imageUrl: "",
                                width: 48.w,
                                height: 48.w,
                                placeholder: (context, _) =>
                                    Container(color: Colors.yellow),
                                fit: BoxFit.fill,
                              ),
                            ),
                            Align(
                              alignment: Alignment.centerRight,
                              child: Container(
                                decoration: BoxDecoration(
                                    color: Colors.amber,
                                    borderRadius: BorderRadius.circular(20)),
                                margin: EdgeInsets.only(right: 0),
                                child: Padding(
                                  padding: EdgeInsets.only(
                                      left: 16, right: 16, top: 4, bottom: 4),
                                  child: Text(
                                    "马上抢",
                                    style: TextStyle(
                                        color: Colors.white, fontSize: 26.sp),
                                  ),
                                ),
                              ),
                            )
                          ],
                        ))
                      ],
                    )
                  ],
                ),
              ))
            ],
          ),
        ),
        Align(
          alignment: Alignment.topLeft,
          child: Container(
            margin: EdgeInsets.only(left: 40.w, top: 8.h),
            color: Colors.red,
            height: 60.w,
            width: 60.w,
          ),
        )
      ],
    );
  }
}
