import 'package:flutter/material.dart'; import 'package:shia_game_flutter/common_ui/resources/my_colors.dart'; import 'package:get/get.dart'; enum ColorsName { primaryColor, noColor, backgroundColor, battleLeagueBackgroundColor, } class MyTheme { static const MyTheme _i = MyTheme._internal(); const MyTheme._internal(); factory MyTheme() => _i; static final ThemeData light = ThemeData(brightness: Brightness.light); static final ThemeData dark = ThemeData(brightness: Brightness.dark); static Map get lightColors => { ColorsName.primaryColor: MyColors.white, ColorsName.noColor: MyColors.transparent, ColorsName.backgroundColor: MyColors.backgroundColor, ColorsName.battleLeagueBackgroundColor: MyColors.battleLeagueBackgroundColor, }; static Map get darkColors => { ColorsName.primaryColor: MyColors.white, ColorsName.noColor: MyColors.transparent, ColorsName.backgroundColor: MyColors.backgroundColor, ColorsName.battleLeagueBackgroundColor: MyColors.battleLeagueBackgroundColor, }; } extension ThemeExtension on BuildContext { Map get customColors => Get.isDarkMode ? MyTheme.darkColors : MyTheme.lightColors; Color get primaryColor => customColors[ColorsName.primaryColor]!; Color get noColor => customColors[ColorsName.noColor]!; Color get backgroundColor => customColors[ColorsName.backgroundColor]!; Color get battleLeagueBackgroundColor => customColors[ColorsName.battleLeagueBackgroundColor]!; }