fix(app): wide Cupertino sidebar, compact run tabs, web-like chat bubbles

This commit is contained in:
2026-10-22 12:25:12 +01:00
parent 522f5a3ae0
commit bc98b6cab8
5 changed files with 236 additions and 47 deletions
@@ -36,22 +36,118 @@ class ChatMessageView extends StatelessWidget {
...content,
],
);
// The web draws the operator's turn right-aligned in an accent-tinted bubble
// and the agent's left-aligned on the neutral surface, both capped to a
// readable measure. The role label stays outside the bubble.
final contentBody = cupertino
? DefaultTextStyle.merge(
style: CupertinoTheme.of(context).textTheme.textStyle,
child: body,
)
: body;
// A Material surface (not a bare DecoratedBox) so the disclosure ListTiles
// inside the bubble keep their ink and background.
final bubble = cupertino
? Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: _bubbleDecoration(context, cupertino, user: user),
child: contentBody,
)
: Material(
color: _bubbleColor(context, cupertino, user: user),
clipBehavior: Clip.antiAlias,
shape: _bubbleShape(context, cupertino, user: user),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
child: contentBody,
),
);
return Semantics(
container: true,
explicitChildNodes: true,
label: '$role message',
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: cupertino
? DefaultTextStyle.merge(
style: CupertinoTheme.of(context).textTheme.textStyle,
child: body,
)
: body,
padding: const EdgeInsets.symmetric(vertical: 6),
child: Align(
alignment: user
? AlignmentDirectional.centerEnd
: AlignmentDirectional.centerStart,
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 560),
child: bubble,
),
),
),
);
}
Color _bubbleColor(BuildContext context, bool cupertino, {required bool user}) {
final accent = cupertino
? CupertinoTheme.of(context).primaryColor
: Theme.of(context).colorScheme.primary;
final surface = cupertino
? CupertinoColors.secondarySystemGroupedBackground.resolveFrom(context)
: Theme.of(context).colorScheme.surfaceContainerLow;
return user ? accent.withValues(alpha: 0.16) : surface;
}
ShapeBorder _bubbleShape(
BuildContext context,
bool cupertino, {
required bool user,
}) {
final accent = cupertino
? CupertinoTheme.of(context).primaryColor
: Theme.of(context).colorScheme.primary;
final border = cupertino
? CupertinoColors.separator.resolveFrom(context)
: Theme.of(context).colorScheme.outlineVariant;
return RoundedRectangleBorder(
side: BorderSide(
color: user ? accent.withValues(alpha: 0.4) : border,
),
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(12),
topRight: const Radius.circular(12),
bottomLeft: Radius.circular(user ? 12 : 4),
bottomRight: Radius.circular(user ? 4 : 12),
),
);
}
BoxDecoration _bubbleDecoration(
BuildContext context,
bool cupertino, {
required bool user,
}) {
final Color accent;
final Color surface;
final Color border;
if (cupertino) {
accent = CupertinoTheme.of(context).primaryColor;
surface = CupertinoColors.secondarySystemGroupedBackground.resolveFrom(
context,
);
border = CupertinoColors.separator.resolveFrom(context);
} else {
final scheme = Theme.of(context).colorScheme;
accent = scheme.primary;
surface = scheme.surfaceContainerLow;
border = scheme.outlineVariant;
}
final radius = BorderRadius.only(
topLeft: const Radius.circular(12),
topRight: const Radius.circular(12),
bottomLeft: Radius.circular(user ? 12 : 4),
bottomRight: Radius.circular(user ? 4 : 12),
);
return BoxDecoration(
color: user ? accent.withValues(alpha: 0.16) : surface,
border: Border.all(color: user ? accent.withValues(alpha: 0.4) : border),
borderRadius: radius,
);
}
TextStyle? _roleStyle(BuildContext context, bool cupertino) =>
(cupertino
? CupertinoTheme.of(context).textTheme.textStyle