fix(favorite): 统一收藏状态与互动图标

This commit is contained in:
Zhou Weidong committed 2026-10-27 09:31:48 +08:00
1 parent 4b97f89c0b
commit d3dbc9f8dc
13 files changed
+347 -213

No files matched your search

+50 -10
View File
@@ -323,19 +323,59 @@ void main() {
tester.widget<Text>(find.byKey(const Key('rail-save-count'))).data,
'3.2万',
);
expect(
final likeImage = tester.widget<Image>(
find.descendant(
of: find.byKey(const Key('rail-like')),
matching: find.byIcon(Icons.favorite_rounded),
matching: find.byType(Image),
),
findsOneWidget,
);
expect(
final saveImage = tester.widget<Image>(
find.descendant(
of: find.byKey(const Key('rail-save')),
matching: find.byIcon(Icons.bookmark_border_rounded),
matching: find.byType(Image),
),
findsOneWidget,
);
expect(
(likeImage.image as AssetImage).assetName,
'assets/icon/rail/rail_like.png',
);
expect(likeImage.color, AppColors.doubleTapHeartRed);
expect(
(saveImage.image as AssetImage).assetName,
'assets/icon/rail/rail_save.png',
);
expect(saveImage.color, AppColors.onPrimary);
expect(find.byKey(const Key('rail-comments')), findsOneWidget);
expect(find.byKey(const Key('rail-share')), findsOneWidget);
expect(
tester.widget<Text>(find.byKey(const Key('rail-comments-count'))).data,
'12',
);
expect(
(tester
.widget<Image>(
find.descendant(
of: find.byKey(const Key('rail-comments')),
matching: find.byType(Image),
),
)
.image
as AssetImage)
.assetName,
'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(
@@ -345,9 +385,6 @@ void main() {
),
findsOneWidget,
);
expect(find.byKey(const Key('rail-comments')), findsNothing);
expect(find.byKey(const Key('rail-share')), findsNothing);
expect(find.text('Comments'), findsNothing);
expect(
tester.getRect(find.byKey(const Key('home-feed-action-rail'))).right,
closeTo(
@@ -672,7 +709,10 @@ void main() {
final previewDecoration = previewContainer.decoration! as BoxDecoration;
expect(previewDecoration.color, AppColors.card);
expect(previewDecoration.borderRadius, BorderRadius.circular(8));
expect((previewDecoration.border! as Border).top.color, AppColors.onPrimary);
expect(
(previewDecoration.border! as Border).top.color,
AppColors.onPrimary,
);
await gesture.moveBy(const Offset(-600, 0));
await tester.pump();
expect(