from typing import Optional, override

from flut.flutter.widgets.framework import Widget


class CircleAvatar(Widget):
    def __init__(
        self,
        *,
        key=None,
        backgroundColor=None,
        foregroundColor=None,
        radius: Optional[float] = None,
        minRadius: Optional[float] = None,
        maxRadius: Optional[float] = None,
        child: Optional[Widget] = None,
    ):
        super().__init__("CircleAvatar", key=key)
        self.backgroundColor = backgroundColor
        self.foregroundColor = foregroundColor
        self.radius = radius
        self.minRadius = minRadius
        self.maxRadius = maxRadius
        self.child = child

    @override
    def _flut_pack(self) -> dict:
        result = self._flut_base_props()
        if self.backgroundColor is not None:
            result["backgroundColor"] = self.backgroundColor._flut_pack()
        if self.foregroundColor is not None:
            result["foregroundColor"] = self.foregroundColor._flut_pack()
        if self.radius is not None:
            result["radius"] = self.radius
        if self.minRadius is not None:
            result["minRadius"] = self.minRadius
        if self.maxRadius is not None:
            result["maxRadius"] = self.maxRadius
        if self.child is not None:
            result["child"] = self.child._flut_pack()
        return result
