Shell: on wide split layouts the destination tabs sit under the list pane
The four destination buttons move from the bottom right over the detail pane to the bottom of the list pane, centred in the (dragged) list width. The list now keeps the bar's height as bottom clearance; the detail pane clears only the system inset, so its tabs, the chat composer and the artifact actions sit at its bottom edge. Phone layout is unchanged. kStackedBarGap is gone with the stacked bars.
This commit is contained in:
@@ -192,6 +192,63 @@ void main() {
|
||||
});
|
||||
}
|
||||
|
||||
for (final listWidth in [511.0, 300.0, 240.0]) {
|
||||
testWidgets('$host: centred in a $listWidth list pane, the row keeps '
|
||||
'the margins and the selected size', (tester) async {
|
||||
// The shell's wide placement: under the list pane, centred in it.
|
||||
await pump(
|
||||
tester,
|
||||
cupertino: cupertino,
|
||||
size: const Size(1280, 800),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.bottomStart,
|
||||
child: SizedBox(
|
||||
width: listWidth,
|
||||
child: FloatingDestinationBar(
|
||||
cupertino: cupertino,
|
||||
currentIndex: 1,
|
||||
onTap: (_) {},
|
||||
alignment: Alignment.bottomCenter,
|
||||
items: [
|
||||
for (var index = 0; index < 4; index += 1)
|
||||
FloatingDestinationItem(
|
||||
key: tabKey(index),
|
||||
icon: Icon(icons[index]),
|
||||
label: 'Tab $index',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
final box = row(tester);
|
||||
expect(box.center.dx, moreOrLessEquals(listWidth / 2));
|
||||
// A squeezed row scales down about its centre, which stays put.
|
||||
expect(
|
||||
box.center.dy,
|
||||
moreOrLessEquals(
|
||||
800 -
|
||||
16 -
|
||||
FloatingDestinationBar.selectedButtonSize(
|
||||
cupertino: cupertino,
|
||||
) /
|
||||
2,
|
||||
),
|
||||
);
|
||||
expect(box.left, greaterThanOrEqualTo(16 - 0.01));
|
||||
expect(box.right, lessThanOrEqualTo(listWidth - 16 + 0.01));
|
||||
// The selected button keeps its larger size relative to the others.
|
||||
expect(
|
||||
button(tester, 1).width / button(tester, 0).width,
|
||||
moreOrLessEquals(
|
||||
FloatingDestinationBar.selectedButtonSize(cupertino: cupertino) /
|
||||
diameter,
|
||||
),
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
testWidgets('$host: taps between and beside the buttons reach the '
|
||||
'content, taps on them the tabs', (tester) async {
|
||||
final tapped = <int>[];
|
||||
|
||||
Reference in New Issue
Block a user