/*
 * @Author: ChenYaJin
 * @Date: 2023-04-12 10:20:34
 * @LastEditors: ChenYaJin
 * @LastEditTime: 2023-04-13 16:12:56
 * @Description: 点位/区域 tab切换
 */

part of '../view.dart';

// class TabBarComponent extends StatelessWidget {
class _TabBarComponent extends StatefulWidget {
  _TabBarComponent({Key? key}) : super(key: key);

  @override
  State<_TabBarComponent> createState() => __TabBarComponentState();
}

class __TabBarComponentState extends State<_TabBarComponent> {
  @override
  Widget build(BuildContext context) {
    IndexPageStore store = Provider.of(context, listen: true);

    final style = WTheme.of(context);
    final colorScheme = style.colorScheme;

    return Observer(builder: (context) {
      return Wisdom.row(
      color: Colors.white,
      borderRadius: BorderRadius.circular(13.pt),
      border: Border.all(color: colorScheme.primary, width: 1.pt),
      margin: EdgeInsets.symmetric(horizontal: 70.pt, vertical: 5.pt),
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Wisdom(
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(12.pt),
            bottomLeft: Radius.circular(12.pt),
          ),
          onTap: () => store.onRepairTab(0),
          alignment: Alignment.center,
         color: store.isRepair ? null : colorScheme.primary,
          padding: EdgeInsets.symmetric(vertical: 6.pt),
          child: Text(
            '报事处理',
            style: TextStyle(
              fontSize: 15.pt,
              fontWeight: FontWeight.w300,
              color: store.isRepair ? colorScheme.primary : Colors.white,
            ),
          ),
        ).asExpanded(),
        Wisdom(
            borderRadius: BorderRadius.only(
              topRight: Radius.circular(12.pt),
              bottomRight: Radius.circular(12.pt),
            ),
            onTap: () => store.onRepairTab(1),
            alignment: Alignment.center,
            color: store.isRepair ? colorScheme.primary : null,
            padding: EdgeInsets.symmetric(vertical: 6.pt),
            child: Text(
              '报修处理',
              style: TextStyle(
                fontSize: 15.pt,
                fontWeight: FontWeight.w300,
                color:
                    store.isRepair ? Colors.white : colorScheme.primary,
              ),
            ),
          ).asExpanded(),
      ],
    );
    },);
  }
}
