fix(player): 收紧推荐页互动栏间距
This commit is contained in:
1 parent
d3dbc9f8dc
commit
4c3acb047c
5 files changed
+34
-32
No files matched your search
@@ -273,7 +273,6 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
|
|||||||
onSave: widget.onSave,
|
onSave: widget.onSave,
|
||||||
onLike: widget.onLike,
|
onLike: widget.onLike,
|
||||||
onComments: widget.onComments,
|
onComments: widget.onComments,
|
||||||
onShare: widget.onShare,
|
|
||||||
onEpisodes: widget.onEpisodes ?? widget.onOpenFullPlayer,
|
onEpisodes: widget.onEpisodes ?? widget.onOpenFullPlayer,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,7 +305,6 @@ class HomeFeedActionRail extends StatelessWidget {
|
|||||||
required this.onSave,
|
required this.onSave,
|
||||||
required this.onLike,
|
required this.onLike,
|
||||||
required this.onComments,
|
required this.onComments,
|
||||||
required this.onShare,
|
|
||||||
required this.onEpisodes,
|
required this.onEpisodes,
|
||||||
this.favoriteCount,
|
this.favoriteCount,
|
||||||
this.likeCount,
|
this.likeCount,
|
||||||
@@ -320,13 +319,13 @@ class HomeFeedActionRail extends StatelessWidget {
|
|||||||
final VoidCallback onSave;
|
final VoidCallback onSave;
|
||||||
final VoidCallback onLike;
|
final VoidCallback onLike;
|
||||||
final VoidCallback onComments;
|
final VoidCallback onComments;
|
||||||
final VoidCallback onShare;
|
|
||||||
final VoidCallback onEpisodes;
|
final VoidCallback onEpisodes;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final l10n = AppLocalizations.of(context)!;
|
final l10n = AppLocalizations.of(context)!;
|
||||||
return InteractionRail(
|
return InteractionRail(
|
||||||
|
itemGap: 14,
|
||||||
items: [
|
items: [
|
||||||
InteractionRailItem(
|
InteractionRailItem(
|
||||||
key: const Key('rail-save'),
|
key: const Key('rail-save'),
|
||||||
@@ -337,14 +336,6 @@ class HomeFeedActionRail extends StatelessWidget {
|
|||||||
selected: saved,
|
selected: saved,
|
||||||
onTap: onSave,
|
onTap: onSave,
|
||||||
),
|
),
|
||||||
InteractionRailItem(
|
|
||||||
key: const Key('rail-comments'),
|
|
||||||
asset: 'assets/icon/rail/rail_comment.png',
|
|
||||||
label: l10n.comments,
|
|
||||||
count: commentCount,
|
|
||||||
countKey: const Key('rail-comments-count'),
|
|
||||||
onTap: onComments,
|
|
||||||
),
|
|
||||||
InteractionRailItem(
|
InteractionRailItem(
|
||||||
key: const Key('rail-like'),
|
key: const Key('rail-like'),
|
||||||
asset: 'assets/icon/rail/rail_like.png',
|
asset: 'assets/icon/rail/rail_like.png',
|
||||||
@@ -356,10 +347,12 @@ class HomeFeedActionRail extends StatelessWidget {
|
|||||||
onTap: onLike,
|
onTap: onLike,
|
||||||
),
|
),
|
||||||
InteractionRailItem(
|
InteractionRailItem(
|
||||||
key: const Key('rail-share'),
|
key: const Key('rail-comments'),
|
||||||
asset: 'assets/icon/rail/rail_share.png',
|
asset: 'assets/icon/rail/rail_comment.png',
|
||||||
label: l10n.share,
|
label: l10n.comments,
|
||||||
onTap: onShare,
|
count: commentCount,
|
||||||
|
countKey: const Key('rail-comments-count'),
|
||||||
|
onTap: onComments,
|
||||||
),
|
),
|
||||||
InteractionRailItem(
|
InteractionRailItem(
|
||||||
key: const Key('rail-episodes'),
|
key: const Key('rail-episodes'),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import '../../../core/theme/app_colors.dart';
|
|||||||
|
|
||||||
const double _buttonSize = 44;
|
const double _buttonSize = 44;
|
||||||
const double _iconSize = 32;
|
const double _iconSize = 32;
|
||||||
const double _itemGap = 24;
|
const double _defaultItemGap = 24;
|
||||||
|
|
||||||
/// 互动栏单项:图标、计数与点击。
|
/// 互动栏单项:图标、计数与点击。
|
||||||
class InteractionRailItem {
|
class InteractionRailItem {
|
||||||
@@ -36,9 +36,14 @@ class InteractionRailItem {
|
|||||||
|
|
||||||
/// 播放页与首页 feed 共用的右侧互动栏:收藏/评论/喜欢/分享。
|
/// 播放页与首页 feed 共用的右侧互动栏:收藏/评论/喜欢/分享。
|
||||||
class InteractionRail extends StatelessWidget {
|
class InteractionRail extends StatelessWidget {
|
||||||
const InteractionRail({super.key, required this.items});
|
const InteractionRail({
|
||||||
|
super.key,
|
||||||
|
required this.items,
|
||||||
|
this.itemGap = _defaultItemGap,
|
||||||
|
});
|
||||||
|
|
||||||
final List<InteractionRailItem> items;
|
final List<InteractionRailItem> items;
|
||||||
|
final double itemGap;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -46,7 +51,7 @@ class InteractionRail extends StatelessWidget {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
for (var index = 0; index < items.length; index++) ...[
|
for (var index = 0; index < items.length; index++) ...[
|
||||||
if (index > 0) const SizedBox(height: _itemGap),
|
if (index > 0) SizedBox(height: itemGap),
|
||||||
_RailButton(item: items[index]),
|
_RailButton(item: items[index]),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
expect(saveImage.color, AppColors.onPrimary);
|
expect(saveImage.color, AppColors.onPrimary);
|
||||||
expect(find.byKey(const Key('rail-comments')), findsOneWidget);
|
expect(find.byKey(const Key('rail-comments')), findsOneWidget);
|
||||||
expect(find.byKey(const Key('rail-share')), findsOneWidget);
|
expect(find.byKey(const Key('rail-share')), findsNothing);
|
||||||
expect(
|
expect(
|
||||||
tester.widget<Text>(find.byKey(const Key('rail-comments-count'))).data,
|
tester.widget<Text>(find.byKey(const Key('rail-comments-count'))).data,
|
||||||
'12',
|
'12',
|
||||||
@@ -364,19 +364,6 @@ void main() {
|
|||||||
.assetName,
|
.assetName,
|
||||||
'assets/icon/rail/rail_comment.png',
|
'assets/icon/rail/rail_comment.png',
|
||||||
);
|
);
|
||||||
expect(
|
|
||||||
(tester
|
|
||||||
.widget<Image>(
|
|
||||||
find.descendant(
|
|
||||||
of: find.byKey(const Key('rail-share')),
|
|
||||||
matching: find.byType(Image),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.image
|
|
||||||
as AssetImage)
|
|
||||||
.assetName,
|
|
||||||
'assets/icon/rail/rail_share.png',
|
|
||||||
);
|
|
||||||
expect(find.byKey(const Key('rail-episodes')), findsOneWidget);
|
expect(find.byKey(const Key('rail-episodes')), findsOneWidget);
|
||||||
expect(
|
expect(
|
||||||
find.descendant(
|
find.descendant(
|
||||||
@@ -385,6 +372,13 @@ void main() {
|
|||||||
),
|
),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
);
|
);
|
||||||
|
final saveRect = tester.getRect(find.byKey(const Key('rail-save')));
|
||||||
|
final likeRect = tester.getRect(find.byKey(const Key('rail-like')));
|
||||||
|
final commentsRect = tester.getRect(find.byKey(const Key('rail-comments')));
|
||||||
|
final episodesRect = tester.getRect(find.byKey(const Key('rail-episodes')));
|
||||||
|
expect(likeRect.top - saveRect.bottom, closeTo(14, 0.1));
|
||||||
|
expect(commentsRect.top - likeRect.bottom, closeTo(14, 0.1));
|
||||||
|
expect(episodesRect.top - commentsRect.bottom, closeTo(14, 0.1));
|
||||||
expect(
|
expect(
|
||||||
tester.getRect(find.byKey(const Key('home-feed-action-rail'))).right,
|
tester.getRect(find.byKey(const Key('home-feed-action-rail'))).right,
|
||||||
closeTo(
|
closeTo(
|
||||||
|
|||||||
@@ -1351,6 +1351,17 @@ void main() {
|
|||||||
expect(shareImage.width, 32);
|
expect(shareImage.width, 32);
|
||||||
expect(shareImage.height, 32);
|
expect(shareImage.height, 32);
|
||||||
expect(shareImage.colorBlendMode, BlendMode.srcIn);
|
expect(shareImage.colorBlendMode, BlendMode.srcIn);
|
||||||
|
final saveRect = tester.getRect(find.byKey(const Key('player-rail-save')));
|
||||||
|
final commentsRect = tester.getRect(
|
||||||
|
find.byKey(const Key('player-rail-comments')),
|
||||||
|
);
|
||||||
|
final likeRect = tester.getRect(find.byKey(const Key('player-rail-like')));
|
||||||
|
final shareRect = tester.getRect(
|
||||||
|
find.byKey(const Key('player-rail-share')),
|
||||||
|
);
|
||||||
|
expect(commentsRect.top - saveRect.bottom, closeTo(24, 0.1));
|
||||||
|
expect(likeRect.top - commentsRect.bottom, closeTo(24, 0.1));
|
||||||
|
expect(shareRect.top - likeRect.bottom, closeTo(24, 0.1));
|
||||||
|
|
||||||
final saveButton = tester.widget<IconButton>(
|
final saveButton = tester.widget<IconButton>(
|
||||||
find.descendant(
|
find.descendant(
|
||||||
|
|||||||
Reference in new issue
Block a user