diff --git a/CHANGELOG.md b/CHANGELOG.md index 8975b1c..1703987 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # 0.19.0 - feat: adding `NesSectionHeader` + - feat: adding `NesIcons16.check` # 0.18.0 - feat: add `NesIcons.wrench` diff --git a/lib/src/theme.dart b/lib/src/theme.dart index 736c19e..4e3d83f 100644 --- a/lib/src/theme.dart +++ b/lib/src/theme.dart @@ -294,8 +294,12 @@ class NesIconTheme extends ThemeExtension { required this.secondary, required this.accent, required this.shadow, + this.size = 32, }); + /// The size of the icon. + final double size; + /// Primary color of the icon palette. final Color primary; @@ -310,12 +314,14 @@ class NesIconTheme extends ThemeExtension { @override NesIconTheme copyWith({ + double? size, Color? primary, Color? secondary, Color? accent, Color? shadow, }) { return NesIconTheme( + size: size ?? this.size, primary: primary ?? this.primary, secondary: secondary ?? this.secondary, accent: accent ?? this.accent, @@ -327,6 +333,10 @@ class NesIconTheme extends ThemeExtension { NesIconTheme lerp(ThemeExtension? other, double t) { final otherExt = other as NesIconTheme?; return NesIconTheme( + size: Tween( + begin: size, + end: otherExt?.size ?? size, + ).transform(t), primary: ColorTween( begin: primary, end: otherExt?.primary, diff --git a/lib/src/widgets/nes_icon.dart b/lib/src/widgets/nes_icon.dart index f362f3b..02ccfb0 100644 --- a/lib/src/widgets/nes_icon.dart +++ b/lib/src/widgets/nes_icon.dart @@ -805,16 +805,14 @@ class NesIcon extends StatelessWidget { var pixelSize = nesTheme.pixelSize.toDouble(); - final customSize = size; - if (customSize != null) { - final spriteHorizontalUnits = iconData.sprite.pixels[0].length; - final spriteVerticalUnits = iconData.sprite.pixels.length; + final iconSize = size ?? Size.square(nesIconTheme.size); + final spriteHorizontalUnits = iconData.sprite.pixels[0].length; + final spriteVerticalUnits = iconData.sprite.pixels.length; - final width = customSize.width / spriteHorizontalUnits; - final height = customSize.height / spriteVerticalUnits; + final width = iconSize.width / spriteHorizontalUnits; + final height = iconSize.height / spriteVerticalUnits; - pixelSize = math.min(width, height).roundToDouble(); - } + pixelSize = math.min(width, height).roundToDouble(); return MiniSpriteWidget( pixelSize: pixelSize, diff --git a/lib/src/widgets/nes_icon16.dart b/lib/src/widgets/nes_icon16.dart index 1c74684..19aacb6 100644 --- a/lib/src/widgets/nes_icon16.dart +++ b/lib/src/widgets/nes_icon16.dart @@ -10,7 +10,7 @@ class NesIcons16 { /// A check icon. static final check = NesIconData( MiniSprite.fromDataString( - '8,8;6,-1;2,0;5,-1;1,0;1,1;1,0;4,-1;1,0;2,1;3,0;1,-1;1,0;2,1;1,0;1,-1;1,0;1,1;1,0;2,1;1,0;2,-1;1,0;3,1;1,0;4,-1;1,0;1,1;1,0;6,-1;1,0;5,-1', + '16,16;14,-1;2,0;13,-1;1,0;1,2;1,0;12,-1;1,0;1,2;1,3;1,0;11,-1;1,0;1,2;1,1;1,2;1,0;10,-1;1,0;1,2;2,1;1,3;1,0;9,-1;1,0;1,2;2,1;1,3;1,0;9,-1;1,0;1,2;2,1;1,3;1,0;3,-1;2,0;4,-1;1,0;1,2;2,1;1,3;1,0;3,-1;1,0;2,2;1,0;2,-1;1,0;1,2;2,1;1,3;1,0;4,-1;1,0;1,3;1,2;1,0;1,-1;1,0;1,2;2,1;1,3;1,0;5,-1;1,0;1,2;1,1;1,2;1,0;1,2;2,1;1,3;1,0;6,-1;1,0;1,3;2,1;1,2;2,1;1,3;1,0;8,-1;1,0;1,3;3,1;1,3;1,0;10,-1;1,0;1,3;1,1;1,3;1,0;12,-1;1,0;1,3;1,0;14,-1;1,0;11,-1', ), ); }