Skip to content

Commit

Permalink
feat: add ButtonIcon
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-orion committed Feb 13, 2024
1 parent a6fedd4 commit eed3b23
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
22 changes: 22 additions & 0 deletions lib/app/components/button/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
),
);
}
}
10 changes: 5 additions & 5 deletions lib/app/components/button/widgetbook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,36 @@ 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(
type: ButtonType.outlined,
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(
Expand Down

0 comments on commit eed3b23

Please sign in to comment.