import 'package:fikoyt_ui/ui/fikoyt_button.dart'; import 'package:fikoyt_ui/ui/themes/table_theme.dart'; import 'package:flutter/material.dart'; extension ThemeDataExtension on ThemeData { TableTheme get tableTheme => extension() ?? TableTheme(); FikoYTButtonTheme get fikoButtonTheme => extension() ?? FikoYTButtonTheme(); } class FikoTheme extends ThemeExtension { final Color? backgroundColor; final Color? cardBackgroundColor; final Color? textColor; final Color? textShadowColor; final Color? successTextColor; final Color? errorTextColor; final Color? warningTextColor; final Color? infoTextColor; final Color? shadowColor; FikoTheme({ this.backgroundColor, this.cardBackgroundColor, this.textColor, this.successTextColor, this.errorTextColor, this.warningTextColor, this.infoTextColor, this.shadowColor, this.textShadowColor, }); @override ThemeExtension copyWith({ Color? backgroundColor, Color? cardBackgroundColor, Color? textColor, Color? successTextColor, Color? errorTextColor, Color? warningTextColor, Color? infoTextColor, Color? shadowColor, Color? textShadowColor, TableTheme? tableTheme, }) { return FikoTheme( backgroundColor: backgroundColor ?? this.backgroundColor, cardBackgroundColor: cardBackgroundColor ?? this.cardBackgroundColor, textColor: textColor ?? this.textColor, successTextColor: successTextColor ?? this.successTextColor, errorTextColor: errorTextColor ?? this.errorTextColor, warningTextColor: warningTextColor ?? this.warningTextColor, infoTextColor: infoTextColor ?? this.infoTextColor, shadowColor: shadowColor ?? this.shadowColor, textShadowColor: textShadowColor ?? this.textShadowColor, ); } @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), textShadowColor: Color.lerp(textShadowColor, other.textShadowColor, t), ); } }