import 'dart:io'; import 'dart:ui'; import 'package:fikoyt_ui/fikoyt_ui.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; class FikoYTCard extends StatelessWidget { const FikoYTCard({super.key, children, theme}) : children = children ?? const [], theme = theme ?? FikoYTCardTheme(); final List children; FikoYTButtonTheme? theme; @override Widget build(BuildContext context) { return Container( margin: const EdgeInsets.all(5.0), decoration: BoxDecoration( color: Theme.of(context).extension()?.cardBackgroundColor, //Colors.white, borderRadius: const BorderRadius.all( Radius.circular(5), ), boxShadow: [ BoxShadow( color: Theme.of(context).extension()!.shadowColor!, offset: const Offset(0, 0), spreadRadius: -1, blurRadius: 5.0, blurStyle: BlurStyle.outer, ), ], // border: Border.all( // color: Theme.of(context).extension()!.cardBackgroundColor!.withAlpha(255), // ), ), child: Column( children: [], ), ); } } class FikoYTCardTheme extends ThemeExtension { FikoYTCardTheme({ this.backgroundColor, this.borderColor, this.radius, BorderRadiusGeometry? borderRadius, this.padding, this.margin, Duration? animationDuration, }); Color? backgroundColor; Color? borderColor; double? radius; Duration? animationDuration; BorderRadiusGeometry? borderRadius; EdgeInsetsGeometry? padding; EdgeInsetsGeometry? margin; @override FikoYTCardTheme copyWith({ Color? backgroundColor, Color? borderColor, double? radius, Duration? animationDuration, BorderRadiusGeometry? borderRadius, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, }) { return FikoYTCardTheme( backgroundColor: backgroundColor ?? this.backgroundColor, animationDuration: animationDuration ?? this.animationDuration, borderRadius: borderRadius ?? this.borderRadius, padding: padding ?? this.padding, margin: margin ?? this.margin, radius: radius ?? this.radius, borderColor: borderColor ?? this.borderColor, ); } @override FikoYTCardTheme lerp(ThemeExtension other, double t) { if (other is! FikoYTCardTheme) { return this; } return FikoYTCardTheme( backgroundColor: Color.lerp(backgroundColor, other.backgroundColor, t), animationDuration: lerpDuration(animationDuration ?? Duration.zero, other.animationDuration ?? Duration.zero, t), borderRadius: BorderRadius.lerp(borderRadius?.resolve(TextDirection.ltr), other.borderRadius?.resolve(TextDirection.ltr), t), padding: EdgeInsets.lerp(padding?.resolve(TextDirection.ltr), other.padding?.resolve(TextDirection.ltr), t), margin: EdgeInsets.lerp(margin?.resolve(TextDirection.ltr), other.margin?.resolve(TextDirection.ltr), t), radius: lerpDouble(radius, other.radius, t), borderColor: Color.lerp(borderColor, other.borderColor, t), ); } }