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
@@ -125,7 +125,10 @@ class ScrollWhenOverflowing extends StatelessWidget {
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: ConstrainedBox(
constraints: BoxConstraints(minWidth: constraints.maxWidth),
// Content width, not the pane width: the web's tabs are compact
// and left-aligned, not a full-width segmented bar. The scroll
// view still reveals every segment on a narrow pane.
constraints: const BoxConstraints(),
child: child,
),
),
+28 -22
View File
@@ -52,29 +52,10 @@ class RunsList extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
child: Align(
alignment: AlignmentDirectional.centerEnd,
child: NeedsYouRunsHeading(
rows: controller.runs,
frames: controller.repository.gateway.frames,
onOpen: (entry) => onSelected(entry.runId),
syncToken: syncToken,
store: attentionStore,
now: attentionNow,
notifications: notifications,
),
),
),
if (controller.usage != null)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Text('Usage: ${controller.usage}'),
),
_heading(context),
if (controller.error != null) _inlineError(context),
Padding(
padding: const EdgeInsets.all(16),
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
child: usesCupertinoHost(context)
? CupertinoSearchTextField(
placeholder: 'Filter runs',
@@ -92,8 +73,10 @@ class RunsList extends StatelessWidget {
Expanded(
child: controller.visibleRuns.isEmpty
? const Center(child: Text('No runs found.'))
: ListView.builder(
: ListView.separated(
itemCount: controller.visibleRuns.length,
separatorBuilder: (context, index) =>
const Divider(height: 1),
itemBuilder: (context, index) =>
_runTile(context, controller.visibleRuns[index]),
),
@@ -102,6 +85,29 @@ class RunsList extends StatelessWidget {
);
}
Widget _heading(BuildContext context) => Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: controller.usage == null
? const SizedBox.shrink()
: Text('Usage: ${controller.usage}'),
),
NeedsYouRunsHeading(
rows: controller.runs,
frames: controller.repository.gateway.frames,
onOpen: (entry) => onSelected(entry.runId),
syncToken: syncToken,
store: attentionStore,
now: attentionNow,
notifications: notifications,
),
],
),
);
Widget _emptyError(BuildContext context) => Center(
child: Column(
mainAxisSize: MainAxisSize.min,