designStyleConfig static method

String designStyleConfig(
  1. ProjectConfig config,
  2. StyleRecipe recipe
)

Implementation

static String designStyleConfig(ProjectConfig config, StyleRecipe recipe) {
  String b(bool v) => v ? 'true' : 'false';
  final useGradients = (!recipe.avoidGradients) &&
      (recipe.prefersGradientButtons || config.useGradient);
  return '''
import 'design_style.dart';

/// Baked recipe for [AppDesignStyle.current].
///
/// Components read these flags instead of switching on the style name in
/// feature screens. Adding a future style should not require screen changes.
class AppStyleConfig {
AppStyleConfig._();

static const AppDesignStyle style = AppDesignStyle.current;

static const bool usesBlur = ${b(recipe.usesBlur)};
static const bool usesNeoShadows = ${b(recipe.usesNeoShadows)};
static const bool usesHardOffsetShadow = ${b(recipe.usesHardOffsetShadow)};
static const bool usesInsetPress = ${b(recipe.usesInsetPress)};
static const bool usesClayInflation = ${b(recipe.usesClayInflation)};
static const bool usesSkeuoGradient = ${b(recipe.usesSkeuoGradient)};
static const bool usesLiquidHighlight = ${b(recipe.usesLiquidHighlight)};
static const bool usesSpatialDepth = ${b(recipe.usesSpatialDepth)};
static const bool prefersGradientButtons = ${b(useGradients)};
static const bool avoidGradients = ${b(recipe.avoidGradients)};
static const bool reducedTransparencyFallback =
    ${b(recipe.reducedTransparencyFallback)};
}
''';
}