getImageCard function

Widget getImageCard(
  1. UXPProps uxpProps,
  2. BuildContext context
)

Implementation

Widget getImageCard(UXPProps uxpProps, BuildContext context) {
  LMCardTextConfig? title =
      LMCardTextConfig.fromJson(uxpProps.uiProps?['title'] ?? {});

  return Stack(
    children: [
      Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(0),
          color: getColorFromString(uxpProps.uiProps?['headerContainer']
                  ?['background']?['color']) ??
              Theme.of(context).primaryColor,
          image: ((uxpProps.uiProps?['headerContainer']?['background']['image']
                          ['image'] ??
                      "") !=
                  "")
              ? DecorationImage(
                  image: CachedNetworkImageProvider(
                      uxpProps.uiProps?['headerContainer']?['background']
                              ['image']['image'] ??
                          ""),
                  //TODO - alignemnt and fit from config
                  fit: BoxFit.cover,
                  // alignment: uxpProps.uiProps?.container?.background.image.position,
                )
              : null,
        ),
      ),
      Align(
        alignment: Alignment.bottomCenter,
        child: Container(
          color: Color.fromARGB(
            126,
            0,
            0,
            0,
          ),
          child: Container(
            width: double.infinity,
            height: 70,
            padding: EdgeInsets.all(15),
          ),
        ),
      ),
      Align(
        alignment: Alignment.bottomCenter,
        child: Container(
          padding: EdgeInsets.only(
            top: 10,
            bottom: 20,
          ),
          child: Text(
            (title.text ?? (uxpProps.name ?? "WIDGET")),
            style: TextStyle(
              fontSize: title.size ?? 16,
              color: Colors.white,
              fontWeight: FontWeight.bold,
            ),
          ),
        ),
      )
    ],
  );
}