/*
 * @Author: XianKaiQun
 * @Date: 2020-08-17 17:01:06
 * @LastEditors  : WuWei
 * @LastEditTime : 2023-11-01 17:38:35
 * @Description: 
 */
part of '../index.dart';

class _DepositePayComponent extends StatelessWidget {
  const _DepositePayComponent({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    final colorScheme = WTheme.of(context).colorScheme;
    final store = Provider.of<PrivateSubmintStore>(context);

    return SliverToBoxAdapter(
      child: WisCard(
        margin: EdgeInsets.only(
          top: 15.pt,
          bottom: 10.pt,
          left: 15.pt,
          right: 15.pt,
        ),
        child: Wisdom.column(
          padding: EdgeInsets.fromLTRB(0, 15.pt, 15.pt, 5.pt),
          children: <Widget>[
            FormItemComponent(
              leadingText: '押金资产',
              must: true,
              child: TextFormField(
                controller:
                    TextEditingController(text: store.depositeAssetItem?.name),
                readOnly: true,
                onTap: () => store.chooseDepositeAsset(),
                decoration: InputDecoration(
                  filled: true,
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(4.pt),
                    borderSide: BorderSide.none,
                  ),
                  fillColor: colorScheme.background4,
                  hintText: '选择押金资产',
                  suffixIcon: Icon(
                    Icons.arrow_right_rounded,
                    color: colorScheme.placeholder2,
                    size: 30.pt,
                  ),
                  suffixIconConstraints: BoxConstraints(),
                ),
              ),
            ),
            FormItemComponent(
              leadingText: '押金项目',
              must: true,
              child: TextFormField(
                controller:
                    TextEditingController(text: store.depositeChargeItem?.name),
                readOnly: true,
                onTap: () => store.chooseDepositeCharge(),
                decoration: InputDecoration(
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(4.0.pt),
                    borderSide: BorderSide(color: Colors.white),
                  ),
                  fillColor: colorScheme.background4,
                  hintText: '选择预存项目',
                  suffixIcon: Icon(
                    Icons.arrow_right_rounded,
                    color: colorScheme.placeholder2,
                    size: 30.pt,
                  ),
                  suffixIconConstraints: BoxConstraints(),
                ),
              ),
            ),
            if (store.depositeChargeItem?.identification != null) ...[
              FormItemComponent(
                must: true,
                crossAxisAlignment: CrossAxisAlignment.center,
                leadingText: '押金金额',
                child: Wisdom.row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  color: colorScheme.background4,
                  padding: EdgeInsets.fromLTRB(15.pt, 10.pt, 5.pt, 10.pt),
                  borderRadius: BorderRadius.circular(4.pt),
                  children: [
                    WisText(
                      '${store.depositeChargeItem?.fee != null ? store.depositeChargeItem?.fee : 0}',
                      color: colorScheme.placeholder2,
                    ),
                  ],
                ),
              ),
            ]
          ],
        ),
      ),
    );
  }
}
