import 'package:fikoyt_ui/ui/fiko_button.dart'; import 'package:fikoyt_ui/ui/themes/table_theme.dart'; import 'package:flutter/material.dart'; // class FikoTheme { // final BuildContext? context; // FikoTheme(this.context); // static FikoTheme? instance; // static FikoTheme of(BuildContext context) { // if (instance != null) { // return instance ?? FikoTheme(context); // } else { // instance = FikoTheme(context); // return instance ?? FikoTheme(context); // } // } // ThemeData get acikTema { // return FikoYTLightTheme(); // } // ThemeData get koyuTema { // return FikoytDarkTheme(); // } // bool get koyuMod { // // return true; // return SchedulerBinding.instance.platformDispatcher.platformBrightness == Brightness.dark; // } // static bool get koyuModStatic { // // return true; // return SchedulerBinding.instance.platformDispatcher.platformBrightness == Brightness.dark; // } // ThemeData get aktifTema { // if (koyuMod) { // return koyuTema; // } else { // return acikTema; // } // } // Color get yaziRenk { // if (koyuMod) { // return Colors.white70; // } else { // return Colors.black87; // } // } // Color get uygulamaArkaPlanRenk { // if (koyuMod) { // return Colors.grey.shade900; // } else { // return Colors.grey.shade200; // } // } // FikoButtonTheme get fikoButonTema { // if (koyuMod) { // return FikoButtonTheme(textColor: Colors.white, backgroundColor: Colors.transparent, radius: 0, borderRadius: BorderRadius.circular(15)); // } else { // return FikoButtonTheme(textColor: Colors.black, backgroundColor: Colors.transparent, radius: 0, borderRadius: BorderRadius.circular(15)); // } // } // Color get cardBackgroundColor { // if (koyuMod) { // return Colors.teal.withAlpha(70); // } else { // return Colors.white; // } // } // TextStyle get kartBaslikStil { // if (koyuMod) { // return TextStyle(fontSize: 14, color: Colors.teal.shade50); // } else { // return TextStyle(fontSize: 14, color: Colors.teal.shade900); // } // } // Color get kartBaslikRenk { // if (koyuMod) { // return Colors.white; // } else { // return Colors.black38; // } // } // Color get saatTabloBaslikRenk { // if (koyuMod) { // return Colors.blue.shade200; // } else { // return Colors.blue.shade400; // } // } // Color get saatTabloVeriArkaPlanRenk { // if (koyuMod) { // return Colors.teal.withAlpha(70); // } else { // return Colors.grey.shade200; // } // } // Color get tabloBaslikYaziRenk { // if (koyuMod) { // return Colors.white; // } else { // return Colors.white; // } // } // Color get tabloBaslikRenk { // if (koyuMod) { // return Colors.blue.shade300; // } else { // return Colors.blue.shade400; // } // } // Color get tabloVeriArkaPlanRenk { // if (koyuMod) { // return Colors.tealAccent.withAlpha(30); // } else { // return Colors.tealAccent.withAlpha(30); // } // } // Color get bilgiSatiriArkaPlanRenk { // if (koyuMod) { // return Colors.yellow.withAlpha(100); // } else { // return Colors.yellow.withAlpha(70); // } // } // Color get bilgiSatiriYaziRenk { // if (koyuMod) { // return Colors.white; // } else { // return Colors.blue.withAlpha(200); // } // } // Color get tabloHataliYaziRenk { // if (koyuMod) { // return Colors.red.shade300; // } else { // return Colors.red; // } // } // Color get tabloGecerliYaziRenk { // if (koyuMod) { // return Colors.green.shade200; // } else { // return Colors.green; // } // } // } extension ThemeDataExtension on ThemeData { TableTheme get tableTheme => extension() ?? TableTheme(); FikoButtonTheme get fikoButtonTheme => extension() ?? FikoButtonTheme(); } class FikoTheme extends ThemeExtension { final Color? backgroundColor; final Color? cardBackgroundColor; final Color? textColor; final Color? successTextColor; final Color? errorTextColor; final Color? shadowColor; FikoTheme({ this.backgroundColor, this.cardBackgroundColor, this.textColor, this.successTextColor, this.errorTextColor, this.shadowColor, }); @override ThemeExtension copyWith({ Color? backgroundColor, Color? cardBackgroundColor, Color? textColor, Color? successTextColor, Color? errorTextColor, Color? shadowColor, TableTheme? tableTheme, }) { return FikoTheme( backgroundColor: backgroundColor ?? this.backgroundColor, cardBackgroundColor: cardBackgroundColor ?? this.cardBackgroundColor, textColor: textColor ?? this.textColor, successTextColor: successTextColor ?? this.successTextColor, errorTextColor: errorTextColor ?? this.errorTextColor, shadowColor: shadowColor ?? this.shadowColor, ); } @override ThemeExtension lerp(covariant ThemeExtension? other, double t) { if (other is! FikoTheme) { return this; } return FikoTheme( backgroundColor: Color.lerp(backgroundColor, other.backgroundColor, t), cardBackgroundColor: Color.lerp(cardBackgroundColor, other.cardBackgroundColor, t), textColor: Color.lerp(textColor, other.textColor, t), successTextColor: Color.lerp(successTextColor, other.successTextColor, t), errorTextColor: Color.lerp(errorTextColor, other.errorTextColor, t), shadowColor: Color.lerp(shadowColor, other.shadowColor, t), ); } }