comicStyleOf function
Resolves layers for states and checks that fills and overlays are opaque in debug mode.
Implementation
DesignStyleOf comicStyleOf(List<DesignStyle?> layers, Set<WidgetState> states) {
final look = DesignStyleOf(layers, states);
assert(
comicFlatInk(look.fill),
"Comic's first law is flat opaque inks, nothing see-through: a part's fill resolved to ${look.fill}. Give an "
'opaque ink; a lighter tone is a screen of Ben-Day dots (ComicBenDay).',
);
assert(() {
for (final more in const [
<WidgetState>{},
{WidgetState.hovered},
{WidgetState.pressed},
{WidgetState.focused},
]) {
final overlay = look.overlay?.resolve({...states, ...more});
if (!comicFlatInk(overlay)) {
throw FlutterError(
"Comic's first law is flat opaque inks, nothing see-through: a part's overlay resolved to $overlay at "
'${{...states, ...more}}. Give an opaque ink, or none.',
);
}
}
return true;
}());
return look;
}