/*
 * @Author: XianKaiQun
 * @Date: 2020-07-13 18:04:03
 * @LastEditors: wjc
 * @LastEditTime: 2023-04-03 11:59:12
 * @Description: 
 */
part of '../index.dart';

class _ExponentComponent extends StatelessWidget {
  const _ExponentComponent({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    final store = Provider.of<PrivateDashBoardStore>(context);
    final style = WTheme.of(context);
    final colorScheme = style.colorScheme;
    num yearIndex = store.person?.yearIndex ?? 0;
    return WisCard(
      isSliver: true,
      margin: EdgeInsets.only(left: 15.pt, right: 15.pt, top: 10.pt, bottom: 5.pt),
      padding: EdgeInsets.all(15.pt),
      child: Column(
        children: <Widget>[
          Row(
            children: <Widget>[
              Text(
                '年度执行力指数',
                style: TextStyle(
                  fontSize: 16.pt,
                ),
              ).asExpanded(),
              if (store.person != null)
                Row(
                  children: <Widget>[
                    if (yearIndex > 85)
                      Icon(
                        Icons.thumb_up,
                        color: colorScheme.danger,
                      ),
                    if (yearIndex < 70)
                      Icon(
                        Icons.thumb_down,
                        color: colorScheme.minor,
                      ),
                    SizedBox(width: 10),
                    Text(
                      '$yearIndex',
                      style: TextStyle(
                        fontSize: 16.pt,
                        color: yearIndex > 85
                            ? colorScheme.danger
                            : yearIndex < 70
                                ? colorScheme.minor
                                : colorScheme.primary,
                      ),
                    ),
                  ],
                ),
            ],
          ),
          Divider(height: 28.pt),
          Wisdom(
            height: 12.pt,
            child: ClipRRect(
              borderRadius: BorderRadius.circular(12.pt),
              child: LinearProgressIndicator(
                backgroundColor: Color(0xffe4e4e4),
                value: (store.person?.yearIndex ?? 0) / 100,
                valueColor: AlwaysStoppedAnimation(
                  colorScheme.danger,
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
