Shell: Settings has no list column, so its tab bar stays at the right edge
This commit is contained in:
@@ -180,8 +180,10 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
listenable: Listenable.merge([_bar.badges, _bar.bar, _paneWidths]),
|
||||
builder: (context, _) {
|
||||
// On a wide window the bar stays under the list column even when no
|
||||
// item is open (Search, a list alone), so it never jumps sides.
|
||||
final split = _bar.split(_selected) || showsListBesideDetail(context);
|
||||
// item is open (Search, a list alone), so it never jumps sides. A page
|
||||
// (Settings) has no list column, so its bar stays at the right edge.
|
||||
final split =
|
||||
_bar.split(_selected) || (!page && showsListBesideDetail(context));
|
||||
return ListPaneWidth(
|
||||
split: split,
|
||||
preferredWidth: _paneWidths.widthFor(_selected.name),
|
||||
|
||||
@@ -77,12 +77,14 @@ void main() {
|
||||
bool tabs = false,
|
||||
double textScale = 1,
|
||||
ListPaneWidthStore? store,
|
||||
AppDestination destination = AppDestination.chat,
|
||||
}) {
|
||||
final app = AdaptiveShell(
|
||||
cupertino: cupertino,
|
||||
listPaneWidthStore: store ?? MemoryListPaneWidthStore(),
|
||||
destination: AppDestination.chat,
|
||||
destination: destination,
|
||||
destinationBodies: {
|
||||
AppDestination.settings: (_) => const SizedBox.expand(),
|
||||
AppDestination.chat: (_) => split
|
||||
? ListDetailPanes(
|
||||
list: listBody(),
|
||||
@@ -211,6 +213,17 @@ void main() {
|
||||
expect(pill.right, lessThanOrEqualTo(list.right - kFloatingBarMargin));
|
||||
});
|
||||
|
||||
testWidgets('$host 1200 Settings: a page without a list keeps the bar '
|
||||
'at the right edge', (tester) async {
|
||||
await setSize(tester, const Size(1200, 800));
|
||||
await tester.pumpWidget(
|
||||
shell(cupertino: cupertino, destination: AppDestination.settings),
|
||||
);
|
||||
await tester.pump();
|
||||
final pill = destinationPill(tester);
|
||||
expect(pill.right, closeTo(1200 - kFloatingBarMargin, 0.5));
|
||||
});
|
||||
|
||||
testWidgets('$host 1200 unsplit: the bar stays under the list column', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user