import 'package:fis_i18n/i18n.dart';
import 'package:flutter/material.dart';
import 'package:fis_ui/index.dart';

/// 通用组件
class CommonWidgets {
  /// 设备异常提示
  static FWidget deviceUnavailableTip() {
    return FRow(
      children: [
        FText(
          i18nBook.setting.deviceError.t,
          style: TextStyle(fontSize: 14, color: Colors.red, height: 1),
        ),
        FSizedBox(
          width: 5,
        ),
        FIcon(
          Icons.highlight_off_rounded,
          color: Colors.red,
          size: 19,
        ),
      ],
    );
  }

  /// 设备正常提示
  static FWidget deviceAvailableTip() {
    return FRow(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        FText(
          i18nBook.setting.deviceNormal.t,
          style: TextStyle(fontSize: 14, color: Colors.green, height: 1),
        ),
        FSizedBox(
          width: 5,
        ),
        FIcon(
          Icons.check_circle_outline,
          color: Colors.green,
          size: 19,
        ),
      ],
    );
  }

  /// 正在搜索设备提示
  static FWidget deviceFindingTip() {
    return FContainer(
      width: i18nBook.isCurrentChinese ? 250 : 280,
      height: 30,
      child: FCenter(
        child: FRow(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            FContainer(
              width: 12,
              height: 12,
              child: FCircularProgressIndicator(
                strokeWidth: 1,
                valueColor: AlwaysStoppedAnimation(Colors.grey),
              ),
            ),
            FSizedBox(
              width: 5,
            ),
            FText(
              i18nBook.setting.searchingForDevice.t,
              style: TextStyle(fontSize: 14, color: Colors.grey, height: 1),
            ),
          ],
        ),
      ),
    );
  }

  /// 找不到设备提示
  static FWidget deviceNotFoundTip() {
    return FContainer(
      width: 250,
      height: 30,
      child: FText(
        i18nBook.setting.noAvailableDevice.t,
        style: TextStyle(fontSize: 18, color: Colors.grey, height: 1),
      ),
    );
  }
}
