1

有谁知道如何在视频通话中绕过视频角落?我放置它们的容器有一个边界半径,但是当视频开始时,它总是显示一个方形容器。

我的视频渲染代码如下:

 @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        _localSwitchRender == true
            ? rtc_local_view.SurfaceView()
            : rtc_remote_view.SurfaceView(uid: widget.remoteUid.first),
        Align(
          alignment: Alignment.topLeft,
          child: SingleChildScrollView(
            scrollDirection: Axis.horizontal,
            child: GestureDetector(
              onTap: _switchRender,
              child: Padding(
                padding: const EdgeInsets.fromLTRB(12, 42, 0, 0),
                child: Stack(
                  children: [
                    Column(
                      children: [
                        const SizedBox(
                          height: 20
                        ),
                        Container(
                          decoration: const BoxDecoration(
                            borderRadius: BorderRadius.all(Radius.circular(20.0)),
                            color: Color(0x66333333),
                          ),
                          width: 158,
                          height: 220,
                          foregroundDecoration: const BoxDecoration(
                            borderRadius: BorderRadius.all(Radius.circular(20.0)),
                          ),
                          child: _localSwitchRender
                              ? rtc_remote_view.SurfaceView(

                                  uid: widget.remoteUid.first,
                                  renderMode: VideoRenderMode.FILL,
                                )
                              : rtc_local_view.SurfaceView(
                                  renderMode: VideoRenderMode.Hidden,
                                  zOrderMediaOverlay: true,
                                ),
                        ),
                      ],
                    ),
                  ],
                ),
              ),
            ),
          ),
        ),
      ],
    );
  }
}

任何帮助是极大的赞赏!

4

2 回答 2

1

将您的小部件放在 ClipRRect 中:

ClipRRect(
    borderRadius: BorderRadius.circular(10)
    child: // your widget
)

于 2021-09-18T18:22:49.190 回答
0

谢谢索特万!那行得通:

ClipRRect(
    borderRadius: BorderRadius.circular(10)
    child: // your widget
)
于 2021-09-19T19:41:15.497 回答