-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with hiding a video view. #8
Comments
Can you provide a simple demo? I can not reproduce this issue with following code. bool _isInChannel = false;
bool _isHidden = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Agora Flutter SDK'),
),
body: Container(
child: Stack(
children: [
_miniView(_getRenderViews()),
_joinAndLeaveButton(),
_hideAndShowButton(),
],
),
),
),
);
}
Widget _miniView(List<Widget> views) {
return Positioned(
bottom: 120,
right: 20,
child: Container(
child: _isHidden ? null : views[0],
width: 100,
height: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(25)),
),
));
}
Widget _joinAndLeaveButton() {
return Positioned(
left: 10,
top: 10,
child: OutlineButton(
child: Text(_isInChannel ? 'Leave Channel' : 'Join Channel',
style: textStyle),
onPressed: _toggleChannel,
));
}
Widget _hideAndShowButton() {
return Positioned(
left: 10,
top: 60,
child: OutlineButton(
child: Text(_isHidden ? 'Show' : 'Hide', style: textStyle),
onPressed: _toggleHidden,
));
}
void _toggleChannel() {
print('_toggleChannel');
setState(() {
if (_isInChannel) {
_isInChannel = false;
AgoraRtcEngine.leaveChannel();
AgoraRtcEngine.stopPreview();
} else {
_isInChannel = true;
AgoraRtcEngine.startPreview();
AgoraRtcEngine.joinChannel(null, 'flutter', null, 0);
}
});
}
void _toggleHidden() {
print('_toggleHidden');
setState(() {
_isHidden = !_isHidden;
if (_isHidden) {
AgoraRtcEngine.stopPreview();
} else {
AgoraRtcEngine.startPreview();
}
});
} |
I forgot to mention this only happens on IOS devices. |
I made these changes to your demo (change the build function and added some of the views from your github demo.) and the bug appears.
|
Seems this is related with gesture recognize issue of UIKitView You can add a padding around video view in Widget _viewRows(List<Widget> views) {
switch (views.length) {
case 1:
return Container(
padding: EdgeInsets.all(50),
color: Colors.white,
child: Column(
children: <Widget>[_videoView(views[0])],
));
case 2:
return Container(
padding: EdgeInsets.all(50),
color: Colors.white,
child: Column(
children: <Widget>[_videoView(views[1])],
));
default:
}
return Container();
} When you press the |
Updated to flutter 1.5 and it looks like the bug has been fixed. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please raise a new issue. |
When starting a call I am trying to have the current users camera view be placed in a small box in the corner of the screen (rather than the default of it taking up half the screen).
This works except when you attempt to hide the box (such as using a ternary to hide the positioned widget) it calls the event that hid it.
For example if i have a button that mutes the local video stream and then hides the miniView using a boolean it will call twice, once when i tap the button and then will automatically call the onTap function a second time after when the view is hidden.
This weird double call of buttons only happens when trying to hide a video view.
The text was updated successfully, but these errors were encountered: