from typing import Optional, override

from flut.flutter.widgets.framework import Widget


class Scaffold(Widget):

    def __init__(
        self,
        *,
        key=None,
        appBar: Optional[Widget] = None,
        body: Optional[Widget] = None,
        floatingActionButton: Optional[Widget] = None,
        backgroundColor=None,
    ):
        super().__init__("Scaffold", key=key)
        self.appBar = appBar
        self.body = body
        self.floatingActionButton = floatingActionButton
        self.backgroundColor = backgroundColor

    @override
    def _flut_pack(self) -> dict:
        result = self._flut_base_props()
        if self.appBar is not None:
            result["appBar"] = self.appBar._flut_pack()
        if self.body is not None:
            result["body"] = self.body._flut_pack()
        if self.floatingActionButton is not None:
            result["floatingActionButton"] = self.floatingActionButton._flut_pack()
        if self.backgroundColor is not None:
            result["backgroundColor"] = self.backgroundColor._flut_pack()
        return result
