fix(flutter): 调整收藏页星标操作
This commit is contained in:
1 parent
f62324084e
commit
1d8582dfaa
9 files changed
+28
-49
No files matched your search
@@ -28,7 +28,7 @@ const double _coverWidth = 80;
|
||||
const double _coverHeight = 106;
|
||||
const double _coverRadius = 10;
|
||||
const double _removeSize = 28;
|
||||
const double _removeIconSize = 15;
|
||||
const double _removeIconSize = 20;
|
||||
const double _statsFontSize = 12;
|
||||
const double _metaFontSize = 11;
|
||||
const double _titleFontSize = 15;
|
||||
@@ -134,7 +134,7 @@ class _FavoritesBody extends StatelessWidget {
|
||||
height: _emptyListHeight,
|
||||
child: EmptyState(
|
||||
key: const Key('favorites-empty'),
|
||||
icon: Icons.favorite_border_rounded,
|
||||
icon: Icons.star_border_rounded,
|
||||
title: l10n.noFavorites,
|
||||
subtitle: l10n.emptyHint,
|
||||
),
|
||||
@@ -150,6 +150,7 @@ class _FavoritesBody extends StatelessWidget {
|
||||
if (index > 0) const SizedBox(height: 10),
|
||||
_FavoriteCard(
|
||||
drama: drama,
|
||||
isFavorite: favorites.isSaved(drama.id),
|
||||
onOpen: () => _open(context, drama),
|
||||
onRemove: () => _remove(context, drama.id),
|
||||
),
|
||||
@@ -181,30 +182,16 @@ class _FavoritesBody extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _summary(AppLocalizations l10n) {
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
l10n.favoritesCount(favorites.cards.length),
|
||||
key: const Key('favorites-count'),
|
||||
style: const TextStyle(
|
||||
color: AppColors.muted,
|
||||
fontSize: _statsFontSize,
|
||||
),
|
||||
return Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
l10n.favoritesCount(favorites.cards.length),
|
||||
key: const Key('favorites-count'),
|
||||
style: const TextStyle(
|
||||
color: AppColors.muted,
|
||||
fontSize: _statsFontSize,
|
||||
),
|
||||
const Spacer(),
|
||||
Flexible(
|
||||
child: Text(
|
||||
l10n.favoriteLongPressHint,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.end,
|
||||
style: const TextStyle(
|
||||
color: AppColors.subtle,
|
||||
fontSize: _metaFontSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -228,11 +215,13 @@ class _FavoritesBody extends StatelessWidget {
|
||||
class _FavoriteCard extends StatelessWidget {
|
||||
const _FavoriteCard({
|
||||
required this.drama,
|
||||
required this.isFavorite,
|
||||
required this.onOpen,
|
||||
required this.onRemove,
|
||||
});
|
||||
|
||||
final Drama drama;
|
||||
final bool isFavorite;
|
||||
final VoidCallback onOpen;
|
||||
final VoidCallback onRemove;
|
||||
|
||||
@@ -253,7 +242,6 @@ class _FavoriteCard extends StatelessWidget {
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: InkWell(
|
||||
onTap: onOpen,
|
||||
onLongPress: onRemove,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(_cardPadding),
|
||||
child: Stack(
|
||||
@@ -373,7 +361,7 @@ class _FavoriteCard extends StatelessWidget {
|
||||
child: SizedBox.square(
|
||||
dimension: _removeSize,
|
||||
child: Material(
|
||||
color: AppColors.badgePink,
|
||||
color: AppColors.raised,
|
||||
shape: const CircleBorder(),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: IconButton(
|
||||
@@ -381,9 +369,11 @@ class _FavoriteCard extends StatelessWidget {
|
||||
tooltip: l10n.remove,
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onRemove,
|
||||
icon: const Icon(
|
||||
Icons.favorite_rounded,
|
||||
color: AppColors.favorite,
|
||||
icon: Icon(
|
||||
isFavorite
|
||||
? Icons.star_rounded
|
||||
: Icons.star_border_rounded,
|
||||
color: isFavorite ? AppColors.blue : AppColors.muted,
|
||||
size: _removeIconSize,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user