mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Match tablet camera surface to mobile
Signed-off-by: kenny lopez <klopez4212@gmail.com>
This commit is contained in:
@@ -9,8 +9,6 @@ const _attachmentMenuItemSpacing = Grid.xxs;
|
||||
const _attachmentMenuIconSize = 24.0;
|
||||
const _attachmentMenuIconSlotWidth = 28.0;
|
||||
const _attachmentExpandedHeight = 372.0;
|
||||
const _tabletAttachmentCameraMaxHeight = 640.0;
|
||||
const _tabletShortestSideBreakpoint = 600.0;
|
||||
|
||||
@immutable
|
||||
class _AttachmentMenuLayout {
|
||||
@@ -172,17 +170,7 @@ class _AttachmentSurfacePanel extends HookWidget {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final expandedWidth = constraints.maxWidth;
|
||||
final isTablet =
|
||||
MediaQuery.sizeOf(context).shortestSide >=
|
||||
_tabletShortestSideBreakpoint;
|
||||
final expandedHeight =
|
||||
visibleExpandedSurface == _AttachmentSurface.camera && isTablet
|
||||
// Use the available chat-pane width rather than a fixed landscape
|
||||
// height. On a tablet's three-pane layout this keeps the camera
|
||||
// preview close to square, even though the pane itself is narrower
|
||||
// than the full device width.
|
||||
? math.min(expandedWidth, _tabletAttachmentCameraMaxHeight)
|
||||
: _attachmentExpandedHeight;
|
||||
const expandedHeight = _attachmentExpandedHeight;
|
||||
final width =
|
||||
_attachmentMenuWidth +
|
||||
((expandedWidth - _attachmentMenuWidth) * sizeProgress);
|
||||
|
||||
@@ -1402,7 +1402,7 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('uses a taller camera surface on tablet-width layouts', (
|
||||
testWidgets('keeps the mobile camera surface geometry on tablet widths', (
|
||||
tester,
|
||||
) async {
|
||||
final previousPlatform = debugDefaultTargetPlatformOverride;
|
||||
@@ -1429,7 +1429,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
tester.getSize(find.byKey(const ValueKey('camera-preview'))).height,
|
||||
640,
|
||||
372,
|
||||
);
|
||||
} finally {
|
||||
debugDefaultTargetPlatformOverride = previousPlatform;
|
||||
|
||||
Reference in New Issue
Block a user