diff --git a/lib/app/components/button/button.dart b/lib/app/components/button/button.dart index 79489be77..2409a4aef 100644 --- a/lib/app/components/button/button.dart +++ b/lib/app/components/button/button.dart @@ -166,3 +166,25 @@ class ButtonLoadingIndicator extends StatelessWidget { ); } } + +class ButtonIcon extends StatelessWidget { + ButtonIcon({ + super.key, + required this.path, + double? size, + }) : size = size ?? 24.0.s; + + final String path; + final double size; + + @override + Widget build(BuildContext context) { + return SizedBox( + width: size, + height: size, + child: FittedBox( + child: ImageIcon(AssetImage(path)), + ), + ); + } +} diff --git a/lib/app/components/button/widgetbook.dart b/lib/app/components/button/widgetbook.dart index 4f7c6bf16..21c5a210d 100644 --- a/lib/app/components/button/widgetbook.dart +++ b/lib/app/components/button/widgetbook.dart @@ -24,21 +24,21 @@ Widget regularButtonUseCase(BuildContext context) { ), ), mainAxisSize: MainAxisSize.max, - leadingIcon: ImageIcon(AssetImage(Assets.images.bookmarks.path)), + leadingIcon: ButtonIcon(path: Assets.images.bookmarks.path), onPressed: () {}, ), Button( type: ButtonType.secondary, label: const Text('Secondary'), mainAxisSize: MainAxisSize.max, - trailingIcon: ImageIcon(AssetImage(Assets.images.bookmarks.path)), + trailingIcon: ButtonIcon(path: Assets.images.bookmarks.path), onPressed: () {}, ), Button( type: ButtonType.outlined, label: const Text('Outlined'), mainAxisSize: MainAxisSize.max, - leadingIcon: ImageIcon(AssetImage(Assets.images.bookmarks.path)), + leadingIcon: ButtonIcon(path: Assets.images.bookmarks.path), onPressed: () {}, ), Button( @@ -46,14 +46,14 @@ Widget regularButtonUseCase(BuildContext context) { tintColor: context.theme.appColors.attentionRed, label: const Text('Outlined with Tint color'), mainAxisSize: MainAxisSize.max, - leadingIcon: ImageIcon(AssetImage(Assets.images.bookmarks.path)), + leadingIcon: ButtonIcon(path: Assets.images.bookmarks.path), onPressed: () {}, ), Button( type: ButtonType.disabled, label: const Text('Disabled'), mainAxisSize: MainAxisSize.max, - trailingIcon: ImageIcon(AssetImage(Assets.images.bookmarks.path)), + trailingIcon: ButtonIcon(path: Assets.images.bookmarks.path), onPressed: () {}, ), Button(