feat(app): Runs and Chat tabs badge running runs and unread chats; unread chat rows carry a New badge

This commit is contained in:
2026-10-23 20:15:01 +01:00
parent 11ab9beb7b
commit d373f4c48e
7 changed files with 247 additions and 5 deletions
@@ -251,14 +251,22 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
return ShellBar(
active: widget.activeSessionId == null,
actions: _actions(),
child: body,
// The Chat tab counts chats with messages not yet seen.
child: ShellBadge(
kind: ShellBadgeKind.unread,
count: _controller.sessions.where(_controller.isUnseen).length,
child: body,
),
);
}
return Column(
children: [
Align(
alignment: AlignmentDirectional.centerEnd,
child: Row(mainAxisSize: MainAxisSize.min, children: _actions()),
child: Row(
mainAxisSize: MainAxisSize.min,
children: _actions(),
),
),
Expanded(child: body),
],
@@ -47,7 +47,9 @@ class ChatSessionRowMeta extends StatelessWidget {
child: FittedBox(
fit: BoxFit.scaleDown,
alignment: AlignmentDirectional.centerEnd,
child: Text(status!, maxLines: 1, style: statusStyle),
child: status == 'New'
? _UnreadBadge(style: statusStyle)
: Text(status!, maxLines: 1, style: statusStyle),
),
),
),
@@ -56,3 +58,30 @@ class ChatSessionRowMeta extends StatelessWidget {
);
}
}
/// A chat with messages not yet seen: the word in a filled pill.
class _UnreadBadge extends StatelessWidget {
const _UnreadBadge({required this.style});
final TextStyle style;
@override
Widget build(BuildContext context) {
final color = style.color ?? const Color(0xFF0A84FF);
return DecoratedBox(
key: const Key('chat-row-unread'),
decoration: ShapeDecoration(color: color, shape: const StadiumBorder()),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 1),
child: Text(
'New',
maxLines: 1,
style: style.copyWith(
color: const Color(0xFFFFFFFF),
fontWeight: FontWeight.w700,
),
),
),
);
}
}
+10 -1
View File
@@ -84,7 +84,16 @@ class RunsList extends StatelessWidget {
],
);
}
return ShellBar(active: active, actions: actions, child: _list(context));
return ShellBar(
active: active,
actions: actions,
// The Runs tab counts runs still executing.
child: ShellBadge(
kind: ShellBadgeKind.running,
count: controller.runs.where((run) => run['executing'] == true).length,
child: _list(context),
),
);
}
Widget _list(BuildContext context) {