import 'package:flutter/material.dart';

import 'color_manager.dart';
import 'font_manager.dart';

abstract class ThemeManager {
  static bool isDarkTheme = false;

  static ThemeData selectTheme() => isDarkTheme ? darkTheme : lightTheme;
  static ThemeData lightTheme = ThemeData(
    ///main colors
    primaryColor: ColorsManager.primaryColor,
    colorScheme: const ColorScheme(
      background: ColorsManager.backgroundColor,
      brightness: Brightness.light,
      primary: ColorsManager.primaryColor,
      onPrimary: ColorsManager.onPrimaryColor,
      secondary: ColorsManager.secondaryColor,
      onSecondary: ColorsManager.onSecondaryColor,
      error: Colors.red,
      onError: Colors.white,
      onBackground: ColorsManager.textPrimaryColor,
      surface: Colors.white,
      onSurface: ColorsManager.textPrimaryColor,
    ),
    scaffoldBackgroundColor: Colors.white,

    ///text theme
    textTheme: const TextTheme(
      ///display
      displayLarge: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s35,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      displayMedium: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s20,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      displaySmall: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s16,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),

      ///title
      titleLarge: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s48,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      titleMedium: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s30,
        fontWeight: FontsManager.bold,
        color: ColorsManager.textPrimaryColor,
      ),
      titleSmall: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s25,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),

      ///body
      bodyLarge: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s18,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      bodyMedium: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s14,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      bodySmall: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s12,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),

      labelLarge: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s18,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      labelMedium: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s16,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      labelSmall: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s14,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
    ),

    ///button theme
    // buttonTheme: ButtonThemeData(
    //     buttonColor: ColorsManager.primaryLightColor,
    //     padding: const EdgeInsets.symmetric(horizontal: AppPadding.p8),
    //     textTheme: ButtonTextTheme.primary,
    //     hoverColor: ColorsManager.primaryDarkColor,
    //     shape: RoundedRectangleBorder(
    //       borderRadius: BorderRadius.circular(AppRadius.r4),
    //     ),),
    //
    // textButtonTheme: TextButtonThemeData(
    //   style: ButtonStyle(
    //     backgroundColor:
    //         MaterialStateProperty.all<Color>(ColorsManager.primaryLightColor),
    //     padding: MaterialStateProperty.all<EdgeInsets>(
    //         const EdgeInsets.all(AppPadding.p8),),
    //     textStyle: MaterialStateProperty.all<TextStyle>(
    //       const TextStyle(
    //         fontFamily: FontsManager.fontFamily,
    //         fontSize: FontSize.s16,
    //         fontWeight: FontsManager.regular,
    //         color: ColorsManager.onPrimaryLightColor,
    //       ),
    //     ),
    //     // shape: MaterialStateProperty.all<OutlinedBorder>(
    //     //   RoundedRectangleBorder(
    //     //     borderRadius: BorderRadius.circular(AppRadius.r4),
    //     //     side: const BorderSide(color: Colors.grey),
    //     //   ),
    //     // ),
    //   ),
    // ),

    dropdownMenuTheme: const DropdownMenuThemeData(
      textStyle: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s16,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      inputDecorationTheme: InputDecorationTheme(
        border: OutlineInputBorder(
          borderRadius: BorderRadius.all(Radius.circular(20)),
        ),
        enabledBorder: OutlineInputBorder(
          borderSide: BorderSide(color: Colors.grey),
          borderRadius: BorderRadius.all(Radius.circular(8)),
        ),
        focusedBorder: OutlineInputBorder(
          borderSide: BorderSide(color: ColorsManager.primaryColor),
          borderRadius: BorderRadius.all(Radius.circular(8)),
        ),
        labelStyle: TextStyle(
          fontFamily: FontsManager.fontFamily,
          color: Colors.grey,
          fontSize: FontSize.s16,
          fontWeight: FontsManager.regular,
        ),
      ),
      menuStyle: MenuStyle(
        backgroundColor: MaterialStatePropertyAll(Colors.white),
        padding: MaterialStatePropertyAll(EdgeInsets.all(8)),
      ),
    ),

    ///input decoration theme
    inputDecorationTheme: InputDecorationTheme(
      enabledBorder: OutlineInputBorder(
        borderSide: BorderSide.none,
        borderRadius: BorderRadius.circular(20),
      ),
      focusedBorder: OutlineInputBorder(
        borderSide: BorderSide.none,
        borderRadius: BorderRadius.circular(20),
      ),
      focusedErrorBorder: OutlineInputBorder(
        borderSide: BorderSide.none,
        borderRadius: BorderRadius.circular(20),
      ),
      errorBorder: OutlineInputBorder(
          borderRadius: BorderRadius.circular(20),
          borderSide: const BorderSide(color: Colors.red)),
      hintStyle: const TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s14,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      filled: true,
      fillColor: Colors.white,
      contentPadding: const EdgeInsets.all(10),
      labelStyle: const TextStyle(
        fontFamily: FontsManager.fontFamily,
        color: Colors.grey,
        fontSize: FontSize.s16,
        fontWeight: FontsManager.regular,
      ),
    ),

    ///card theme
    cardTheme: const CardTheme(
      elevation: 0,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(20)),
      ),
    ),
  );

  //TODO implement dark theme
  static ThemeData darkTheme = ThemeData(
    ///main colors
    primaryColor: ColorsManager.primaryColor,
    colorScheme: const ColorScheme(
      background: ColorsManager.backgroundColor,
      brightness: Brightness.light,
      primary: ColorsManager.primaryColor,
      onPrimary: ColorsManager.onPrimaryColor,
      secondary: ColorsManager.secondaryColor,
      onSecondary: ColorsManager.onSecondaryColor,
      error: Colors.red,
      onError: Colors.white,
      onBackground: ColorsManager.textPrimaryColor,
      surface: Colors.white,
      onSurface: ColorsManager.textPrimaryColor,
    ),
    scaffoldBackgroundColor: Colors.white,

    ///text theme
    textTheme: const TextTheme(
      ///display
      displayLarge: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s35,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      displayMedium: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s20,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      displaySmall: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s16,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),

      ///title
      titleLarge: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s48,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      titleMedium: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s30,
        fontWeight: FontsManager.bold,
        color: ColorsManager.textPrimaryColor,
      ),
      titleSmall: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s25,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),

      ///body
      bodyLarge: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s18,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      bodyMedium: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s14,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      bodySmall: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s12,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),

      labelLarge: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s18,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      labelMedium: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s16,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
      labelSmall: TextStyle(
        fontFamily: FontsManager.fontFamily,
        fontSize: FontSize.s14,
        fontWeight: FontsManager.regular,
        color: ColorsManager.textPrimaryColor,
      ),
    ),

    ///button theme
    // buttonTheme: ButtonThemeData(
    //     buttonColor: ColorsManager.primaryLightColor,
    //     padding: const EdgeInsets.symmetric(horizontal: AppPadding.p8),
    //     textTheme: ButtonTextTheme.primary,
    //     hoverColor: ColorsManager.primaryDarkColor,
    //     shape: RoundedRectangleBorder(
    //       borderRadius: BorderRadius.circular(AppRadius.r4),
    //     ),),
    //
    // textButtonTheme: TextButtonThemeData(
    //   style: ButtonStyle(
    //     backgroundColor:
    //         MaterialStateProperty.all<Color>(ColorsManager.primaryLightColor),
    //     padding: MaterialStateProperty.all<EdgeInsets>(
    //         const EdgeInsets.all(AppPadding.p8),),
    //     textStyle: MaterialStateProperty.all<TextStyle>(
    //       const TextStyle(
    //         fontFamily: FontsManager.fontFamily,
    //         fontSize: FontSize.s16,
    //         fontWeight: FontsManager.regular,
    //         color: ColorsManager.onPrimaryLightColor,
    //       ),
    //     ),
    //     // shape: MaterialStateProperty.all<OutlinedBorder>(
    //     //   RoundedRectangleBorder(
    //     //     borderRadius: BorderRadius.circular(AppRadius.r4),
    //     //     side: const BorderSide(color: Colors.grey),
    //     //   ),
    //     // ),
    //   ),
    // ),

    ///input decoration theme
    inputDecorationTheme: const InputDecorationTheme(
      border: OutlineInputBorder(
        borderRadius: BorderRadius.all(Radius.circular(8)),
      ),
      enabledBorder: OutlineInputBorder(
        borderSide: BorderSide(color: Colors.grey),
        borderRadius: BorderRadius.all(Radius.circular(8)),
      ),
      focusedBorder: OutlineInputBorder(
        borderSide: BorderSide(color: ColorsManager.primaryColor),
        borderRadius: BorderRadius.all(Radius.circular(8)),
      ),
      labelStyle: TextStyle(
        fontFamily: FontsManager.fontFamily,
        color: Colors.grey,
        fontSize: FontSize.s16,
        fontWeight: FontsManager.regular,
      ),
    ),

    ///card theme
    //TODO edit card theme
    cardTheme: const CardTheme(
      elevation: 0,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(20)),
      ),
    ),
  );
}
