Skip to content

Commit

Permalink
chore: add favourite icon
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-hector committed Feb 2, 2024
1 parent 67d8f63 commit 6846fab
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions lib/app/shared/widgets/favorite_icon/favorite_icon.dart
Original file line number Diff line number Diff line change
@@ -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: <Widget>[
Image.asset(
iconPath,
width: 24,
),
],
),
);
}
}

0 comments on commit 6846fab

Please sign in to comment.