feat(player): 互动栏改用参考图同款图标资源
This commit is contained in:
1 parent
35de4095b0
commit
cbb9f60f7f
10 files changed
+61
-78
No files matched your search
@@ -173,8 +173,7 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
|
||||
items: [
|
||||
InteractionRailItem(
|
||||
key: const Key('rail-save'),
|
||||
icon: Icons.star_rounded,
|
||||
activeIcon: Icons.star_rounded,
|
||||
asset: 'assets/icon/rail/rail_save.png',
|
||||
label: widget.l10n.favorite,
|
||||
count: widget.favoriteCount,
|
||||
countKey: const Key('rail-save-count'),
|
||||
@@ -183,8 +182,7 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
|
||||
),
|
||||
InteractionRailItem(
|
||||
key: const Key('rail-comments'),
|
||||
icon: Icons.chat_bubble_outline_rounded,
|
||||
activeIcon: Icons.chat_bubble_rounded,
|
||||
asset: 'assets/icon/rail/rail_comment.png',
|
||||
label: widget.l10n.comments,
|
||||
count: widget.commentCount,
|
||||
countKey: const Key('rail-comments-count'),
|
||||
@@ -192,8 +190,7 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
|
||||
),
|
||||
InteractionRailItem(
|
||||
key: const Key('rail-like'),
|
||||
icon: Icons.favorite_rounded,
|
||||
activeIcon: Icons.favorite_rounded,
|
||||
asset: 'assets/icon/rail/rail_like.png',
|
||||
label: widget.l10n.like,
|
||||
count: widget.likeCount,
|
||||
countKey: const Key('rail-like-count'),
|
||||
@@ -202,10 +199,8 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
|
||||
),
|
||||
InteractionRailItem(
|
||||
key: const Key('rail-share'),
|
||||
icon: Icons.reply_rounded,
|
||||
activeIcon: Icons.reply_rounded,
|
||||
asset: 'assets/icon/rail/rail_share.png',
|
||||
label: widget.l10n.share,
|
||||
mirrorIcon: true,
|
||||
onTap: widget.onShare,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -6,32 +6,28 @@ import '../../../core/formatting/count_format.dart';
|
||||
import '../../../core/theme/app_colors.dart';
|
||||
|
||||
const double _buttonSize = 44;
|
||||
const double _iconSize = 30;
|
||||
const double _itemGap = 22;
|
||||
const double _iconSize = 32;
|
||||
const double _itemGap = 24;
|
||||
|
||||
/// 互动栏单项:图标、计数与点击。
|
||||
class InteractionRailItem {
|
||||
const InteractionRailItem({
|
||||
required this.key,
|
||||
required this.icon,
|
||||
required this.activeIcon,
|
||||
required this.asset,
|
||||
required this.label,
|
||||
required this.onTap,
|
||||
this.count,
|
||||
this.countKey,
|
||||
this.selected = false,
|
||||
this.mirrorIcon = false,
|
||||
});
|
||||
|
||||
final Key key;
|
||||
final IconData icon;
|
||||
final IconData activeIcon;
|
||||
final String asset;
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
final int? count;
|
||||
final Key? countKey;
|
||||
final bool selected;
|
||||
final bool mirrorIcon;
|
||||
}
|
||||
|
||||
/// 播放页与首页 feed 共用的右侧互动栏:收藏/评论/喜欢/分享。
|
||||
@@ -61,10 +57,6 @@ class _RailButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final icon = Icon(
|
||||
item.selected ? item.activeIcon : item.icon,
|
||||
size: _iconSize,
|
||||
);
|
||||
return Column(
|
||||
key: item.key,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -74,10 +66,14 @@ class _RailButton extends StatelessWidget {
|
||||
child: IconButton(
|
||||
onPressed: item.onTap,
|
||||
padding: EdgeInsets.zero,
|
||||
color: item.selected ? AppColors.blue : Colors.white,
|
||||
icon: item.mirrorIcon
|
||||
? Transform.flip(flipX: true, child: icon)
|
||||
: icon,
|
||||
icon: Image.asset(
|
||||
item.asset,
|
||||
width: _iconSize,
|
||||
height: _iconSize,
|
||||
fit: BoxFit.contain,
|
||||
color: item.selected ? AppColors.blue : Colors.white,
|
||||
colorBlendMode: BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
|
||||
@@ -147,8 +147,7 @@ class PlayerPlaybackOverlay extends StatelessWidget {
|
||||
items: [
|
||||
InteractionRailItem(
|
||||
key: const Key('player-rail-save'),
|
||||
icon: Icons.star_rounded,
|
||||
activeIcon: Icons.star_rounded,
|
||||
asset: 'assets/icon/rail/rail_save.png',
|
||||
label: data.l10n.favorite,
|
||||
count: data.favoriteCount,
|
||||
countKey: const Key('player-rail-save-count'),
|
||||
@@ -157,8 +156,7 @@ class PlayerPlaybackOverlay extends StatelessWidget {
|
||||
),
|
||||
InteractionRailItem(
|
||||
key: const Key('player-rail-comments'),
|
||||
icon: Icons.chat_bubble_outline_rounded,
|
||||
activeIcon: Icons.chat_bubble_rounded,
|
||||
asset: 'assets/icon/rail/rail_comment.png',
|
||||
label: data.l10n.comments,
|
||||
count: data.commentCount,
|
||||
countKey: const Key('player-rail-comments-count'),
|
||||
@@ -166,8 +164,7 @@ class PlayerPlaybackOverlay extends StatelessWidget {
|
||||
),
|
||||
InteractionRailItem(
|
||||
key: const Key('player-rail-like'),
|
||||
icon: Icons.favorite_rounded,
|
||||
activeIcon: Icons.favorite_rounded,
|
||||
asset: 'assets/icon/rail/rail_like.png',
|
||||
label: data.l10n.like,
|
||||
count: data.likeCount,
|
||||
countKey: const Key('player-rail-like-count'),
|
||||
@@ -176,10 +173,8 @@ class PlayerPlaybackOverlay extends StatelessWidget {
|
||||
),
|
||||
InteractionRailItem(
|
||||
key: const Key('player-rail-share'),
|
||||
icon: Icons.reply_rounded,
|
||||
activeIcon: Icons.reply_rounded,
|
||||
asset: 'assets/icon/rail/rail_share.png',
|
||||
label: data.l10n.share,
|
||||
mirrorIcon: true,
|
||||
onTap: actions.onShare,
|
||||
),
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user