Animate mobile chat swaps as overlapping raised cards
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/chat/conversation/chat_pane_presentation.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_pane_switch_motion.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_pane_swap_card.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_workspace.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/segmented_bar_overlay.dart';
|
||||
|
||||
@@ -133,7 +134,7 @@ void main() {
|
||||
}
|
||||
|
||||
testWidgets(
|
||||
'one eased swap moves both panes, interruptions retain draft and reveal',
|
||||
'crossing cards overlap with incoming on top; interruption retains state',
|
||||
(tester) async {
|
||||
phone(tester);
|
||||
final controller = ChatWorkspaceController()..open('a');
|
||||
@@ -147,7 +148,7 @@ void main() {
|
||||
bState.controller.text = 'Retained draft';
|
||||
controller.activate(a);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 90));
|
||||
await tester.pump(const Duration(milliseconds: 120));
|
||||
final t = ChatPaneSwitchMotion.curve.transform(.25);
|
||||
expect(tester.getRect(rect(a)).top, closeTo(_peekTop * (1 - t), .5));
|
||||
expect(tester.getRect(rect(b)).top, closeTo(_peekTop * t, .5));
|
||||
@@ -155,6 +156,24 @@ void main() {
|
||||
tester.getSize(find.byKey(const ValueKey('a'))).height,
|
||||
closeTo(tester.getRect(rect(a)).height, .5),
|
||||
);
|
||||
final incoming = tester.getRect(rect(a));
|
||||
final outgoing = tester.getRect(rect(b));
|
||||
expect(incoming.overlaps(outgoing), isTrue);
|
||||
expect(incoming.height + outgoing.height, greaterThan(800));
|
||||
final cards = tester
|
||||
.widgetList<ChatPaneSwapCard>(find.byType(ChatPaneSwapCard))
|
||||
.toList();
|
||||
expect(cards.last.lift, greaterThan(.5));
|
||||
expect(cards.first.lift, 0);
|
||||
final stack = tester.widget<Stack>(
|
||||
find
|
||||
.descendant(
|
||||
of: find.byType(ChatWorkspace),
|
||||
matching: find.byType(Stack),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
expect(stack.children.last.key, ValueKey('chat-workspace-$a'));
|
||||
final beforeA = tester.getRect(rect(a));
|
||||
final beforeB = tester.getRect(rect(b));
|
||||
double reveal(String session) => tester
|
||||
|
||||
Reference in New Issue
Block a user