Keep center stage the widest pane on wide monitors
The stage had a fixed preferred width, so on a big monitor the panes beside it shared the leftover and grew wider than the chat on stage. The stage is now at least 1.5 times as wide as each other column.
This commit is contained in:
@@ -200,15 +200,30 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('a very wide workspace keeps the stage and shows live columns', () {
|
||||
test('a very wide workspace keeps the stage the biggest pane', () {
|
||||
final layout = ChatCenterStageLayout.of(
|
||||
const Size(2560, 800),
|
||||
['a', 'b'],
|
||||
'a',
|
||||
null,
|
||||
)!;
|
||||
expect(layout.rects['a']!.width, 950);
|
||||
// 2548 usable: the stage takes 1.5 parts, the other pane 1.
|
||||
expect(layout.rects['a']!.width, closeTo(2548 * 1.5 / 2.5, 0.001));
|
||||
expect(layout.rects['b']!.width, closeTo(2548 / 2.5, 0.001));
|
||||
expect(layout.rects['b']!.right, 2560);
|
||||
expect(layout.strips, isEmpty);
|
||||
final three = ChatCenterStageLayout.of(
|
||||
const Size(3840, 800),
|
||||
['a', 'b', 'c'],
|
||||
'c',
|
||||
null,
|
||||
)!;
|
||||
for (final other in ['a', 'b']) {
|
||||
expect(
|
||||
three.rects['c']!.width,
|
||||
closeTo(three.rects[other]!.width * chatCenterStageLeadFactor, 0.001),
|
||||
);
|
||||
}
|
||||
expect(
|
||||
ChatCenterStageLayout.of(const Size(2560, 800), ['a'], 'a', null),
|
||||
isNull,
|
||||
@@ -233,7 +248,8 @@ void main() {
|
||||
'a',
|
||||
{'b': 300},
|
||||
)!;
|
||||
expect(switched.rects['a']!.width, chatCenterStageWidth);
|
||||
// 1588 usable: 1.5 parts of 2.5 just exceed the preferred width.
|
||||
expect(switched.rects['a']!.width, closeTo(1588 * 1.5 / 2.5, 0.001));
|
||||
|
||||
final closed = ChatCenterStageLayout.of(
|
||||
const Size(1600, 800),
|
||||
@@ -241,7 +257,7 @@ void main() {
|
||||
'b',
|
||||
null,
|
||||
)!;
|
||||
expect(closed.rects['b']!.width, chatCenterStageWidth);
|
||||
expect(closed.rects['b']!.width, closeTo(1588 * 1.5 / 2.5, 0.001));
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -378,12 +394,13 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(widthOf(tester, 'three'), 950);
|
||||
final staged = widthOf(tester, 'three');
|
||||
expect(staged, greaterThan(widthOf(tester, 'one')));
|
||||
await tester.tap(find.byKey(const ValueKey('action-one')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(workspace.activePane?.sessionId, 'three');
|
||||
expect(widthOf(tester, 'three'), 950);
|
||||
expect(widthOf(tester, 'three'), staged);
|
||||
|
||||
await tester.tap(find.byKey(const ValueKey('input-one')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
Reference in New Issue
Block a user