/*
 * @Author: XianKaiQun
 * @Date: 2020-07-31 14:47:24
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-08-10 16:34:08
 * @Description: 
 */
part of '../index.dart';

class _OptionComponent extends StatelessWidget {
  const _OptionComponent({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    final store = Provider.of<PrivateCleanDetailStore>(context);
    final style = WTheme.of(context);
    final colorScheme = style.colorScheme;
    final theme = Theme.of(context);
    final textTheme = theme.textTheme;
    final data = store.data;
    if (data == null) {
      return SliverToBoxAdapter();
    }
    final vos = data.cleanRecordSnapshotVos!;
    return WisCard(
      isSliver: true,
      margin: EdgeInsets.fromLTRB(15.pt, 15.pt, 15.pt, 0),
      padding: EdgeInsets.symmetric(horizontal: 15.pt),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: <Widget>[
          Text(
            '保洁清单',
            style: textTheme.titleMedium!.copyWith(
              fontWeight: FontWeight.bold,
            ),
          ).asPaddingSymmetric(vertical: 15.pt),
          ...ListTile.divideTiles(
            context: context,
            tiles: [
              for (var item in vos)
                ListTile(
                  leading: Icon(
                    item.complete == true
                        ? Icons.check_box
                        : Icons.check_box_outline_blank,
                    color: item.complete == true ? colorScheme.primary : null,
                  ),
                  dense: true,
                  contentPadding: EdgeInsets.zero,
                  title: Text(item.item ?? ''),
                ),
            ],
          ).toList(),
        ],
      ),
    );
  }
}
