getIt static method

Widget? getIt(
  1. AppModel app,
  2. MemberModel? member,
  3. BackgroundModel? background,
  4. BuildContext context,
  5. PosSizeModel? posSizeModel,
  6. PlatformMediumModel? imageModel,
  7. Orientation orientation,
  8. ActionModel? action,
  9. int index,
)

Implementation

static Widget? getIt(
    AppModel app,
    MemberModel? member,
    BackgroundModel? background,
    BuildContext context,
    PosSizeModel? posSizeModel,
    PlatformMediumModel? imageModel,
    Orientation orientation,
    ActionModel? action,
    int index) {
  if (imageModel == null) {
    return null;
  }
  Center realImage;
  Alignment? alignment;
  if (posSizeModel == null) {
    realImage = Center(
        child: toContainer(
            app,
            member,
            background,
            Image.network(
              imageModel.url!,
/*
          fit: BoxFit.scaleDown,
          alignment: Alignment.center,
*/
            )));
  } else {
    //var width = BoxFitHelper.toWidth(posSizeModel, context, orientation);
    //var height = BoxFitHelper.toHeight(posSizeModel, context, orientation);
    alignment = BoxFitHelper.toAlignment(posSizeModel, orientation);

    realImage = Center(
        child: toContainer(
            app,
            member,
            background,
            Image.network(
              imageModel.url!,
/*
          fit: BoxFit.scaleDown,
*/
/*
          height: height,
          width: width,
*/
/*
          alignment: Alignment.center,
*/
            )));
  }
  SingleChildRenderObjectWidget clip;
  if ((posSizeModel != null) && (posSizeModel.clip != null)) {
    switch (posSizeModel.clip) {
      case ClipType.noClip:
        clip = realImage;
        break;
      case ClipType.clipOval:
        clip = ClipOval(child: realImage);
        break;
      case ClipType.clipRRect5:
        clip = ClipRRect(
            child: realImage, borderRadius: BorderRadius.circular(5));
        break;
      case ClipType.clipRRect10:
        clip = ClipRRect(
            child: realImage, borderRadius: BorderRadius.circular(10));
        break;
      case ClipType.clipRRect15:
        clip = ClipRRect(
            child: realImage, borderRadius: BorderRadius.circular(15));
        break;
      case ClipType.clipRRect20:
        clip = ClipRRect(
            child: realImage, borderRadius: BorderRadius.circular(20));
        break;
      case ClipType.clipRRect30:
        clip = ClipRRect(
            child: realImage, borderRadius: BorderRadius.circular(30));
        break;
      case ClipType.clipRRect40:
        clip = ClipRRect(
            child: realImage, borderRadius: BorderRadius.circular(40));
        break;
      case ClipType.unknown:
        clip = realImage;
        break;
      case null:
        clip = realImage;
        break;
    }
  } else {
    clip = realImage;
  }

  SingleChildRenderObjectWidget aligned;
  if (alignment == null) {
    aligned = clip;
  } else {
    aligned =
        Align(alignment: alignment, child: clip, key: ValueKey<int>(index));
  }

  if (action != null) {
    return GestureDetector(
        onTap: () {
          er.Router.navigateTo(context, action);
        },
        child: aligned,
        key: ValueKey<int>(index));
  } else {
    return aligned;
  }
}