parse<T> static method

PaywallStyle? parse<T>(
  1. Object? source,
  2. bool dark
)

Implementation

static PaywallStyle? parse<T>(Object? source, bool dark) {
  if (source is! Map || source.isEmpty) return null;
  return PaywallStyle(
    selected: false,
    alignmentState: PaywallState.parse(
      source['alignment'],
      StyleParser.parseAlignment,
    ),
    backgroundColorState: PaywallState.parse(
      source['backgroundColor'],
      (value) => StyleParser.parseThemedColor(value, dark),
    ),
    blendModeState: PaywallState.parse(
      source['blendMode'],
      StyleParser.parseBlendMode,
    ),
    blurState: PaywallState.parse(
      source['blur'],
      StyleParser.parseDouble,
    ),
    borderState: PaywallState.parse(
      source['border'],
      (value) => StyleParser.parseBorder(value, dark),
    ),
    borderRadiusState: PaywallState.parse(
      source['borderRadius'],
      StyleParser.parseBorderRadius,
    ),
    boxShadowState: PaywallState.parse(source['boxShadow'], (v) {
      return StyleParser.parseList(
          v, (e) => StyleParser.parseBoxShadow(e, dark));
    }),
    centerState: PaywallState.parse(
      source['center'],
      StyleParser.parseBool,
    ),
    colorState: PaywallState.parse(
      source['color'],
      (value) => StyleParser.parseThemedColor(value, dark),
    ),
    constraintsState: PaywallState.parse(
      source['constraints'],
      StyleParser.parseBoxConstraints,
    ),
    contentAlignmentState: PaywallState.parse(
      source['contentAlignment'],
      StyleParser.parseAlignment,
    ),
    durationState: PaywallState.parse(
      source['duration'],
      StyleParser.parseInt,
    ),
    expandedState: PaywallState.parse(
      source['expanded'],
      StyleParser.parseInt,
    ),
    fittedState: PaywallState.parse(
      source['fitted'],
      StyleParser.parseBool,
    ),
    flexState: PaywallState.parse(
      source['flex'],
      StyleParser.parseInt,
    ),
    foregroundColorState: PaywallState.parse(
      source['foregroundColor'],
      (value) => StyleParser.parseThemedColor(value, dark),
    ),
    foregroundGradientState: PaywallState.parse(
      source['foregroundGradient'],
      (value) => StyleParser.parseGradient(value, dark),
    ),
    gradientState: PaywallState.parse(
      source['gradient'],
      (value) => StyleParser.parseGradient(value, dark),
    ),
    heightState: PaywallState.parse(
      source['height'],
      StyleParser.parseDouble,
    ),
    heightPercentageState: PaywallState.parse(
      source['heightPercentage'],
      StyleParser.parseDouble,
    ),
    imageState: PaywallState.parse(
      source['image'],
      StyleParser.parseString,
    ),
    imageOpacityState: PaywallState.parse(
      source['imageOpacity'],
      StyleParser.parseDouble,
    ),
    imageScaleState: PaywallState.parse(
      source['imageScale'],
      StyleParser.parseDouble,
    ),
    layoutState: PaywallState.parse(
      source['layout'],
      (source) => StyleParser.parseEnum(source, PaywallLayoutType.values),
    ),
    layoutAlignmentState: PaywallState.parse(
      source['layoutAlignment'],
      StyleParser.parseAlignment,
    ),
    layoutClipBehaviorState: PaywallState.parse(
      source['layoutClipBehavior'],
      (source) => StyleParser.parseEnum(source, Clip.values),
    ),
    layoutCrossAxisAlignmentState: PaywallState.parse(
      source['layoutCrossAxisAlignment'],
      (source) => StyleParser.parseEnum(source, CrossAxisAlignment.values),
    ),
    layoutDirectionState: PaywallState.parse(
      source['layoutDirection'],
      (source) => StyleParser.parseEnum(source, Axis.values),
    ),
    layoutMainAxisAlignmentState: PaywallState.parse(
      source['layoutMainAxisAlignment'],
      (source) => StyleParser.parseEnum(source, MainAxisAlignment.values),
    ),
    layoutMainAxisSizeState: PaywallState.parse(
      source['layoutMainAxisSize'],
      (source) => StyleParser.parseEnum(source, MainAxisSize.values),
    ),
    layoutRunSpacingState: PaywallState.parse(
      source['layoutRunSpacing'],
      StyleParser.parseDouble,
    ),
    layoutSpacingState: PaywallState.parse(
      source['layoutSpacing'],
      StyleParser.parseDouble,
    ),
    layoutStackFitState: PaywallState.parse(
      source['layoutStackFit'],
      (source) => StyleParser.parseEnum(source, StackFit.values),
    ),
    layoutTextBaselineState: PaywallState.parse(
      source['layoutTextBaseline'],
      (source) => StyleParser.parseEnum(source, TextBaseline.values),
    ),
    layoutVerticalDirectionState: PaywallState.parse(
      source['layoutVerticalDirection'],
      (source) => StyleParser.parseEnum(source, VerticalDirection.values),
    ),
    layoutWrapAlignmentState: PaywallState.parse(
      source['layoutWrapAlignment'],
      (source) => StyleParser.parseEnum(source, WrapAlignment.values),
    ),
    layoutWrapRunAlignmentState: PaywallState.parse(
      source['layoutWrapRunAlignment'],
      (source) => StyleParser.parseEnum(source, WrapAlignment.values),
    ),
    layoutWrapCrossAlignmentState: PaywallState.parse(
      source['layoutWrapCrossAlignment'],
      (source) => StyleParser.parseEnum(source, WrapCrossAlignment.values),
    ),
    marginState: PaywallState.parse(
      source['margin'],
      StyleParser.parseEdgeInsets,
    ),
    maxLinesState: PaywallState.parse(
      source['maxLines'],
      StyleParser.parseInt,
    ),
    opacityState: PaywallState.parse(
      source['opacity'],
      StyleParser.parseDouble,
    ),
    overflowState: PaywallState.parse(
      source['overflow'],
      StyleParser.parseBool,
    ),
    paddingState: PaywallState.parse(
      source['padding'],
      StyleParser.parseEdgeInsets,
    ),
    positionState: PaywallState.parse(
      source['position'],
      StyleParser.parsePosition,
    ),
    scaleState: PaywallState.parse(
      source['scale'],
      StyleParser.parseDouble,
    ),
    sizeState: PaywallState.parse(
      source['size'],
      StyleParser.parseDouble,
    ),
    textAlignState: PaywallState.parse(
      source['textAlign'],
      StyleParser.parseTextAlign,
    ),
    textStyleState: PaywallState.parse(
      source['textStyle'],
      (value) => StyleParser.parseTextStyle(value, dark),
    ),
    widthState: PaywallState.parse(
      source['width'],
      StyleParser.parseDouble,
    ),
    widthPercentageState: PaywallState.parse(
      source['widthPercentage'],
      StyleParser.parseDouble,
    ),
  );
}