import 'dart:ui'; import 'package:flutter/material.dart'; class FikoYTDrawer extends StatelessWidget { final List childs; final double? elevation; final double? width; final ShapeBorder? shape; final Color? backgroundColor; final Color? shadowColor; final Color? surfaceTintColor; const FikoYTDrawer({ super.key, required this.childs, this.elevation, this.width, this.shape, this.backgroundColor, this.shadowColor, this.surfaceTintColor, }); @override Widget build(BuildContext context) { return SafeArea( child: Drawer( elevation: elevation ?? 16.0, // Varsayılan yükseklik width: width ?? 250.0, // Varsayılan genişlik shape: shape ?? RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(right: Radius.circular(16.0))), backgroundColor: backgroundColor ?? Colors.white.withAlpha(155), shadowColor: shadowColor, surfaceTintColor: surfaceTintColor, child: Column(children: childs), ), ); } } class FikoYTDrawerTheme extends ThemeExtension { final double? elevation; final Color? titleBackgroundColor; final Color? dataTextColor; final Color? dataErrorTextColor; final Color? dataSuccesTextColor; final Color? dataBackgroundColor; final Color? infoBackgroundColor; final Color? infoTextColor; FikoYTDrawerTheme({ this.elevation, this.dataTextColor, this.titleBackgroundColor, this.dataBackgroundColor, this.dataSuccesTextColor, this.dataErrorTextColor, this.infoBackgroundColor, this.infoTextColor, }); @override ThemeExtension copyWith({ double? elevation, Color? titleBackgroundColor, Color? dataTextColor, Color? dataSuccesTextColor, Color? dataErrorTextColor, Color? dataBackgroundColor, Color? infoBackgroundColor, Color? infoTextColor, }) { return FikoYTDrawerTheme( elevation: elevation ?? this.elevation, titleBackgroundColor: titleBackgroundColor ?? this.titleBackgroundColor, dataTextColor: dataTextColor ?? this.dataTextColor, dataSuccesTextColor: dataSuccesTextColor ?? this.dataSuccesTextColor, dataErrorTextColor: dataErrorTextColor ?? this.dataErrorTextColor, dataBackgroundColor: dataBackgroundColor ?? this.dataBackgroundColor, infoBackgroundColor: infoBackgroundColor ?? this.infoBackgroundColor, infoTextColor: infoTextColor ?? this.infoTextColor, ); } @override ThemeExtension lerp(covariant ThemeExtension? other, double t) { if (other is! FikoYTDrawerTheme) { return this; } return FikoYTDrawerTheme( elevation: lerpDouble(elevation, other.elevation, t), titleBackgroundColor: Color.lerp(titleBackgroundColor, other.titleBackgroundColor, t), dataTextColor: Color.lerp(dataTextColor, other.dataTextColor, t), dataSuccesTextColor: Color.lerp(dataSuccesTextColor, other.dataSuccesTextColor, t), dataErrorTextColor: Color.lerp(dataErrorTextColor, other.dataErrorTextColor, t), dataBackgroundColor: Color.lerp(dataBackgroundColor, other.dataBackgroundColor, t), infoBackgroundColor: Color.lerp(infoBackgroundColor, other.infoBackgroundColor, t), infoTextColor: Color.lerp(infoTextColor, other.infoTextColor, t), ); } }