FTileGroupStyle.inherit constructor

FTileGroupStyle.inherit({
  1. required FColors colors,
  2. required FTypography typography,
  3. required FStyle style,
})

Creates a FTileGroupStyle that inherits from the given arguments.

Implementation

factory FTileGroupStyle.inherit({required FColors colors, required FTypography typography, required FStyle style}) {
  final tileStyle = FTileStyle.inherit(colors: colors, typography: typography, style: style);
  return FTileGroupStyle(
    decoration: BoxDecoration(
      border: Border.all(color: colors.border, width: style.borderWidth),
      borderRadius: style.borderRadius,
    ),

    tileStyle: tileStyle.copyWith(
      decoration: tileStyle.decoration.map(
        (d) => d == null
            ? null
            : BoxDecoration(
                color: d.color,
                image: d.image,
                boxShadow: d.boxShadow,
                gradient: d.gradient,
                backgroundBlendMode: d.backgroundBlendMode,
                shape: d.shape,
              ),
      ),
    ),
    dividerColor: FWidgetStateMap.all(colors.border),
    dividerWidth: style.borderWidth,
    labelTextStyle: FWidgetStateMap({
      WidgetState.error: typography.base.copyWith(
        color: style.formFieldStyle.labelTextStyle.maybeResolve({})?.color ?? colors.primary,
        fontWeight: FontWeight.w600,
      ),
      WidgetState.disabled: typography.base.copyWith(
        color:
            style.formFieldStyle.labelTextStyle.maybeResolve({WidgetState.disabled})?.color ??
            colors.disable(colors.primary),
        fontWeight: FontWeight.w600,
      ),
      WidgetState.any: typography.base.copyWith(
        color: style.formFieldStyle.labelTextStyle.maybeResolve({})?.color ?? colors.primary,
        fontWeight: FontWeight.w600,
      ),
    }),
    descriptionTextStyle: style.formFieldStyle.descriptionTextStyle.map(
      (s) => typography.xs.copyWith(color: s.color),
    ),
    errorTextStyle: typography.xs.copyWith(color: style.formFieldStyle.errorTextStyle.color),
  );
}