import 'dart:ui'; import 'package:flutter/material.dart'; class FikoytOvalResim extends StatelessWidget { final String resimUrl; final FikoYTOvalResimTheme? tema; const FikoytOvalResim({super.key, required this.resimUrl, this.tema}); @override Widget build(BuildContext context) { return Center( child: Stack( alignment: Alignment.center, children: [ CircleAvatar( backgroundColor: tema?.borderColor ?? Theme.of(context).extension()?.borderColor ?? Colors.green.shade700, radius: (tema?.radius ?? Theme.of(context).extension()?.radius ?? 54) + (tema?.spacing ?? Theme.of(context).extension()?.spacing ?? 10.0), //CircleAvatar ), CircleAvatar( backgroundColor: tema?.backgroundColor ?? Theme.of(context).extension()?.backgroundColor ?? Colors.grey.shade200, radius: (tema?.radius ?? Theme.of(context).extension()?.radius ?? 54), child: ClipOval( child: Stack( alignment: Alignment.center, children: [ Positioned( top: -3, left: -3, right: -3, bottom: -3, child: Image.network( resimUrl, fit: BoxFit.cover, loadingBuilder: (context, child, loadingProgress) { if (loadingProgress == null) return child; return Center( child: CircularProgressIndicator( value: loadingProgress.expectedTotalBytes != null ? loadingProgress.cumulativeBytesLoaded / (loadingProgress.expectedTotalBytes ?? 0).toDouble() : null, ), ); }, ), ), ], ), ), ), ], ), //CircleAvatar ); } } class FikoYTOvalResimTheme extends ThemeExtension { FikoYTOvalResimTheme({ this.backgroundColor, this.borderColor, this.shadowColor, this.radius, this.spacing, this.elevation, }); Color? backgroundColor; Color? borderColor; Color? shadowColor; double? radius; double? spacing; double? elevation; @override FikoYTOvalResimTheme copyWith({ Color? backgroundColor, Color? borderColor, Color? shadowColor, double? radius, double? spacing, double? elevation, }) { return FikoYTOvalResimTheme( backgroundColor: backgroundColor ?? this.backgroundColor, radius: radius ?? this.radius, spacing: spacing ?? this.spacing, elevation: elevation ?? this.elevation, borderColor: borderColor ?? this.borderColor, shadowColor: shadowColor ?? this.shadowColor, ); } @override FikoYTOvalResimTheme lerp(ThemeExtension other, double t) { if (other is! FikoYTOvalResimTheme) { return this; } return FikoYTOvalResimTheme( backgroundColor: Color.lerp(backgroundColor, other.backgroundColor, t), radius: lerpDouble(radius, other.radius, t), spacing: lerpDouble(spacing, other.spacing, t), elevation: lerpDouble(elevation, other.elevation, t), borderColor: Color.lerp(borderColor, other.borderColor, t), shadowColor: Color.lerp(shadowColor, other.shadowColor, t), ); } }