You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.3 KiB
38 lines
1.3 KiB
import 'package:hadi_hoda_flutter/core/utils/context_provider.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:hadi_hoda_flutter/common_ui/resources/my_colors.dart';
|
|
|
|
enum ColorsName { primaryColor, noColor, backgroundDialog }
|
|
|
|
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<ColorsName, Color> get lightColors => {
|
|
ColorsName.noColor: MyColors.transparent,
|
|
ColorsName.primaryColor: MyColors.white,
|
|
ColorsName.backgroundDialog: MyColors.purple,
|
|
};
|
|
|
|
static Map<ColorsName, Color> get darkColors => {
|
|
ColorsName.noColor: MyColors.transparent,
|
|
ColorsName.primaryColor: MyColors.black,
|
|
ColorsName.backgroundDialog: MyColors.purple,
|
|
};
|
|
}
|
|
|
|
extension ThemeExtension on BuildContext {
|
|
Map<ColorsName, Color> get customColors =>
|
|
Theme.of(ContextProvider.context!).brightness == Brightness.dark
|
|
? MyTheme.darkColors
|
|
: MyTheme.lightColors;
|
|
|
|
Color get primaryColor => customColors[ColorsName.primaryColor]!;
|
|
Color get noColor => customColors[ColorsName.noColor]!;
|
|
Color get backgroundDialog => customColors[ColorsName.backgroundDialog]!;
|
|
}
|