From 6846fab1d40072021e2ba73382d90a4323936330 Mon Sep 17 00:00:00 2001 From: ice-hector <96414297+ice-hector@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:05:09 +0200 Subject: [PATCH] chore: add favourite icon --- .../widgets/favorite_icon/favorite_icon.dart | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 lib/app/shared/widgets/favorite_icon/favorite_icon.dart diff --git a/lib/app/shared/widgets/favorite_icon/favorite_icon.dart b/lib/app/shared/widgets/favorite_icon/favorite_icon.dart new file mode 100644 index 000000000..b70f8ebbf --- /dev/null +++ b/lib/app/shared/widgets/favorite_icon/favorite_icon.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:ice/app/extensions/build_context.dart'; +import 'package:ice/app/extensions/theme_data.dart'; +import 'package:ice/generated/assets.gen.dart'; + +const double iconSideDimension = 36.0; + +class FavoriteIcon extends StatelessWidget { + const FavoriteIcon({ + super.key, + this.isFavorite = false, + this.backgroundColor, + }); + + final bool isFavorite; + final Color? backgroundColor; + + @override + Widget build(BuildContext context) { + final String iconPath = isFavorite + ? Assets.images.bookmarksOn.path + : Assets.images.bookmarks.path; + + final Color iconBackgroundColor = + backgroundColor ?? context.theme.appColors.tertararyBackground; + return Container( + width: iconSideDimension, + height: iconSideDimension, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: iconBackgroundColor, + border: Border.all( + color: context.theme.appColors.onTerararyFill, + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + iconPath, + width: 24, + ), + ], + ), + ); + } +}