/*
 * @Author: WuWei
 * @Date: 2020-06-17 09:22:39
 * @LastEditors: WuWei
 * @LastEditTime: 2020-06-18 10:29:24
 * @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<SearchParkDetailStore>(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.parkDetail?.code ?? ''}',
                        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.parkType[store.parkDetail?.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.parkDetail?.parkingLotName ?? ''}',
                        color: Color(0xFF999999), size: 14.pt),
                  ],
                ),

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

                /// 住户详细信息
                InfoItem(
                  title: '关联房屋',
                  content: '${store.parkDetail?.houseFullName ?? ''}',
                ),
                InfoItem(
                  title: '面积(m²)',
                  content: '${store.parkDetail?.parkingLotName ?? ''}',
                ),
                InfoItem(
                  title: '最大停放车位',
                  content: '${store.parkDetail?.maxCarAmount ?? ''}',
                ),
                InfoItem(
                  title: '车位状态',
                  content:
                      '${store.parkStatus[store.parkDetail?.status] ?? ''}',
                ),
                InfoItem(
                  title: '备注',
                  content: '${store.parkDetail?.remark ?? ''}',
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
