/*
 * @Author: WuWei
 * @Date: 2020-06-17 15:09:28
 * @LastEditors  : WuWei
 * @LastEditTime : 2023-02-07 15:31:27
 * @Description:
 */
part of '../index.dart';

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

  @override
  Widget build(BuildContext context) {
    final store = Provider.of<SearchCarDetailStore>(context);

    return SliverToBoxAdapter(
        child: Wisdom(
            padding: EdgeInsets.all(10.pt),
            child: Wisdom.column(
              mainAxisSize: MainAxisSize.min,
              color: Colors.white,
              borderRadius: BorderRadius.circular(14.pt),
              boxShadow: [
                BoxShadow(
                  color: Color(0x40000000),
                  blurRadius: 10.pt,
                  spreadRadius: -5.pt,
                )
              ],
              children: <Widget>[
                Wisdom.row(
                  mainAxisSize: MainAxisSize.max,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  borderRadius: BorderRadius.vertical(
                    top: Radius.circular(14.pt),
                  ),
                  padding: EdgeInsets.all(15.pt),
                  color: Color(0xFFEF8F8F),
                  children: <Widget>[
                    Wisdom(
                      borderRadius: BorderRadius.circular(100.pt),
                      width: 12.pt,
                      height: 12.pt,
                      color: Colors.white,
                      margin: EdgeInsets.only(right: 5.pt),
                    ),
                    WisText.white(
                      '相关住户',
                      size: 16.pt,
                    )
                  ],
                ),
                store.carDetail?.residentName != null
                    ? Wisdom.column(
                        mainAxisSize: MainAxisSize.min,
                        padding: EdgeInsets.all(15.pt),
                        children: <Widget>[
                          Wisdom.row(
                            margin: EdgeInsets.only(bottom: 5.pt),
                            mainAxisAlignment: MainAxisAlignment.start,
                            children: <Widget>[
                              WisText('${store.carDetail?.residentName ?? ''}')
                            ],
                          ),
                          Wisdom.row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: <Widget>[
                              Wisdom.row(
                                onTap: () => launch(
                                    'tel:${store.carDetail?.residentMobile}'),
                                children: <Widget>[
                                  Icon(FaIcons.phone,
                                      size: 12.pt, color: Color(0xFF2D8CF0)),
                                  WisText(
                                      '${store.carDetail?.residentMobile ?? ''}',
                                      size: 12.pt,
                                      color: Color(0xFF2D8CF0)),
                                ],
                              ),
                              WisText.c999(
                                '住户性质：${store.residentType[store.carDetail?.residentIdentit] ?? ''}',
                                size: 12.pt,
                              )
                            ],
                          ),
                        ],
                      )
                    : Wisdom.row(
                        padding:
                            EdgeInsets.fromLTRB(15.pt, 22.pt, 15.pt, 22.pt),
                        mainAxisAlignment: MainAxisAlignment.start,
                        children: <Widget>[
                          WisText.c999(
                            '暂无数据',
                            size: 14.pt,
                          )
                        ],
                      )
              ],
            )));
  }
}
