fix(app): float the chat composer as glass, cap the reading width, tidy chat chrome

This commit is contained in:
2026-10-31 03:04:23 +00:00
parent ea0f22dfc7
commit 481b1f6fff
17 changed files with 805 additions and 368 deletions
@@ -193,66 +193,75 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
return ListenableBuilder(
listenable: _controller,
builder: (context, _) {
final controls = chatControlsStyleOf(context);
final body = Column(
children: [
if (_controller.error != null)
ChatErrorNotice(
message: _controller.error!,
onRetry: _controller.refresh,
),
Expanded(
child: Stack(
children: [
ContentWidth(
child: ChatSessionsBody(
sessions: _controller.sessions,
activeSessionId: widget.activeSessionId,
query: _search.text,
loading: _controller.loading,
error: _controller.error,
onOpen: _open,
onRename: _rename,
onClose: _close,
onReopen: (session) =>
_controller.reopen(_sessionId(session)),
onStar: (session) => _controller.star(
_sessionId(session),
session['starred'] != true,
),
onHide: _hide,
onClearSearch: () {
_search.clear();
setState(() {});
},
isUnseen: _controller.isUnseen,
errorFor: _controller.errorFor,
onDismissError: _controller.dismissError,
),
// Built under the page's scaffold, whose media padding carries the
// floating bar's height.
final body = Builder(
builder: (context) => Column(
children: [
// A notice above the list starts below the floating bar; the list
// under it then needs no inset of its own.
if (_controller.error != null)
Padding(
padding: EdgeInsets.only(
top: MediaQuery.paddingOf(context).top,
),
// The web's hide report is a fixed overlay: replacing or
// growing it must never move the list or overflow the screen.
// A standalone Material screen keeps it clear of the FAB.
if (_controller.lastHidden != null)
Positioned(
left: 8,
right: 8,
bottom:
!widget.embedded &&
controls == ChatControlsStyle.material
? 88
: 8,
child: ChatUndoBar(
key: const Key('chat-undo-hide'),
message:
'Hidden on this device; the chat stays on the server.',
onUndo: _undoHide,
child: ChatErrorNotice(
message: _controller.error!,
onRetry: _controller.refresh,
),
),
Expanded(
child: MediaQuery.removePadding(
context: context,
removeTop: _controller.error != null,
child: Stack(
children: [
ContentWidth(
child: ChatSessionsBody(
sessions: _controller.sessions,
activeSessionId: widget.activeSessionId,
query: _search.text,
loading: _controller.loading,
error: _controller.error,
onOpen: _open,
onRename: _rename,
onClose: _close,
onReopen: (session) =>
_controller.reopen(_sessionId(session)),
onStar: (session) => _controller.star(
_sessionId(session),
session['starred'] != true,
),
onHide: _hide,
onClearSearch: () {
_search.clear();
setState(() {});
},
isUnseen: _controller.isUnseen,
errorFor: _controller.errorFor,
onDismissError: _controller.dismissError,
),
),
),
],
// The web's hide report is a fixed overlay: replacing or
// growing it must never move the list or overflow the screen.
if (_controller.lastHidden != null)
Positioned(
left: 8,
right: 8,
bottom: 8,
child: ChatUndoBar(
key: const Key('chat-undo-hide'),
message:
'Hidden on this device; the chat stays on the server.',
onUndo: _undoHide,
),
),
],
),
),
),
),
],
],
),
);
// Under the shell, New chat and Refresh are its bar's actions; the
@@ -291,7 +300,9 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
title: 'Chats',
actions: _actions(),
),
child: SafeArea(child: body),
// The list scrolls behind the bar, which does not fully obstruct;
// it pads its first row by the bar's height itself.
child: SafeArea(top: false, child: body),
);
}
return Scaffold(
@@ -301,13 +312,9 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
title: 'Chats',
actions: _actions(),
),
body: SafeArea(left: false, right: false, bottom: false, child: body),
floatingActionButton: FloatingActionButton.extended(
key: const Key('chat-new-chat-fab'),
onPressed: _newChat,
icon: const Icon(Icons.add),
label: const Text('New chat'),
),
// The list scrolls behind the floating bar; New chat is the bar's
// own action, so there is no second create button.
body: body,
);
},
);
@@ -48,9 +48,11 @@ class CupertinoSessionList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListView(
// Starts below a floating top bar (its height arrives as media top
// padding) and ends clear of a floating bottom bar.
padding: withFloatingBarClearance(
context,
const EdgeInsets.only(bottom: 24),
EdgeInsets.only(top: MediaQuery.paddingOf(context).top, bottom: 24),
),
children: [
for (final section in sections) ..._section(section),