Restore requested navigation and mobile chat controls
This commit is contained in:
@@ -133,13 +133,21 @@ class _ChatModeControlState extends State<ChatModeControl> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Tooltip(
|
return Semantics(
|
||||||
message: 'Change mode (currently $label)',
|
container: true,
|
||||||
child: TextButton(
|
button: true,
|
||||||
key: key,
|
label: 'Change mode, currently $label',
|
||||||
style: chatBarTextButtonStyle(context),
|
onTap: _open,
|
||||||
onPressed: _open,
|
child: ExcludeSemantics(
|
||||||
child: content,
|
child: Tooltip(
|
||||||
|
message: 'Change mode (currently $label)',
|
||||||
|
child: TextButton(
|
||||||
|
key: key,
|
||||||
|
style: chatBarTextButtonStyle(context),
|
||||||
|
onPressed: _open,
|
||||||
|
child: content,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,13 +146,21 @@ class _ChatModelControlState extends State<ChatModelControl> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Tooltip(
|
return Semantics(
|
||||||
message: 'Change model (currently $label)',
|
container: true,
|
||||||
child: TextButton(
|
button: true,
|
||||||
key: key,
|
label: 'Change model, currently $label',
|
||||||
style: chatBarTextButtonStyle(context),
|
onTap: _open,
|
||||||
onPressed: _open,
|
child: ExcludeSemantics(
|
||||||
child: content,
|
child: Tooltip(
|
||||||
|
message: 'Change model (currently $label)',
|
||||||
|
child: TextButton(
|
||||||
|
key: key,
|
||||||
|
style: chatBarTextButtonStyle(context),
|
||||||
|
onPressed: _open,
|
||||||
|
child: content,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import '../ui/sessions/chat_adaptive.dart';
|
|||||||
/// pill with the conversation's title and folder that opens the chat's
|
/// pill with the conversation's title and folder that opens the chat's
|
||||||
/// information, a selector island holding [controls] (model and mode),
|
/// information, a selector island holding [controls] (model and mode),
|
||||||
/// then the Files action and a native More menu in a separate island.
|
/// then the Files action and a native More menu in a separate island.
|
||||||
/// Narrow panes give readable model/mode values a separate row; exceptionally
|
/// Narrow panes keep the model/mode selectors as compact icons in the same row;
|
||||||
/// short viewports can scroll the header to keep controls reachable.
|
/// their semantic labels and native pickers continue to expose the values.
|
||||||
class ChatThreadHeader extends StatelessWidget {
|
class ChatThreadHeader extends StatelessWidget {
|
||||||
const ChatThreadHeader({
|
const ChatThreadHeader({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -53,8 +53,7 @@ class ChatThreadHeader extends StatelessWidget {
|
|||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
final textScale = MediaQuery.textScalerOf(context).scale(14) / 14;
|
final textScale = MediaQuery.textScalerOf(context).scale(14) / 14;
|
||||||
final readableWidth = constraints.maxWidth / textScale;
|
final compact = constraints.maxWidth / textScale < 800;
|
||||||
final narrow = readableWidth < 800;
|
|
||||||
final bar = SegmentedBar(
|
final bar = SegmentedBar(
|
||||||
cupertino: cupertino,
|
cupertino: cupertino,
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
@@ -77,7 +76,7 @@ class ChatThreadHeader extends StatelessWidget {
|
|||||||
titleKey: const Key('chat-info'),
|
titleKey: const Key('chat-info'),
|
||||||
separateActionIslands: true,
|
separateActionIslands: true,
|
||||||
actions: [
|
actions: [
|
||||||
if (!narrow && controls.isNotEmpty)
|
if (controls.isNotEmpty)
|
||||||
_ControlIsland(
|
_ControlIsland(
|
||||||
key: const Key('chat-model-permission-island'),
|
key: const Key('chat-model-permission-island'),
|
||||||
children: controls,
|
children: controls,
|
||||||
@@ -104,35 +103,14 @@ class ChatThreadHeader extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
bottomPadding: narrow ? 8 : 16,
|
bottomPadding: compact ? 8 : 16,
|
||||||
backdrop: backdrop,
|
backdrop: backdrop,
|
||||||
);
|
);
|
||||||
return ColoredBox(
|
return ColoredBox(
|
||||||
color: cupertino
|
color: cupertino
|
||||||
? CupertinoTheme.of(context).scaffoldBackgroundColor
|
? CupertinoTheme.of(context).scaffoldBackgroundColor
|
||||||
: Theme.of(context).colorScheme.surface,
|
: Theme.of(context).colorScheme.surface,
|
||||||
child: SingleChildScrollView(
|
child: bar,
|
||||||
primary: false,
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
bar,
|
|
||||||
if (narrow && controls.isNotEmpty)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(12, 0, 12, 8),
|
|
||||||
child: SegmentedPill(
|
|
||||||
cupertino: cupertino,
|
|
||||||
child: _ControlIsland(
|
|
||||||
key: const Key('chat-model-permission-island'),
|
|
||||||
fill: true,
|
|
||||||
vertical: readableWidth < 340,
|
|
||||||
children: controls,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -142,27 +120,12 @@ class ChatThreadHeader extends StatelessWidget {
|
|||||||
/// Related selectors share the available width. Each remains a real control;
|
/// Related selectors share the available width. Each remains a real control;
|
||||||
/// they never migrate into the unrelated actions menu.
|
/// they never migrate into the unrelated actions menu.
|
||||||
class _ControlIsland extends StatelessWidget {
|
class _ControlIsland extends StatelessWidget {
|
||||||
const _ControlIsland({
|
const _ControlIsland({super.key, required this.children});
|
||||||
super.key,
|
|
||||||
required this.children,
|
|
||||||
this.fill = false,
|
|
||||||
this.vertical = false,
|
|
||||||
});
|
|
||||||
final List<Widget> children;
|
final List<Widget> children;
|
||||||
final bool fill;
|
|
||||||
final bool vertical;
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => vertical
|
Widget build(BuildContext context) => Row(
|
||||||
? Column(
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisSize: MainAxisSize.min,
|
children: [for (final child in children) Flexible(child: child)],
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
);
|
||||||
children: children,
|
|
||||||
)
|
|
||||||
: Row(
|
|
||||||
mainAxisSize: fill ? MainAxisSize.max : MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
for (final child in children)
|
|
||||||
if (fill) Expanded(child: child) else Flexible(child: child),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1342,7 +1342,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
|||||||
controls: [
|
controls: [
|
||||||
if (hasModel)
|
if (hasModel)
|
||||||
ChatModelControl(
|
ChatModelControl(
|
||||||
showLabel: true,
|
|
||||||
key: ValueKey<String>('chat-model-${widget.sessionId}'),
|
key: ValueKey<String>('chat-model-${widget.sessionId}'),
|
||||||
gateway: widget.gateway,
|
gateway: widget.gateway,
|
||||||
sessionId: widget.sessionId,
|
sessionId: widget.sessionId,
|
||||||
@@ -1358,7 +1357,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
|||||||
/// The session's permission mode, keyed per session so another chat
|
/// The session's permission mode, keyed per session so another chat
|
||||||
/// re-reads its own modes.
|
/// re-reads its own modes.
|
||||||
Widget _modeControl() => ChatModeControl(
|
Widget _modeControl() => ChatModeControl(
|
||||||
showLabel: true,
|
|
||||||
key: ValueKey<String>('chat-mode-${widget.sessionId}'),
|
key: ValueKey<String>('chat-mode-${widget.sessionId}'),
|
||||||
gateway: widget.gateway,
|
gateway: widget.gateway,
|
||||||
sessionId: widget.sessionId,
|
sessionId: widget.sessionId,
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
|||||||
// remounts a destination.
|
// remounts a destination.
|
||||||
//
|
//
|
||||||
// While the tab shows its list beside an open item the bar moves under
|
// While the tab shows its list beside an open item the bar moves under
|
||||||
// the list pane, centred in the list's (dragged) width, so the open item
|
// the leading edge of the list pane, so the open item
|
||||||
// keeps its whole height: the list clears the bar and the item clears
|
// keeps its whole height: the list clears the bar and the item clears
|
||||||
// only the system inset (see ListDetailPanes). The bar keeps its place
|
// only the system inset (see ListDetailPanes). The bar keeps its place
|
||||||
// in the tree, so a split never replays its entrance.
|
// in the tree, so a split never replays its entrance.
|
||||||
@@ -198,7 +198,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
|||||||
currentIndex: index,
|
currentIndex: index,
|
||||||
onTap: (value) => _select(shellTabDestinations[value]),
|
onTap: (value) => _select(shellTabDestinations[value]),
|
||||||
items: _destinationItems(),
|
items: _destinationItems(),
|
||||||
alignment: split ? Alignment.bottomCenter : null,
|
alignment: split ? AlignmentDirectional.bottomStart : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,10 +13,11 @@ import 'floating_destination_labels.dart';
|
|||||||
/// frosted [GlassPill] buttons, one per tab, instead of a full-width system
|
/// frosted [GlassPill] buttons, one per tab, instead of a full-width system
|
||||||
/// bar. Used for the app's destinations and for every page's own tabs.
|
/// bar. Used for the app's destinations and for every page's own tabs.
|
||||||
///
|
///
|
||||||
/// The row is only as wide as its buttons and sits at the trailing (right,
|
/// The row is only as wide as its buttons and, by default, sits at the trailing
|
||||||
/// in left-to-right text) edge, near the thumb, keeping [kFloatingBarMargin]
|
/// (right, in left-to-right text) edge, near the thumb, keeping
|
||||||
/// from the sides and above the bottom safe area. Only the buttons take
|
/// [kFloatingBarMargin] from the sides and above the bottom safe area. Hosts
|
||||||
/// taps: the gaps between and beside them reach the content behind. A row
|
/// can request another alignment for a pane-specific layout. Only the buttons
|
||||||
|
/// take taps: the gaps between and beside them reach the content behind. A row
|
||||||
/// squeezed below its natural width narrows its gaps, then scales down.
|
/// squeezed below its natural width narrows its gaps, then scales down.
|
||||||
///
|
///
|
||||||
/// The selected button is filled with the host's selection tint, which
|
/// The selected button is filled with the host's selection tint, which
|
||||||
@@ -48,8 +49,8 @@ class FloatingDestinationBar extends StatefulWidget {
|
|||||||
final bool showLabels;
|
final bool showLabels;
|
||||||
|
|
||||||
/// Where the row sits in the width it is given, at [FloatingBarEdge.bottom]:
|
/// Where the row sits in the width it is given, at [FloatingBarEdge.bottom]:
|
||||||
/// the trailing end by default. The shell centres its tabs under the list
|
/// the trailing end by default. The shell can align its main tabs to the
|
||||||
/// pane while a list shows beside an open item.
|
/// leading edge of a list pane while a list shows beside an open item.
|
||||||
final AlignmentGeometry? alignment;
|
final AlignmentGeometry? alignment;
|
||||||
|
|
||||||
/// The edge the bar floats at. At [FloatingBarEdge.top] (an open item's
|
/// The edge the bar floats at. At [FloatingBarEdge.top] (an open item's
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# Desktop main tabs leading alignment
|
||||||
|
|
||||||
|
Wide list-detail layouts now place the main destination tab row at the leading
|
||||||
|
edge of the list pane. Narrow layouts retain their trailing placement, and
|
||||||
|
page-specific tab bars remain unchanged. Focused shell tests cover Material and
|
||||||
|
Cupertino geometry, including stored pane widths.
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Mobile chat selector controls
|
||||||
|
|
||||||
|
- Mobile chat headers keep model and permission-mode selectors in the single top row, together in their selector island before Files and More.
|
||||||
|
- Mobile uses the existing memory and shield icons; semantic labels/tooltips retain the current-value explanation and native pickers.
|
||||||
|
- Desktop keeps the existing readable selector labels and picker behavior.
|
||||||
|
- Focused checks: `tool/memwatch/full.sh 'test/features/chat/conversation/chat_thread_header_test.dart test/features/chat/conversation/chat_model_picker_test.dart'` — 28 passed.
|
||||||
|
- `tool/analyze.sh` — clean.
|
||||||
|
- Fixture-browser captures were inspected for Material/Cupertino mobile (560x1000) and desktop (1280x1000), light theme:
|
||||||
|
- `public/chat-material-mobile/01-mobile-material.png`
|
||||||
|
- `public/chat-cupertino-mobile/01-mobile-cupertino.png`
|
||||||
|
- `public/chat-material-desktop/01-desktop-material.png`
|
||||||
|
- `public/chat-cupertino-desktop/01-desktop-cupertino.png`
|
||||||
|
- No device installation or deployment was performed.
|
||||||
@@ -38,7 +38,7 @@ void _useNarrowText(WidgetTester tester) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('short large-text header scrolls controls without overflow', (
|
testWidgets('short large-text header keeps controls in its single row', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
_useNarrowText(tester);
|
_useNarrowText(tester);
|
||||||
@@ -55,15 +55,9 @@ void main() {
|
|||||||
onInfo: () {},
|
onInfo: () {},
|
||||||
showBack: true,
|
showBack: true,
|
||||||
onBack: () {},
|
onBack: () {},
|
||||||
controls: [
|
controls: const [
|
||||||
TextButton(
|
IconButton(onPressed: null, icon: Icon(Icons.memory_outlined)),
|
||||||
onPressed: () {},
|
IconButton(onPressed: null, icon: Icon(Icons.shield_outlined)),
|
||||||
child: const Text('Current model'),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {},
|
|
||||||
child: const Text('Ask for permission'),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -73,9 +67,10 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(tester.takeException(), isNull);
|
expect(tester.takeException(), isNull);
|
||||||
await tester.ensureVisible(find.text('Ask for permission'));
|
expect(
|
||||||
await tester.pumpAndSettle();
|
find.byKey(const Key('chat-model-permission-island')),
|
||||||
expect(find.text('Ask for permission').hitTestable(), findsOneWidget);
|
findsOneWidget,
|
||||||
|
);
|
||||||
expect(tester.takeException(), isNull);
|
expect(tester.takeException(), isNull);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -83,7 +78,7 @@ void main() {
|
|||||||
final host = cupertino ? 'Cupertino' : 'Material';
|
final host = cupertino ? 'Cupertino' : 'Material';
|
||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'$host narrow header keeps native back/title and readable model',
|
'$host narrow header keeps native back/title and compact model icon',
|
||||||
(tester) async {
|
(tester) async {
|
||||||
_useNarrowText(tester);
|
_useNarrowText(tester);
|
||||||
final semantics = tester.ensureSemantics();
|
final semantics = tester.ensureSemantics();
|
||||||
@@ -124,19 +119,22 @@ void main() {
|
|||||||
|
|
||||||
// One floating row of separate pieces: the round Back, the title pill
|
// One floating row of separate pieces: the round Back, the title pill
|
||||||
// (which is the information control and holds the title), then the
|
// (which is the information control and holds the title), then the
|
||||||
// model in the trailing pill.
|
// selector island in the trailing row.
|
||||||
double centerY(Finder finder) => tester.getCenter(finder).dy;
|
double centerY(Finder finder) => tester.getCenter(finder).dy;
|
||||||
expect((centerY(back) - centerY(info)).abs(), lessThan(16));
|
expect((centerY(back) - centerY(info)).abs(), lessThan(16));
|
||||||
expect(
|
expect((centerY(model) - centerY(info)).abs(), lessThan(16));
|
||||||
tester.getTopLeft(model).dy,
|
|
||||||
greaterThanOrEqualTo(tester.getBottomLeft(info).dy),
|
|
||||||
);
|
|
||||||
expect(find.descendant(of: info, matching: title), findsOneWidget);
|
expect(find.descendant(of: info, matching: title), findsOneWidget);
|
||||||
double right(Finder finder) => tester.getTopRight(finder).dx;
|
double right(Finder finder) => tester.getTopRight(finder).dx;
|
||||||
expect(right(back), lessThanOrEqualTo(tester.getTopLeft(info).dx));
|
expect(right(back), lessThanOrEqualTo(tester.getTopLeft(info).dx));
|
||||||
|
expect(find.byIcon(Icons.memory_outlined), findsOneWidget);
|
||||||
|
if (!cupertino) {
|
||||||
|
final semantics = tester.getSemantics(model);
|
||||||
|
expect(semantics.label, contains('Change model'));
|
||||||
|
expect(semantics.label, contains('currently'));
|
||||||
|
}
|
||||||
expect(
|
expect(
|
||||||
find.textContaining('an-extremely-long-recorded-model-id'),
|
find.textContaining('an-extremely-long-recorded-model-id'),
|
||||||
findsOneWidget,
|
findsNothing,
|
||||||
);
|
);
|
||||||
|
|
||||||
await tester.tap(back);
|
await tester.tap(back);
|
||||||
@@ -199,21 +197,43 @@ void main() {
|
|||||||
final actions = find.byKey(const Key('chat-actions-island'));
|
final actions = find.byKey(const Key('chat-actions-island'));
|
||||||
expect(selectors, findsOneWidget);
|
expect(selectors, findsOneWidget);
|
||||||
expect(actions, findsOneWidget);
|
expect(actions, findsOneWidget);
|
||||||
if (width / 2 >= 800) {
|
expect(
|
||||||
expect(
|
(tester.getCenter(selectors).dy - tester.getCenter(actions).dy)
|
||||||
tester.getTopRight(selectors).dx,
|
.abs(),
|
||||||
lessThan(tester.getTopLeft(actions).dx),
|
lessThan(16),
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
expect(
|
|
||||||
tester.getTopLeft(selectors).dy,
|
|
||||||
greaterThanOrEqualTo(tester.getBottomLeft(actions).dy),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
expect(find.byKey(const Key('chat-next')), findsNothing);
|
expect(find.byKey(const Key('chat-next')), findsNothing);
|
||||||
expect(find.text('Next chat'), findsNothing);
|
expect(find.text('Next chat'), findsNothing);
|
||||||
expect(find.byKey(const Key('chat-model')), findsOneWidget);
|
expect(find.byKey(const Key('chat-model')), findsOneWidget);
|
||||||
expect(find.byKey(const Key('chat-mode')), findsOneWidget);
|
expect(find.byKey(const Key('chat-mode')), findsOneWidget);
|
||||||
|
if (width < 600) {
|
||||||
|
expect(find.text('model-a'), findsNothing);
|
||||||
|
expect(find.text('Ask before making changes'), findsNothing);
|
||||||
|
expect(find.byIcon(Icons.memory_outlined), findsOneWidget);
|
||||||
|
expect(
|
||||||
|
find.byIcon(
|
||||||
|
cupertino
|
||||||
|
? CupertinoIcons.shield_lefthalf_fill
|
||||||
|
: Icons.shield_outlined,
|
||||||
|
),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
|
if (!cupertino) {
|
||||||
|
expect(
|
||||||
|
tester.getSemantics(find.byKey(const Key('chat-model'))).label,
|
||||||
|
contains('Change model, currently'),
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
tester.getSemantics(find.byKey(const Key('chat-mode'))).label,
|
||||||
|
contains('Change mode, currently'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
expect(
|
||||||
|
(tester.getCenter(selectors).dy - tester.getCenter(actions).dy)
|
||||||
|
.abs(),
|
||||||
|
lessThan(16),
|
||||||
|
);
|
||||||
|
}
|
||||||
for (final key in ['chat-model', 'chat-mode']) {
|
for (final key in ['chat-model', 'chat-mode']) {
|
||||||
expect(
|
expect(
|
||||||
tester.getSize(find.byKey(Key(key))).width,
|
tester.getSize(find.byKey(Key(key))).width,
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ import 'package:pipelines_app/shell/adaptive_shell.dart';
|
|||||||
import 'package:pipelines_app/shell/destination.dart';
|
import 'package:pipelines_app/shell/destination.dart';
|
||||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||||
import 'package:pipelines_app/ui/adaptive/floating_destination_labels.dart';
|
import 'package:pipelines_app/ui/adaptive/floating_destination_labels.dart';
|
||||||
|
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
|
||||||
|
|
||||||
/// Main navigation keeps visible captions and full-size targets, floating at
|
/// Main navigation keeps visible captions and full-size targets, floating at
|
||||||
/// the trailing edge on a phone and centered under the list on a wide window.
|
/// the trailing edge on a phone and the leading edge under the list on a wide
|
||||||
|
/// window.
|
||||||
void main() {
|
void main() {
|
||||||
Finder pill() => find.descendant(
|
Finder pill() => find.descendant(
|
||||||
of: find.byType(FloatingDestinationBar),
|
of: find.byType(FloatingDestinationBar),
|
||||||
@@ -110,7 +112,7 @@ void main() {
|
|||||||
expect(find.text('Chat — Not implemented'), findsOneWidget);
|
expect(find.text('Chat — Not implemented'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('$host: wide bar hugs its tabs under the list column, content '
|
testWidgets('$host: wide leading bar under the list, content '
|
||||||
'keeps the width and taps beside the bar reach it', (tester) async {
|
'keeps the width and taps beside the bar reach it', (tester) async {
|
||||||
taps = 0;
|
taps = 0;
|
||||||
await setSize(tester, const Size(1200, 800));
|
await setSize(tester, const Size(1200, 800));
|
||||||
@@ -118,13 +120,7 @@ void main() {
|
|||||||
final rect = tester.getRect(pill());
|
final rect = tester.getRect(pill());
|
||||||
// With no item open the bar still sits under the list column, where it
|
// With no item open the bar still sits under the list column, where it
|
||||||
// sits beside an open item, so it never jumps sides.
|
// sits beside an open item, so it never jumps sides.
|
||||||
expect(
|
expect(rect.left, moreOrLessEquals(kFloatingBarMargin, epsilon: 0.5));
|
||||||
rect.center.dx,
|
|
||||||
moreOrLessEquals(
|
|
||||||
listDetailListWidth(1200, 1200, null) / 2,
|
|
||||||
epsilon: 0.5,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
expect(rect.bottom, 800 - 16);
|
expect(rect.bottom, 800 - 16);
|
||||||
expect(rect.width, lessThan(1200 * 0.6));
|
expect(rect.width, lessThan(1200 * 0.6));
|
||||||
// Captions participate in the bar's content-driven width.
|
// Captions participate in the bar's content-driven width.
|
||||||
@@ -179,11 +175,8 @@ void main() {
|
|||||||
tester.view.physicalSize = const Size(1200, 800);
|
tester.view.physicalSize = const Size(1200, 800);
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(
|
expect(
|
||||||
tester.getRect(pill()).center.dx,
|
tester.getRect(pill()).left,
|
||||||
moreOrLessEquals(
|
moreOrLessEquals(kFloatingBarMargin, epsilon: 0.5),
|
||||||
listDetailListWidth(1200, 1200, null) / 2,
|
|
||||||
epsilon: 0.5,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
expect(tester.getRect(pill()).width, lessThan(1200 * 0.6));
|
expect(tester.getRect(pill()).width, lessThan(1200 * 0.6));
|
||||||
expect(tester.state(find.byType(StatefulBuilder)), same(state));
|
expect(tester.state(find.byType(StatefulBuilder)), same(state));
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
|
|||||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||||
|
|
||||||
/// While a tab shows its list beside an open item, the shell's destination
|
/// While a tab shows its list beside an open item, the shell's destination
|
||||||
/// bar moves to the bottom of the list pane, centred in the list's (dragged)
|
/// bar moves to the leading edge at the bottom of the list pane, including
|
||||||
/// width. The list clears the bar; the item keeps its whole height, its own
|
/// after the list's width is dragged. The list clears the bar; the item keeps its whole height, its own
|
||||||
/// bottom control (its tabs, or a composer) at its bottom edge.
|
/// bottom control (its tabs, or a composer) at its bottom edge.
|
||||||
void main() {
|
void main() {
|
||||||
Future<void> setSize(WidgetTester tester, Size size) async {
|
Future<void> setSize(WidgetTester tester, Size size) async {
|
||||||
@@ -128,8 +128,8 @@ void main() {
|
|||||||
find.byKey(const ValueKey('list-detail-body')),
|
find.byKey(const ValueKey('list-detail-body')),
|
||||||
);
|
);
|
||||||
final pill = destinationPill(tester);
|
final pill = destinationPill(tester);
|
||||||
// Centred at the bottom of the list pane, never over the detail.
|
// Leading at the bottom of the list pane, never over the detail.
|
||||||
expect(pill.center.dx, closeTo(list.center.dx, 0.5));
|
expect(pill.left, closeTo(list.left + kFloatingBarMargin, 0.5));
|
||||||
expect(pill.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
|
expect(pill.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
|
||||||
expect(pill.right, lessThanOrEqualTo(list.right));
|
expect(pill.right, lessThanOrEqualTo(list.right));
|
||||||
expect(pill.overlaps(body), isFalse, reason: 'never over the detail');
|
expect(pill.overlaps(body), isFalse, reason: 'never over the detail');
|
||||||
@@ -227,17 +227,24 @@ void main() {
|
|||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await setSize(tester, const Size(1200, 800));
|
await setSize(tester, const Size(1200, 800));
|
||||||
final store = MemoryListPaneWidthStore({'chat': 300});
|
for (final width in [300.0, 520.0]) {
|
||||||
await tester.pumpWidget(shell(cupertino: cupertino, store: store));
|
final store = MemoryListPaneWidthStore({'chat': width});
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpWidget(
|
||||||
final list = tester.getRect(
|
KeyedSubtree(
|
||||||
find.byKey(const ValueKey('list-detail-list')),
|
key: ValueKey(width),
|
||||||
);
|
child: shell(cupertino: cupertino, store: store),
|
||||||
expect(list.width, closeTo(300, 0.5));
|
),
|
||||||
final pill = destinationPill(tester);
|
);
|
||||||
expect(pill.center.dx, closeTo(list.center.dx, 0.5));
|
await tester.pumpAndSettle();
|
||||||
expect(pill.left, greaterThanOrEqualTo(kFloatingBarMargin - 0.5));
|
final list = tester.getRect(
|
||||||
expect(pill.right, lessThanOrEqualTo(list.right - kFloatingBarMargin));
|
find.byKey(const ValueKey('list-detail-list')),
|
||||||
|
);
|
||||||
|
expect(list.width, closeTo(width, 0.5));
|
||||||
|
final pill = destinationPill(tester);
|
||||||
|
expect(pill.left, closeTo(list.left + kFloatingBarMargin, 0.5));
|
||||||
|
expect(pill.left, greaterThanOrEqualTo(kFloatingBarMargin - 0.5));
|
||||||
|
expect(pill.right, lessThanOrEqualTo(list.right - kFloatingBarMargin));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('$host 1200 Settings: a page without a list keeps the bar '
|
testWidgets('$host 1200 Settings: a page without a list keeps the bar '
|
||||||
@@ -260,10 +267,7 @@ void main() {
|
|||||||
final pill = destinationPill(tester);
|
final pill = destinationPill(tester);
|
||||||
// Same place as beside an open item (Search has no split), so opening
|
// Same place as beside an open item (Search has no split), so opening
|
||||||
// or closing an item never moves the bar across the window.
|
// or closing an item never moves the bar across the window.
|
||||||
expect(
|
expect(pill.left, closeTo(kFloatingBarMargin, 0.5));
|
||||||
pill.center.dx,
|
|
||||||
closeTo(listDetailListWidth(1200, 1200, null) / 2, 0.5),
|
|
||||||
);
|
|
||||||
expect(pill.width, lessThan(1200 * 0.6));
|
expect(pill.width, lessThan(1200 * 0.6));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user