CustomConfig constructor
CustomConfig({})
Implementation
CustomConfig({
this.colors,
this.gradients,
this.gradientBegin,
this.gradientEnd,
required this.durations,
required this.heightPercentages,
this.blur,
}) : assert(() {
if (colors == null && gradients == null) {
Config.throwNullError('custom', 'colors` or `gradients');
}
return true;
}()),
assert(() {
if (gradients == null &&
(gradientBegin != null || gradientEnd != null)) {
throw FlutterError(
'You set a gradient direction but forgot setting `gradients`.');
}
return true;
}()),
assert(() {
if (durations == null) {
Config.throwNullError('custom', 'durations');
}
return true;
}()),
assert(() {
if (heightPercentages == null) {
Config.throwNullError('custom', 'heightPercentages');
}
return true;
}()),
assert(() {
if (colors != null &&
durations != null &&
heightPercentages != null) {
if (colors.length != durations.length ||
colors.length != heightPercentages.length) {
throw FlutterError(
'Length of `colors`, `durations` and `heightPercentages` must be equal.');
}
}
return true;
}()),
assert(colors == null || gradients == null,
'Cannot provide both colors and gradients.'),
super(colorMode: ColorMode.custom);