/*
 * @Author: XianKaiQun
 * @Date: 2020-08-03 17:30:41
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-08-04 17:18:22
 * @Description: 
 */
part of '../index.dart';

///规范描述
class _NormComponent extends StatelessWidget {
  const _NormComponent({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    final store = Provider.of<PrivateRepairHandleStore>(context);
    final style = WTheme.of(context);
    final colorScheme = style.colorScheme;
//final theme = Theme.of(context);
//final textTheme = theme.textTheme;
    final norm = store.norm;
    final name = norm?.name ?? '';
    String rule = norm?.rule ?? '';

    String ruleStr = rule.replaceAllMapped(RegExp(r'<img src="/\w+/'), (match) {
      return '<img width="100%" src="${APPConfig.baseURL}';
    });
    return WisCard(
      isSliver: true,
      margin: EdgeInsets.symmetric(vertical: 7.5.pt, horizontal: 15.pt),
      child: ExpansionTile(
        title: Text(
          '$name',
          maxLines: 1,
          overflow: TextOverflow.ellipsis,
          style: TextStyle(
            fontWeight: FontWeight.normal,
            color: colorScheme.text,
          ),
        ),
        children: <Widget>[
          Padding(
            padding: EdgeInsets.all(15.pt),
            child: HtmlWidget(
              '$ruleStr',
            ),
          ),
        ],
      ),
    );
  }
}
