Files
pipelines/app/lib/features/settings/settings_chat_navigation_section.dart
T
alan 130c1e6708 Chat stack: the default, also on a wide phone or tablet; a close button where the pile was
Chat stack is now the default phone chat navigation (a stored choice is
kept), and on Android or iOS it stays on a wide layout (an unfolded
foldable) above the active pane, where floating is ignored too. When
expanded, the pile turns into a close button at its own spot and the
column rises above it; while a chat is dragged that button is the remove
target, replacing the separate x at the bottom. Chat widget tests start
on Quick switch (they run as Android); the stack's tests choose it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 21:47:57 +00:00

84 lines
3.0 KiB
Dart

import 'dart:async';
import 'package:flutter/material.dart';
import '../chat/stack/mobile_chat_navigation.dart';
import 'settings_group.dart';
import 'settings_theme.dart';
/// Chat navigation: how a phone-width window moves between the open chats,
/// with the next chat's peek (Quick switch) or a floating stack of them
/// (Chat stack). Saved on this device and applied at once.
class SettingsChatNavigationSection extends StatelessWidget {
const SettingsChatNavigationSection({super.key, this.controller});
final MobileChatNavigationController? controller;
static const title = 'Mobile chat navigation';
@override
Widget build(BuildContext context) {
final navigation = controller ?? MobileChatNavigationController.instance;
return ListenableBuilder(
listenable: navigation,
builder: (context, _) => SettingsGroup(
title: title,
footer: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Text(
'Saved on this device. Applies on a phone-width window; the '
'Chat stack also stays on a wide phone or tablet layout (an '
'unfolded foldable), beside the chat list.',
),
if (navigation.saveFailed)
Text(
'Could not save; applies until reload.',
style: TextStyle(color: settingsErrorColor(context)),
),
],
),
children: [
SettingsGroupItem(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Semantics(
label: title,
child: Align(
alignment: AlignmentDirectional.centerStart,
child: SegmentedButton<MobileChatNavigation>(
segments: [
for (final mode in MobileChatNavigation.values)
ButtonSegment(
value: mode,
label: Text(
mode.label,
key: ValueKey(
'settings-chat-navigation-${mode.name}',
),
),
icon: Icon(
mode == MobileChatNavigation.quickSwitch
? Icons.splitscreen_outlined
: Icons.layers_outlined,
),
),
],
selected: {navigation.value},
onSelectionChanged: (modes) =>
unawaited(navigation.setValue(modes.first)),
),
),
),
const SizedBox(height: 8),
Text(navigation.value.description),
],
),
),
],
),
);
}
}