feat: a settings page, a server footer in the sidebar, and follow-up behaviour
- The sidebar's server switch moves to a footer bar: the connected server's name on the left (tap for the server sheet) and a settings key on the right, matching the first-party phone layout. - Settings has three groups: 外观 (theme mode and seed colour, stored on the device only in shared_preferences), 聊天 (the server's followUpBehavior: steer or queue) and a 宠物 placeholder. The app theme now reads the seed and mode. - The chat's short send while a turn runs uses the configured follow-up behaviour; the long-press sheet offers both and marks the default. The value is read from GET /api/config/settings?surface=mobile on connect, on resume and when the page opens, and written back with PUT. - Tests: settings page groups and choice, sidebar footer naming the server and opening settings, follow-up normalization. - 0.3.17 (317).
This commit is contained in:
1 parent
1aa84a53e5
commit
e646130d1f
13 files changed
+544
-15
No files matched your search
@@ -7,6 +7,7 @@ import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import '../api/models.dart';
|
||||
import '../state.dart';
|
||||
import 'servers_screen.dart';
|
||||
import 'settings_screen.dart';
|
||||
|
||||
/// The session list: a drawer on a phone, a persistent column on a wide
|
||||
/// layout. Sessions are grouped by project, dated within it, and a row swipes
|
||||
@@ -69,11 +70,7 @@ class _SessionListPaneState extends State<SessionListPane> {
|
||||
padding: const EdgeInsets.fromLTRB(4, 6, 4, 0),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.dns_outlined),
|
||||
tooltip: '服务器',
|
||||
onPressed: _instancesSheet,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Expanded(
|
||||
child: Text('会话',
|
||||
style: TextStyle(
|
||||
@@ -132,6 +129,7 @@ class _SessionListPaneState extends State<SessionListPane> {
|
||||
),
|
||||
),
|
||||
Expanded(child: _body(scheme)),
|
||||
_serverFooter(scheme),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -139,6 +137,67 @@ class _SessionListPaneState extends State<SessionListPane> {
|
||||
);
|
||||
}
|
||||
|
||||
/// The bottom bar: the connected server on the left (tap to switch), the
|
||||
/// settings key on the right, as the first-party phone sidebar has it.
|
||||
Widget _serverFooter(ColorScheme scheme) {
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(color: scheme.outlineVariant.withValues(alpha: 0.6)),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 4, 4, 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
onTap: _instancesSheet,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 6, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.dns_outlined,
|
||||
size: 18, color: scheme.onSurfaceVariant),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
_app.connectionName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.settings_outlined),
|
||||
tooltip: '设置',
|
||||
onPressed: _openSettings,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _openSettings() {
|
||||
// A phone's list is a drawer: close it before the settings page covers
|
||||
// the shell.
|
||||
widget.onOpened?.call();
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (_) => SettingsScreen(app: _app),
|
||||
));
|
||||
}
|
||||
|
||||
Widget _body(ColorScheme scheme) {
|
||||
final app = _app;
|
||||
if (app.sessionsLoading && app.sessions.isEmpty) {
|
||||
|
||||
Reference in new issue
Block a user