fix(player): 评论成功提示改黑色浮层并去除输入弹窗遮罩

This commit is contained in:
Zhou Weidong committed 2026-10-21 13:59:04 +08:00
1 parent c3e6e02e47
commit 5d459dd08a
3 files changed
+274 -200

No files matched your search

+37 -13
View File
@@ -291,21 +291,32 @@ void main() {
await tester.pump(const Duration(milliseconds: 500));
expect(find.byKey(const Key('comment-composer-sheet')), findsNothing);
final successSnackBar = find.byKey(
final successOverlay = find.byKey(
const Key('comment-post-success-snackbar'),
);
expect(successSnackBar, findsOneWidget);
expect(successOverlay, findsOneWidget);
expect(find.text('发表成功'), findsOneWidget);
final snackBar = tester.widget<SnackBar>(successSnackBar);
expect(snackBar.action, isNull);
expect(snackBar.behavior, SnackBarBehavior.floating);
expect(snackBar.duration, const Duration(milliseconds: 1500));
expect(find.byType(SnackBar), findsNothing);
final capsule = tester.widget<Container>(successOverlay);
final decoration = capsule.decoration! as BoxDecoration;
expect(decoration.color, Colors.black.withValues(alpha: 0.82));
expect(decoration.borderRadius, BorderRadius.circular(8));
expect(
tester.getRect(find.text('发表成功')).bottom,
lessThanOrEqualTo(
tester.getRect(find.byKey(const Key('player-comments-sheet'))).top,
),
capsule.padding,
const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
);
final successText = tester.widget<Text>(find.text('发表成功'));
expect(successText.style?.color, Colors.white);
expect(successText.style?.fontSize, 14);
final placeholderRect = tester.getRect(
find.byKey(const Key('comment-input-placeholder')),
);
expect(
tester.getRect(successOverlay).bottom,
lessThan(placeholderRect.top),
);
await tester.pump(const Duration(milliseconds: 1200));
expect(successOverlay, findsNothing);
expect(find.byKey(const Key('comment-list')), findsOneWidget);
expect(find.byKey(const Key('comment-count-label')), findsOneWidget);
expect(find.byKey(const Key('comment-input-placeholder')), findsOneWidget);
@@ -341,6 +352,10 @@ void main() {
final composer = find.byKey(const Key('comment-composer-sheet'));
final composerInput = find.byKey(const Key('comment-composer-input'));
expect(composer, findsOneWidget);
expect(
ModalRoute.of(tester.element(composer))?.barrierColor,
Colors.transparent,
);
final compactHeight = tester.getSize(composer).height;
expect(compactHeight, inInclusiveRange(100, 150));
expect(tester.widget<TextField>(composerInput).focusNode?.hasFocus, isTrue);
@@ -406,12 +421,21 @@ void main() {
await tester.tap(find.byKey(const Key('comment-input-placeholder')));
await tester.pumpAndSettle();
expect(sheet, findsOneWidget);
expect(find.byKey(const Key('comment-composer-sheet')), findsOneWidget);
final composer = find.byKey(const Key('comment-composer-sheet'));
expect(composer, findsOneWidget);
expect(
find.byKey(const Key('comment-composer-dismiss-layer')),
findsOneWidget,
);
await tester.tapAt(const Offset(20, 20));
final sheetRect = tester.getRect(sheet);
final composerRect = tester.getRect(composer);
await tester.tapAt(
Offset(sheetRect.center.dx, (sheetRect.top + composerRect.top) / 2),
);
await tester.pumpAndSettle();
expect(sheet, findsOneWidget);
expect(find.byKey(const Key('comment-composer-sheet')), findsNothing);
expect(composer, findsNothing);
await tester.tapAt(const Offset(20, 20));
await tester.pumpAndSettle();