fix(player): 评论输入浮层补齐键盘区域实底

This commit is contained in:
Zhou Weidong committed 2026-10-21 14:29:52 +08:00
1 parent 8dc9d55106
commit db6fbd58ea
2 files changed
+20 -12

No files matched your search

@@ -137,22 +137,23 @@ class _CommentComposerSheetState extends State<CommentComposerSheet> {
Positioned( Positioned(
left: 0, left: 0,
right: 0, right: 0,
bottom: _pinnedKeyboardInset, bottom: 0,
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () {}, onTap: () {},
child: SizedBox( child: Material(
key: const Key('comment-composer-sheet'), key: const Key('comment-composer-panel'),
width: double.infinity, color: AppColors.card,
child: Material( clipBehavior: Clip.antiAlias,
color: AppColors.card, borderRadius: const BorderRadius.vertical(
clipBehavior: Clip.antiAlias, top: Radius.circular(_sheetRadius),
borderRadius: const BorderRadius.vertical( ),
top: Radius.circular(_sheetRadius), child: SafeArea(
), top: false,
child: SafeArea( child: Padding(
top: false, padding: EdgeInsets.only(bottom: _pinnedKeyboardInset),
child: Padding( child: Padding(
key: const Key('comment-composer-sheet'),
padding: const EdgeInsets.fromLTRB(16, 12, 16, 12), padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
child: TextFieldTapRegion( child: TextFieldTapRegion(
child: Column( child: Column(
@@ -350,8 +350,10 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final composer = find.byKey(const Key('comment-composer-sheet')); final composer = find.byKey(const Key('comment-composer-sheet'));
final composerPanel = find.byKey(const Key('comment-composer-panel'));
final composerInput = find.byKey(const Key('comment-composer-input')); final composerInput = find.byKey(const Key('comment-composer-input'));
expect(composer, findsOneWidget); expect(composer, findsOneWidget);
expect(composerPanel, findsOneWidget);
final overlayRoot = find.byKey(const Key('comment-composer-overlay')); final overlayRoot = find.byKey(const Key('comment-composer-overlay'));
expect(overlayRoot, findsOneWidget); expect(overlayRoot, findsOneWidget);
final overlayStack = tester.widget<Stack>(overlayRoot); final overlayStack = tester.widget<Stack>(overlayRoot);
@@ -386,8 +388,10 @@ void main() {
await tester.pump(); await tester.pump();
await tester.pump(const Duration(milliseconds: 200)); await tester.pump(const Duration(milliseconds: 200));
final keyboardUpBottom = tester.getBottomLeft(composer).dy; final keyboardUpBottom = tester.getBottomLeft(composer).dy;
final keyboardUpPanelRect = tester.getRect(composerPanel);
expect(tester.getSize(composer).height, closeTo(compactHeight, 0.1)); expect(tester.getSize(composer).height, closeTo(compactHeight, 0.1));
expect(keyboardUpBottom, closeTo(844 - 180, 0.1)); expect(keyboardUpBottom, closeTo(844 - 180, 0.1));
expect(keyboardUpPanelRect.bottom, closeTo(844, 0.1));
expect( expect(
tester.getBottomLeft(composerInput).dy, tester.getBottomLeft(composerInput).dy,
lessThanOrEqualTo(844 - 180), lessThanOrEqualTo(844 - 180),
@@ -398,6 +402,9 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(composer, findsOneWidget); expect(composer, findsOneWidget);
expect(tester.getBottomLeft(composer).dy, closeTo(keyboardUpBottom, 0.1)); expect(tester.getBottomLeft(composer).dy, closeTo(keyboardUpBottom, 0.1));
expect(tester.getRect(composerPanel), keyboardUpPanelRect);
expect(tester.widget<Material>(composerPanel).color, AppColors.card);
expect(tester.getBottomLeft(composerPanel).dy, closeTo(844, 0.1));
expect(commentsSheet, findsOneWidget); expect(commentsSheet, findsOneWidget);
expect(list, findsOneWidget); expect(list, findsOneWidget);
expect(placeholder, findsOneWidget); expect(placeholder, findsOneWidget);