from typing import override

from .framework import Widget


class Visibility(Widget):
    def __init__(
        self,
        *,
        key=None,
        visible: bool = True,
        child,
    ):
        super().__init__("Visibility", key=key)
        self.visible = visible
        self.child = child

    @override
    def _flut_pack(self) -> dict:
        result = self._flut_base_props()
        result["visible"] = self.visible
        result["child"] = self.child._flut_pack()
        return result
