import 'package:collection/collection.dart';

/// 首页Tab类型
enum MainTab {
  /// 键盘
  keyBoard(0, "keyBoard"),

  /// 人设
  character(1, "character"),

  /// 我的
  mine(2, "mine");

  /// Tab对应页面的索引
  final int tabIndex;

  /// Tab的名字
  final String tabName;

  const MainTab(this.tabIndex, this.tabName);

  /// 根据名称，获取Tab枚举
  static MainTab? fromTabName(String tabName) {
    return MainTab.values.firstWhereOrNull(
      (element) => element.tabName == tabName,
    );
  }
}
