/*
 * @Author: WuWei
 * @Date: 2020-06-17 09:22:39
 * @LastEditors: WuWei
 * @LastEditTime: 2020-06-17 15:52:27
 * @Description:
 */
part of '../index.dart';

class _TopInfoCard extends StatelessWidget {
  const _TopInfoCard({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final store = Provider.of<SearchCarDetailStore>(context);
    return SliverToBoxAdapter(
      child: Stack(
        children: <Widget>[
          ClipPath(
            // 只裁切底部的方法
            clipper: BlockClipper(),
            child: Container(
              width: MediaQuery.of(context).size.width,
              height: 260.pt,
              decoration: new BoxDecoration(
                gradient: const LinearGradient(
                  begin: Alignment.topCenter,
                  end: Alignment.bottomCenter,
                  colors: [const Color(0XFF0F67F8), const Color(0xFF9CDCFF)],
                  tileMode: TileMode.repeated,
                ),
              ),
            ),
          ),

          /// 车辆信息卡片
          Wisdom(
            padding: EdgeInsets.all(15.pt),
            margin: EdgeInsets.fromLTRB(10.pt, 20.pt, 10.pt, 10.pt),
            color: Colors.white,
            width: MediaQuery.of(context).size.width,
            borderRadius: BorderRadius.circular(14.pt),
            boxShadow: [
              //阴影
              BoxShadow(
                color: Color(0x40000000),
                blurRadius: 10.pt,
                spreadRadius: -5.pt,
              )
            ],
            child: Wisdom.column(
              children: <Widget>[
                Wisdom.row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  margin: EdgeInsets.only(bottom: 5.pt),
                  children: <Widget>[
                    WisText('${store.carDetail?.cardNo ?? ''}',
                        color: Color(0xFF2D8CF0), size: 20.pt),
                    Wisdom(
                      border: Border.all(
                        color: Color(0xFF2D8CF0),
                      ),
                      padding: EdgeInsets.fromLTRB(10.pt, 2.pt, 10.pt, 2.pt),
                      borderRadius: BorderRadius.circular(10.pt),
                      child: WisText(
                          '${store.carType[store.carDetail?.type] ?? ''}',
                          color: Color(0xFF2D8CF0),
                          size: 12.pt),
                    ),
                  ],
                ),
                Wisdom.row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  margin: EdgeInsets.only(bottom: 5.pt),
                  children: <Widget>[
                    WisText('${store.carDetail?.ownerName ?? ''}',
                        color: Color(0xFF999999), size: 14.pt),
                    Wisdom(
                      onTap: () =>
                          launch('tel:${store.carDetail?.ownerMobile}'),
                      child: Wisdom.row(
                        children: <Widget>[
                          Icon(FaIcons.phone,
                              size: 12.pt, color: Color(0xFF2D8CF0)),
                          WisText('${store.carDetail?.ownerMobile ?? ''}',
                              color: Color(0xFF2D8CF0), size: 14.pt)
                        ],
                      ),
                    )
                  ],
                ),

                /// 分割线
                Divider(
                  height: 10.pt,
                  color: Color(0xFFE4E4E4),
                ),

                /// 住户详细信息
                InfoItem(
                  title: '关联房屋',
                  content: '${store.carDetail?.houseFullName ?? ''}',
                ),
                InfoItem(
                  title: '所属车场',
                  content: '${store.carDetail?.parkingLotName ?? ''}',
                ),
                InfoItem(
                  title: '包月车辆',
                  content:
                      '${(store.carDetail != null && store.carDetail?.monthSubscribe == true) ? '是' : '否'}',
                ),
                InfoItem(
                  title: '新能源车',
                  content:
                      '${(store.carDetail != null && store.carDetail?.newEnergy == true) ? '是' : '否'}',
                ),
                InfoItem(
                  title: '备注',
                  content: '${store.carDetail?.remark ?? ''}',
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
