import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';

class AppTheme {
  static ThemeData getTheme(isArabic) => ThemeData(
        fontFamily: isArabic ? 'CairoArabic' : 'Poppins',
        // fontFamily: 'CairoArabic',
        textTheme: const TextTheme(
          displayLarge: TextStyle(fontFamily: 'CairoArabic'),
          bodyLarge: TextStyle(fontFamily: 'CairoArabic'),
          // Add others as needed
        ),
        primarySwatch: Colors.red,
        visualDensity: VisualDensity.adaptivePlatformDensity,
        brightness: Brightness.light,
        pageTransitionsTheme: const PageTransitionsTheme(
          builders: {TargetPlatform.android: ZoomPageTransitionsBuilder(), TargetPlatform.iOS: CupertinoPageTransitionsBuilder()},
        ),
        hintColor: Colors.grey[400],
        disabledColor: Colors.grey[300],
        textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.grey, selectionColor: Color.fromRGBO(80, 100, 253, 0.5), selectionHandleColor: Colors.grey),
        canvasColor: Colors.white,
        highlightColor: Colors.grey[100]!.withOpacity(0.4),
        splashColor: Colors.transparent,
        bottomSheetTheme: BottomSheetThemeData(backgroundColor: Colors.black.withOpacity(0)),
        floatingActionButtonTheme: const FloatingActionButtonThemeData(highlightElevation: 2, disabledElevation: 0, elevation: 2),
        appBarTheme: AppBarTheme(
          color: const Color(0xff515A5D),
          elevation: 0.0,
          actionsIconTheme: IconThemeData(
            color: Colors.grey[800],
          ),
          systemOverlayStyle: SystemUiOverlayStyle.dark,
          surfaceTintColor: Colors.transparent,
        ),
      );

  static ThemeData getDarkTheme(isArabic) => ThemeData(
        fontFamily: isArabic ? 'CairoArabic' : 'Poppins',
        // fontFamily: 'CairoArabic',
        textTheme: const TextTheme(
          displayLarge: TextStyle(fontFamily: 'CairoArabic'),
          bodyLarge: TextStyle(fontFamily: 'CairoArabic'),
          // Add others as needed
        ),
        primarySwatch: Colors.red,
        visualDensity: VisualDensity.adaptivePlatformDensity,
        brightness: Brightness.dark,
        pageTransitionsTheme: const PageTransitionsTheme(
          builders: {TargetPlatform.android: ZoomPageTransitionsBuilder(), TargetPlatform.iOS: CupertinoPageTransitionsBuilder()},
        ),
        hintColor: Colors.grey[600],
        disabledColor: Colors.grey[700],
        textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.grey, selectionColor: Color.fromRGBO(80, 100, 253, 0.5), selectionHandleColor: Colors.grey),
        canvasColor: AppColors.dark.scaffoldBgColor,
        scaffoldBackgroundColor: AppColors.dark.scaffoldBgColor,
        highlightColor: Colors.grey[800]!.withOpacity(0.4),
        splashColor: Colors.transparent,
        bottomSheetTheme: BottomSheetThemeData(backgroundColor: Colors.black.withOpacity(0)),
        floatingActionButtonTheme: const FloatingActionButtonThemeData(highlightElevation: 2, disabledElevation: 0, elevation: 2),
        appBarTheme: AppBarTheme(
          color: AppColors.dark.scaffoldBgColor,
          elevation: 0.0,
          actionsIconTheme: const IconThemeData(
            color: Colors.white,
          ),
          systemOverlayStyle: SystemUiOverlayStyle.light,
          surfaceTintColor: Colors.transparent,
        ),
      );
}

extension ExtendedRevoCheckTheme on TextTheme {
  //add custom styles and colors here
  //taken from https://medium.com/@crizantlai/flutter-how-to-extend-themedata-b5b987a95bb5
  TextStyle get price => const TextStyle(color: Colors.redAccent);
}
