-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Version
v1.2.0
Which operating systems have you used?
- Android
- iOS
Environment that reproduces the issue
- iPhone (13 Pro / 17.5.1)
- Flutter 3.19.1
Is it reproducible in the example application?
Yes
RTMP Server
none
Reproduction steps
I want the camera preview to remain full screen when the keyboard is opened,
so I put it inside a SingleChildScrollView.
Replace example with the following to reproduce:
Widget build(BuildContext context) { |
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: const Text('Live Stream Example'),
actions: <Widget>[
PopupMenuButton<String>(
onSelected: (choice) => _onMenuSelected(choice, context),
itemBuilder: (BuildContext context) {
return Constants.choices.map((String choice) {
return PopupMenuItem<String>(
value: choice,
child: Text(choice),
);
}).toList();
},
)
],
),
body: SafeArea(
child: Stack(
children: [
SingleChildScrollView(
child: Column(
children: [
ApiVideoCameraPreview(controller: _controller),
],
),
),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.only(left: 16, right: 128),
child: TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Enter text',
),
),
),
),
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: _controlRowWidget(),
),
),
],
),
),
);
}
Expected result
The width is fixed and it would be good if the height is also adjusted automatically.
Actual result
════════ Exception caught by rendering library ═════════════════════════════════
The following assertion was thrown during performLayout():
BoxConstraints forces an infinite height.
These invalid constraints were provided to RenderFittedBox's layout() function by the following function, which probably computed the invalid constraints in question:
RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:280:14)
The offending constraints were: BoxConstraints(w=390.0, h=Infinity)
Additional context
- To avoid the error,
ApiVideoCameraPreview()
needs to be wrapped withAspectRatio(aspectRatio: 9 / 16)
. However, when the device is in landscape orientation, the aspectRatio becomes incorrect. - Since we are getting
videoSize
andorientation
insideApiVideoCameraPreview
, could we put theAspectRatio
inside and build with the appropriate aspectRatio?
Relevant logs output
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working