/*
 * @Author: XianKaiQun
 * @Date: 2020-08-17 09:57:59
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-08-19 11:16:34
 * @Description: 
 */
part of '../index.dart';

class _CardComponent extends StatelessWidget {
  const _CardComponent({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    final store = Provider.of<PrivatePledgeDetailStore>(context);
    final data = store.data;
    if (data == null) return SliverToBoxAdapter();
//final style = WTheme.of(context);final colorScheme = style.colorScheme;
//final theme = Theme.of(context);
//final textTheme = theme.textTheme;
    Map<String, String> imageMap = {
      'house': 'lib/assets/build.png',
      'car': 'lib/assets/car.png',
      'parkingSpace': 'lib/assets/park.png',
    };
    return SliverToBoxAdapter(
      child: WisCard(
        margin: EdgeInsets.all(15.pt),
        padding: EdgeInsets.all(10.pt),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            Wisdom.row(
              padding: EdgeInsets.all(10.pt),
              children: [
                Image.asset(
                  imageMap[data.chargeSubject!]!,
                  package: 'receipt_package',
                  width: 20.pt,
                ),
                Text(
                  ' ' + data.assetFullName!,
                  style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 16.pt,
                  ),
                ).asExpanded(),
              ],
            ),
            for (var item in data.depositeDetails ?? []) ...[
              Divider(),
              Wisdom.row(
                padding: EdgeInsets.all(10.pt),
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text('${item.name}'),
                  Text(
                    '￥${item.fee}',
                    style: TextStyle(color: Color(0XFFFF495E)),
                  ),
                ],
              ),
            ]
          ],
        ),
      ),
    );
  }
}
