WIP chat list actions
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../core/api_gateway.dart';
|
||||
import '../../../../shell/shell_bar.dart';
|
||||
import '../../data/chat_repository.dart';
|
||||
import 'chat_adaptive.dart';
|
||||
import 'chat_session_local.dart';
|
||||
@@ -187,27 +188,6 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
|
||||
final controls = chatControlsStyleOf(context);
|
||||
final body = Column(
|
||||
children: [
|
||||
ChatSearchField(
|
||||
controller: _search,
|
||||
onChanged: (_) => setState(() {}),
|
||||
// Embedded under the shell there is no bar of its own: the
|
||||
// create action sits beside search, as the web's chat toolbar.
|
||||
trailing: widget.embedded
|
||||
? [
|
||||
ChatNewChatButton(
|
||||
key: const Key('chat-new-chat'),
|
||||
onPressed: _newChat,
|
||||
),
|
||||
ChatBarAction(
|
||||
key: const Key('chat-refresh'),
|
||||
label: 'Refresh',
|
||||
onPressed: _controller.refresh,
|
||||
materialIcon: Icons.refresh,
|
||||
cupertinoIcon: CupertinoIcons.refresh,
|
||||
),
|
||||
]
|
||||
: const [],
|
||||
),
|
||||
if (_controller.error != null)
|
||||
ChatErrorNotice(
|
||||
message: _controller.error!,
|
||||
@@ -264,7 +244,26 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
|
||||
],
|
||||
);
|
||||
|
||||
if (widget.embedded) return body;
|
||||
// Under the shell, New chat and Refresh are its bar's actions; the
|
||||
// list keeps the space without a search field.
|
||||
if (widget.embedded) {
|
||||
if (ShellBar.available(context)) {
|
||||
return ShellBar(
|
||||
active: widget.activeSessionId == null,
|
||||
actions: _actions(),
|
||||
child: body,
|
||||
);
|
||||
}
|
||||
return Column(
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: Row(mainAxisSize: MainAxisSize.min, children: _actions()),
|
||||
),
|
||||
Expanded(child: body),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
if (chatControlsStyleOf(context) == ChatControlsStyle.cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
|
||||
Reference in New Issue
Block a user