merge(app): land chat card alignment
This commit is contained in:
@@ -223,6 +223,9 @@ class ChatPermissionCard extends StatelessWidget {
|
||||
);
|
||||
|
||||
Widget _cupertino(BuildContext context) => CupertinoListSection.insetGrouped(
|
||||
// As the Material card: the transcript row owns the horizontal inset, so
|
||||
// the card lines up with the message bubbles.
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
|
||||
@@ -136,6 +136,9 @@ class _ChatQuestionCardState extends State<ChatQuestionCard> {
|
||||
: body;
|
||||
if (cupertino) {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
// As the Material card: the transcript row owns the horizontal inset,
|
||||
// so the card lines up with the message bubbles.
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
children: [Padding(padding: const EdgeInsets.all(16), child: wrapped)],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/chat/conversation/chat_permission_card.dart';
|
||||
import 'package:pipelines_app/features/chat/conversation/chat_permission_card_model.dart';
|
||||
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
|
||||
import 'package:pipelines_app/features/chat/ui/transcript/chat_message_view.dart';
|
||||
|
||||
import 'chat_thread_fixtures.dart';
|
||||
|
||||
@@ -76,10 +77,7 @@ void main() {
|
||||
' cd /workspace/demo',
|
||||
'command: |\n echo hello',
|
||||
]);
|
||||
expect(
|
||||
card.resourceText,
|
||||
' cd /workspace/demo\ncommand: |\n echo hello',
|
||||
);
|
||||
expect(card.resourceText, ' cd /workspace/demo\ncommand: |\n echo hello');
|
||||
});
|
||||
|
||||
test('risk falls back to the action and resources cap at six lines', () {
|
||||
@@ -402,14 +400,77 @@ void main() {
|
||||
|
||||
final first = tester.getRect(
|
||||
find
|
||||
.descendant(of: find.byType(Card).at(0), matching: find.byType(Material))
|
||||
.descendant(
|
||||
of: find.byType(Card).at(0),
|
||||
matching: find.byType(Material),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
final second = tester.getRect(
|
||||
find
|
||||
.descendant(of: find.byType(Card).at(1), matching: find.byType(Material))
|
||||
.descendant(
|
||||
of: find.byType(Card).at(1),
|
||||
matching: find.byType(Material),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
expect(second.top - first.bottom, greaterThanOrEqualTo(12));
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'a Cupertino card lines up with the message bubbles',
|
||||
(tester) async {
|
||||
final gateway = FakeChatGateway();
|
||||
addTearDown(gateway.close);
|
||||
gateway.history = (_) async => chatPage([
|
||||
chatMessage(
|
||||
'u1',
|
||||
'user',
|
||||
parts: [
|
||||
{'type': 'text', 'text': 'Show me the card'},
|
||||
],
|
||||
),
|
||||
]);
|
||||
await tester.pumpWidget(
|
||||
CupertinoApp(
|
||||
home: CupertinoPageScaffold(
|
||||
child: ChatThreadView(
|
||||
gateway: gateway,
|
||||
sessionId: 's',
|
||||
onBack: () {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
gateway.emitRaw({
|
||||
'type': 'chat_permission',
|
||||
'chat_permission': permission(),
|
||||
});
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final bubble = tester.getRect(
|
||||
find.ancestor(
|
||||
of: find.text('Show me the card'),
|
||||
matching: find.byType(ChatMessageView),
|
||||
),
|
||||
);
|
||||
// The card's own box includes the section margin, so measure its body.
|
||||
final body = tester.getRect(
|
||||
find
|
||||
.descendant(
|
||||
of: find.byType(ChatPermissionCard),
|
||||
matching: find.byWidgetPredicate(
|
||||
(widget) =>
|
||||
widget is Padding &&
|
||||
widget.padding == const EdgeInsets.all(16),
|
||||
),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
expect(body.left, bubble.left);
|
||||
expect(body.right, bubble.right);
|
||||
},
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user