from typing import Optional, override

from flut.flutter.widgets.framework import Widget


class InkWell(Widget):
    def __init__(self, *, key=None, onTap=None, child: Optional[Widget] = None):
        super().__init__("InkWell", key=key)
        self.onTap = onTap
        self.child = child

    @override
    def _flut_pack(self) -> dict:
        result = self._flut_base_props()
        if self.onTap is not None:
            result["onTapId"] = self._register_action(self.onTap)
        if self.child is not None:
            result["child"] = self.child._flut_pack()
        return result
