decodeTimePickerThemeData static method

TimePickerThemeData? decodeTimePickerThemeData(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the given value to a TimePickerThemeData. This expects the value to have the following structure:

{
  "backgroundColor": <Color>,
  "dayPeriodBorderSide": <BorderSide>,
  "dayPeriodColor": <Color>,
  "dayPeriodShape": <ShapeBorder>,
  "dayPeriodTextColor": <Color>,
  "dayPeriodTextStyle": <TextStyle>,
  "dialBackgroundColor": <Color>,
  "dialHandColor": <Color>,
  "dialTextColor": <Color>,
  "entryModeIconColor": <Color>,
  "helpTextStyle": <TextStyle>,
  "hourMinuteColor": <Color>,
  "hourMinuteShape": <ShapeBorder>,
  "hourMinuteTextColor": <Color>,
  "hourMinuteTextStyle": <TextStyle>,
  "inputDecorationTheme": <InputDecorationTheme>,
  "shape": <ShapeBorder>
}

See also:

Implementation

static TimePickerThemeData? decodeTimePickerThemeData(
  dynamic value, {
  bool validate = true,
}) {
  TimePickerThemeData? result;

  if (value is TimePickerThemeData) {
    result = value;
  } else if (value != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/time_picker_theme_data',
      value: value,
      validate: validate,
    ));

    result = TimePickerThemeData(
      backgroundColor: decodeColor(value['backgroundColor']),
      dayPeriodBorderSide: decodeBorderSide(value['dayPeriodBorderSide']),
      dayPeriodColor: decodeColor(value['dayPeriodColor']),
      dayPeriodShape: value['dayPeriodShape'] == null
          ? null
          : decodeShapeBorder(value['dayPeriodShape']) as OutlinedBorder?,
      dayPeriodTextColor: decodeColor(value['dayPeriodTextColor']),
      dayPeriodTextStyle: decodeTextStyle(value['dayPeriodTextStyle']),
      dialBackgroundColor: decodeColor(value['dialBackgroundColor']),
      dialHandColor: decodeColor(value['dialHandColor']),
      dialTextColor: decodeColor(value['dialTextColor']),
      entryModeIconColor: decodeColor(value['entryModeIconColor']),
      helpTextStyle: decodeTextStyle(value['helpTextStyle']),
      hourMinuteColor: decodeColor(value['hourMinuteColor']),
      hourMinuteShape: decodeShapeBorder(value['hourMinuteShape']),
      hourMinuteTextColor: decodeColor(value['hourMinuteTextColor']),
      hourMinuteTextStyle: decodeTextStyle(value['hourMinuteTextStyle']),
      inputDecorationTheme:
          decodeInputDecorationTheme(value['inputDecorationTheme']),
      shape: decodeShapeBorder(value['shape']),
    );
  }

  return result;
}