panel method

Widget panel({
  1. dynamic component,
  2. dynamic allComponents,
})

Implementation

Widget panel({var component, var allComponents}) {
  double width =
      (component["cssClass"] != null && component["cssClass"] != "")
          ? SwitchCase().componentWidthSC(
              component["cssClass"],
              {
                "layout_1by8_col": Get.width * 0.12,
                "layout_1_col": Get.width * 0.25,
                "layout_2_col": Get.width * 0.5,
                "layout_3_col": Get.width * 0.75,
                "layout_4_col": Get.width,
              },
              Get.width)
          : Get.width;
  return Container(
    margin: const EdgeInsets.all(30),
    width: width,
    child: Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: [
        Container(
          decoration: const BoxDecoration(
              color: Palette.panelStripColor,
              borderRadius: BorderRadius.only(
                  topLeft: Radius.circular(panelBorderRadius),
                  topRight: Radius.circular(panelBorderRadius))),
          child: Padding(
            padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Expanded(
                  child: Text(
                      capitalizeFirstofEach(
                              text: component["label"] ?? "Panel")
                          .replaceAll('"', ''),
                      style: panelLabelStyle),
                ),
                AltComponent().altComponentHelpText(component: component)
              ],
            ),
          ),
        ),
        Container(
            decoration: const BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.only(
                    bottomLeft: Radius.circular(panelBorderRadius),
                    bottomRight: Radius.circular(panelBorderRadius))),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Container(
                  padding: const EdgeInsets.all(20),
                  child: Wrap(
                    crossAxisAlignment: WrapCrossAlignment.start,
                    spacing: panelComponentsHorizontalSpacing,
                    runSpacing: panelComponentsVerticalSpacing,
                    children: [
                      for (var comp in component["componentList"]!)
                        if (comp["security"] != null &&
                            comp["security"]["viewable"] == true)
                          SwitchCase().altComponentSC(
                              comp["controlType"],
                              {
                                "TEXTFIELD": WidgetsParser().txtField(
                                    component: comp, parentWidth: width),
                                "BUTTON": WidgetsParser().button(
                                    component: comp,
                                    parentWidth: width,
                                    componentList: allComponents),
                                "DROPDOWN": WidgetsParser().dropdown(
                                    component: comp, parentWidth: width),
                                "FORMSDROPDOWN": WidgetsParser()
                                    .formsDropdown(
                                        component: comp, parentWidth: width),
                                "DATE": WidgetsParser().date(
                                    component: comp, parentWidth: width),
                                "TEXTAREA": WidgetsParser().txtArea(
                                    component: comp, parentWidth: width),
                                "ATTACHMENTS": WidgetsParser().attachments(
                                    component: comp, parentWidth: width),
                                "LABEL": WidgetsParser().label(
                                    component: comp, parentWidth: width),
                                "BLANK": WidgetsParser().blank(
                                    component: comp, parentWidth: width),
                                "EXCEL": WidgetsParser().excel(
                                    component: comp, parentWidth: width),
                                "IMAGE": WidgetsParser().image(
                                    component: comp, parentWidth: width),
                                "MULTI_SELECT": WidgetsParser().multiselect(
                                    component: comp, parentWidth: width),
                                "LINK": WidgetsParser().link(
                                    component: comp, parentWidth: width),
                                "CHECKBOX": WidgetsParser().checkbox(
                                    component: comp, parentWidth: width),
                                "DATATABLE": WidgetsParser().dataTable(
                                    component: comp, parentWidth: width),
                              },
                              const SizedBox.shrink())
                    ],
                  ),
                ),
                AltComponent().altComponentInstruction(component: component)
              ],
            ))
      ],
    ),
    //child: Center(child: Text(text)),
  );
}