feat(ui): add generated premium assets
This commit is contained in:
@@ -24,21 +24,34 @@ class PluriIcon extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final tokens = context.pluriTokens;
|
||||
final icon = Icon(
|
||||
_resolveData(),
|
||||
size: size,
|
||||
color: _resolveColor(context, tokens),
|
||||
);
|
||||
final asset = _resolveAsset();
|
||||
final resolvedColor = _resolveColor(context, tokens);
|
||||
final icon = asset == null
|
||||
? Icon(_resolveData(), size: size, color: resolvedColor)
|
||||
: Opacity(
|
||||
opacity: variant == PluriIconVariant.outline ? 0.78 : 1,
|
||||
child: Image.asset(
|
||||
asset,
|
||||
width: size,
|
||||
height: size,
|
||||
fit: BoxFit.contain,
|
||||
errorBuilder: (_, __, ___) => Icon(
|
||||
_resolveData(),
|
||||
size: size,
|
||||
color: resolvedColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
final child = variant == PluriIconVariant.activeGlow
|
||||
? Container(
|
||||
width: size + 12,
|
||||
height: size + 12,
|
||||
width: size + 14,
|
||||
height: size + 14,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: tokens.glowColor,
|
||||
blurRadius: 14,
|
||||
blurRadius: 18,
|
||||
spreadRadius: 1,
|
||||
),
|
||||
],
|
||||
@@ -55,6 +68,18 @@ class PluriIcon extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
String? _resolveAsset() {
|
||||
return switch (glyph) {
|
||||
PluriIconGlyph.home => 'assets/icons/pluri_home.png',
|
||||
PluriIconGlyph.search => 'assets/icons/pluri_search.png',
|
||||
PluriIconGlyph.favorites => 'assets/icons/pluri_favorites.png',
|
||||
PluriIconGlyph.player => 'assets/icons/pluri_player.png',
|
||||
PluriIconGlyph.settings => 'assets/icons/pluri_settings.png',
|
||||
};
|
||||
}
|
||||
|
||||
Color _resolveColor(BuildContext context, PluriWaveTokens tokens) {
|
||||
if (variant == PluriIconVariant.activeGlow) return tokens.electricMagenta;
|
||||
if (variant == PluriIconVariant.filled) return Theme.of(context).colorScheme.onSurface;
|
||||
|
||||
Reference in New Issue
Block a user