Keep chat bodies opaque and animate only a small focus accent
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_workspace.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_mobile_panes.dart';
|
||||
|
||||
Widget _host(
|
||||
ChatWorkspaceController controller, {
|
||||
@@ -75,7 +76,7 @@ class _CountLayouts extends RenderProxyBox {
|
||||
Finder _rect(String pane) => find.byKey(ValueKey('chat-workspace-$pane'));
|
||||
void main() {
|
||||
testWidgets(
|
||||
'active chat promotes to top with cheap reveal and stable thread layout',
|
||||
'active chat promotes to top with small focus accent and stable thread layout',
|
||||
(tester) async {
|
||||
tester.view.physicalSize = const Size(560, 800);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
@@ -119,11 +120,27 @@ void main() {
|
||||
final aLayouts = (aState as _DraftState).layouts;
|
||||
final bLayouts = (bState as _DraftState).layouts;
|
||||
await tester.pump(const Duration(milliseconds: 60));
|
||||
final reveal = tester.widget<FadeTransition>(
|
||||
find.byKey(ValueKey('chat-reveal-$first')),
|
||||
final accentFinder = find.byKey(ValueKey('chat-focus-accent-$first'));
|
||||
final accent =
|
||||
tester.widget<CustomPaint>(accentFinder).painter!
|
||||
as ChatPaneFocusAccent;
|
||||
expect(tester.getSize(accentFinder).height, 2);
|
||||
expect(accent.progress.value, greaterThan(0));
|
||||
expect(accent.progress.value, lessThan(1));
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(ChatWorkspace),
|
||||
matching: find.byType(FadeTransition),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(ChatWorkspace),
|
||||
matching: find.byType(SlideTransition),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
expect(reveal.opacity.value, greaterThan(.75));
|
||||
expect(reveal.opacity.value, lessThan(1));
|
||||
// The short animation only composites retained content. In particular,
|
||||
// neither transcript nor composer receives a new size on each tick.
|
||||
expect(
|
||||
@@ -164,9 +181,13 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(tester.getRect(_rect(second)).top, 0);
|
||||
expect(
|
||||
tester
|
||||
.widget<FadeTransition>(find.byKey(ValueKey('chat-reveal-$second')))
|
||||
.opacity
|
||||
(tester
|
||||
.widget<CustomPaint>(
|
||||
find.byKey(ValueKey('chat-focus-accent-$second')),
|
||||
)
|
||||
.painter!
|
||||
as ChatPaneFocusAccent)
|
||||
.progress
|
||||
.value,
|
||||
1,
|
||||
);
|
||||
@@ -200,13 +221,7 @@ void main() {
|
||||
await tester.pump();
|
||||
expect(tester.getSize(_rect(first)).height, closeTo((800 - 6) * .8, 1));
|
||||
expect(tester.getRect(_rect(first)).top, 0);
|
||||
expect(
|
||||
tester
|
||||
.widget<FadeTransition>(find.byKey(ValueKey('chat-reveal-$first')))
|
||||
.opacity
|
||||
.value,
|
||||
1,
|
||||
);
|
||||
expect(find.byKey(ValueKey('chat-focus-accent-$first')), findsNothing);
|
||||
expect(find.byType(_Draft), findsNWidgets(2));
|
||||
expect(find.byType(_Draft, skipOffstage: false), findsNWidgets(3));
|
||||
controller.activate(third);
|
||||
|
||||
Reference in New Issue
Block a user