Skip to content

Commit

Permalink
feat: removed UniIcon, added bottom padding to header and removed the…
Browse files Browse the repository at this point in the history
…me copyWith
  • Loading branch information
abutuc committed Jan 2, 2025
1 parent 4b08bc1 commit 0dde325
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 28 deletions.
33 changes: 7 additions & 26 deletions packages/uni_ui/lib/cards/restaurant_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class RestaurantCard extends StatelessWidget {
});

final String name;
final PhosphorIcon icon;
final Icon icon;
final List<RestaurantMenuItem> menuItems;
final bool isFavorite;
final VoidCallback onFavoriteToggle;
Expand Down Expand Up @@ -48,13 +48,14 @@ class RestaurantCardHeader extends StatelessWidget {
});

final String name;
final PhosphorIcon icon;
final Icon icon;
final bool isFavorite;
final VoidCallback onFavoriteToggle;

@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(bottom: 9),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
Expand All @@ -72,10 +73,7 @@ class RestaurantCardHeader extends StatelessWidget {
flex: 4,
child: Text(
name,
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.bold,
color: Theme.of(context).primaryColor,
),
style: Theme.of(context).textTheme.headlineSmall,
overflow: TextOverflow.ellipsis,
),
),
Expand All @@ -84,30 +82,13 @@ class RestaurantCardHeader extends StatelessWidget {
child: IconButton(
onPressed: onFavoriteToggle,
icon: isFavorite
? UniIcon(PhosphorIconsFill.heart,
? Icon(PhosphorIconsFill.heart,
color: Theme.of(context).primaryColor)
: UniIcon(PhosphorIconsRegular.heart,
: Icon(PhosphorIconsRegular.heart,
color: Theme.of(context).primaryColor)),
),
],
),
);
}
}

class UniIcon extends PhosphorIcon {
const UniIcon(
IconData icon, {
super.key,
double size = 24,
Color? color,
String? semanticLabel,
TextDirection? textDirection,
}) : super(
icon,
size: size,
color: color,
semanticLabel: semanticLabel,
textDirection: textDirection,
);
}
}
3 changes: 1 addition & 2 deletions packages/uni_ui/lib/cards/widgets/restaurant_menu_item.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';

class RestaurantMenuItem extends StatelessWidget {
const RestaurantMenuItem({
Expand All @@ -8,7 +7,7 @@ class RestaurantMenuItem extends StatelessWidget {
required this.icon});

final String name;
final PhosphorIcon icon;
final Icon icon;

@override
Widget build(BuildContext context) {
Expand Down

0 comments on commit 0dde325

Please sign in to comment.