from typing import Optional, override

from flut.flutter.widgets.framework import Widget


class CircularProgressIndicator(Widget):
    def __init__(
        self,
        *,
        key=None,
        color=None,
        strokeWidth: Optional[float] = None,
    ):
        super().__init__("CircularProgressIndicator", key=key)
        self.color = color
        self.strokeWidth = strokeWidth

    @override
    def _flut_pack(self) -> dict:
        result = self._flut_base_props()
        if self.color is not None:
            result["color"] = self.color._flut_pack()
        if self.strokeWidth is not None:
            result["strokeWidth"] = self.strokeWidth
        return result


class LinearProgressIndicator(Widget):
    def __init__(
        self,
        *,
        key=None,
        value: Optional[float] = None,
        backgroundColor=None,
        color=None,
        minHeight: Optional[float] = None,
        borderRadius=None,
    ):
        super().__init__("LinearProgressIndicator", key=key)
        self.value = value
        self.backgroundColor = backgroundColor
        self.color = color
        self.minHeight = minHeight
        self.borderRadius = borderRadius

    @override
    def _flut_pack(self) -> dict:
        result = self._flut_base_props()
        if self.value is not None:
            result["value"] = self.value
        if self.backgroundColor is not None:
            result["backgroundColor"] = self.backgroundColor._flut_pack()
        if self.color is not None:
            result["color"] = self.color._flut_pack()
        if self.minHeight is not None:
            result["minHeight"] = self.minHeight
        if self.borderRadius is not None:
            result["borderRadius"] = self.borderRadius._flut_pack()
        return result
