decodeInputDecorationTheme static method
Decodes the given value
to an InputDecorationTheme. This expects the
given value
to be of the following structure:
{
"activeIndicatorBorder": "<BorderSide>",
"alignLabelWithHint": "<bool>",
"border": "<InputBorder>",
"constraints": "<BoxConstraints>",
"contentPadding": "<EdgeInsetsGeometry>",
"counterStyle": "<TextStyle>",
"disabledBorder": "<InputBorder>",
"enabledBorder": "<InputBorder>",
"errorBorder": "<InputBorder>",
"errorMaxLines": "<int>",
"errorStyle": "<TextStyle>",
"fillColor": "<Color>",
"filled": "<bool>",
"floatingLabelAlignment": "<FloatingLabelAlignment>",
"floatingLabelBehavior": "<FloatingLabelBehavior>",
"floatingLabelStyle": "<TextStyle>",
"focusColor": "<Color>",
"focusedBorder": "<InputBorder>",
"focusedErrorBorder": "<InputBorder>",
"helperMaxLines": "<int>",
"helperStyle": "<TextStyle>",
"hintFadeDuration": "<Duration>",
"hintStyle": "<TextStyle>",
"hoverColor": "<Color>",
"iconColor": "<Color>",
"isCollapsed": "<bool>",
"isDense": "<bool>",
"labelStyle": "<TextStyle>",
"outlineBorder": "<BorderSide>",
"prefixIconColor": "<Color>",
"prefixStyle": "<TextStyle>",
"suffixStyle": "<Color>",
"suffixStyle": "<TextStyle>"
}
See also:
Implementation
static InputDecorationTheme? decodeInputDecorationTheme(
dynamic value, {
bool validate = true,
}) {
InputDecorationTheme? result;
if (value is InputDecorationTheme) {
result = value;
} else if (value != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/input_decoration_theme',
value: value,
validate: validate,
));
result = InputDecorationTheme(
activeIndicatorBorder: decodeBorderSide(
value['activeIndicatorBorder'],
validate: false,
),
alignLabelWithHint: JsonClass.parseBool(value['alignLabelWithHint']),
border: decodeInputBorder(
value['border'],
validate: false,
),
constraints: decodeBoxConstraints(
value['constraints'],
validate: false,
),
contentPadding: decodeEdgeInsetsGeometry(
value['contentPadding'],
validate: false,
),
counterStyle: decodeTextStyle(
value['counterStyle'],
validate: false,
),
disabledBorder: decodeInputBorder(
value['disabledBorder'],
validate: false,
),
enabledBorder: decodeInputBorder(
value['enabledBorder'],
validate: false,
),
errorBorder: decodeInputBorder(
value['errorBorder'],
validate: false,
),
errorMaxLines: JsonClass.maybeParseInt(value['errorMaxLines']),
errorStyle: decodeTextStyle(
value['errorStyle'],
validate: false,
),
fillColor: decodeColor(
value['fillColor'],
validate: false,
),
filled: JsonClass.parseBool(value['filled']),
floatingLabelAlignment: decodeFloatingLabelAlignment(
value['floatingLabelAlignment'],
validate: false,
) ??
FloatingLabelAlignment.start,
floatingLabelBehavior: decodeFloatingLabelBehavior(
value['floatingLabelBehavior'],
validate: false,
) ??
FloatingLabelBehavior.auto,
floatingLabelStyle: decodeTextStyle(
value['floatingLabelStyle'],
validate: false,
),
focusColor: decodeColor(
value['focusColor'],
validate: false,
),
focusedBorder: decodeInputBorder(
value['focusedBorder'],
validate: false,
),
focusedErrorBorder: decodeInputBorder(
value['focusedErrorBorder'],
validate: false,
),
helperMaxLines: JsonClass.maybeParseInt(value['helperMaxLines']),
helperStyle: decodeTextStyle(
value['helperStyle'],
validate: false,
),
hintFadeDuration: JsonClass.maybeParseDurationFromMillis(
value['hintFadeDuration'],
),
hintStyle: decodeTextStyle(
value['hintStyle'],
validate: false,
),
hoverColor: decodeColor(
value['hoverColor'],
validate: false,
),
iconColor: decodeColor(
value['iconColor'],
validate: false,
),
isCollapsed: JsonClass.parseBool(value['isCollapsed']),
isDense: JsonClass.parseBool(value['isDense']),
labelStyle: decodeTextStyle(
value['labelStyle'],
validate: false,
),
outlineBorder: decodeBorderSide(
value['outlineBorder'],
validate: false,
),
prefixIconColor: decodeColor(
value['prefixIconColor'],
validate: false,
),
prefixStyle: decodeTextStyle(
value['prefixStyle'],
validate: false,
),
suffixIconColor: decodeColor(
value['suffixIconColor'],
validate: false,
),
suffixStyle: decodeTextStyle(
value['suffixStyle'],
validate: false,
),
);
}
return result;
}