import 'package:flutter/material.dart';
import 'package:sefer_driver/constant/style.dart';
import '../../constant/colors.dart';

ThemeData _createTheme({
  required Brightness brightness,
  required String fontFamily,
  required Color scaffoldBackgroundColor,
  required Color cardColor,
  required Color dividerColor,
}) {
  return ThemeData(
    brightness: brightness,
    fontFamily: fontFamily,
    scaffoldBackgroundColor: scaffoldBackgroundColor,
    cardColor: cardColor,
    dividerColor: dividerColor,
    primaryColor: AppColor.primaryColor,
    colorScheme: ColorScheme.fromSeed(
      seedColor: AppColor.primaryColor,
      brightness: brightness,
      primary: AppColor.primaryColor,
      surface: cardColor,
      background: scaffoldBackgroundColor,
      error: AppColor.redColor,
    ),
    textTheme: TextTheme(
      displaySmall: AppStyle.title.copyWith(color: AppColor.writeColor),
      displayLarge: AppStyle.headTitle.copyWith(color: AppColor.writeColor),
      displayMedium: AppStyle.headTitle2.copyWith(color: AppColor.writeColor),
      bodyLarge: AppStyle.title.copyWith(color: AppColor.writeColor),
      bodyMedium: AppStyle.subtitle.copyWith(color: AppColor.writeColor),
      titleLarge: AppStyle.headTitle2.copyWith(color: AppColor.writeColor),
    ),
    appBarTheme: AppBarTheme(
      elevation: 0,
      backgroundColor: scaffoldBackgroundColor,
      centerTitle: true,
      iconTheme: const IconThemeData(color: AppColor.primaryColor),
      titleTextStyle: AppStyle.headTitle2.copyWith(color: AppColor.writeColor),
    ),
    dialogTheme: DialogThemeData(
      backgroundColor: cardColor,
      contentTextStyle: AppStyle.title.copyWith(color: AppColor.writeColor),
      titleTextStyle: AppStyle.headTitle2.copyWith(color: AppColor.writeColor),
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
    ),
    cardTheme: CardThemeData(
      color: cardColor,
      elevation: 2,
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
    ),
    dividerTheme: DividerThemeData(
      color: dividerColor,
      thickness: 1,
    ),
  );
}

ThemeData lightThemeEnglish = _createTheme(
  brightness: Brightness.light,
  fontFamily: "SFPro",
  scaffoldBackgroundColor: Colors.white,
  cardColor: Colors.white,
  dividerColor: Colors.black12,
);

ThemeData darkThemeEnglish = _createTheme(
  brightness: Brightness.dark,
  fontFamily: "SFPro",
  scaffoldBackgroundColor: const Color(0xFF121212),
  cardColor: const Color(0xFF1E1E1E),
  dividerColor: Colors.white10,
);

ThemeData lightThemeArabic = _createTheme(
  brightness: Brightness.light,
  fontFamily: 'SFArabic',
  scaffoldBackgroundColor: Colors.white,
  cardColor: Colors.white,
  dividerColor: Colors.black12,
);

ThemeData darkThemeArabic = _createTheme(
  brightness: Brightness.dark,
  fontFamily: 'SFArabic',
  scaffoldBackgroundColor: const Color(0xFF121212),
  cardColor: const Color(0xFF1E1E1E),
  dividerColor: Colors.white10,
);
