Flutter:将小部件放置在另一个部件的顶部并负向定位

ale*_*ipa 0 flutter flutter-layout

我正在尝试实现这个modalBottomSheet

在此输入图像描述

Stack我想与负面定位一起使用

showModalBottomSheet(
    context: context,
    builder: (context) {
        return Stack(
            alignment: AlignmentDirectional.bottomStart,
            children: [
                Container(
                    width: double.infinity,
                    height: 200,
                    color: Colors.white,
                    child: Column(//here there will be the text)
                ),
                Positioned(
                    top: -20,
                    left: 0,
                    right: 0,
                    child: CircleAvatar(
                        backgroundColor: Palette.white,
                        radius: 38,
                        child: CircleAvatar(
                            backgroundImage: NetworkImage(snapshot.data.image),
                            radius: 34,
                            backgroundColor: Palette.white),
                     ),
                 )]);
                 
Run Code Online (Sandbox Code Playgroud)

然而,这切断了图片的顶部部分CircleAvatar(正如我所预期的那样)。

关于如何实施这个有什么想法吗?

Oma*_*oud 5

您需要将堆栈上的clipBehavior更改为Clip.none

Stack(
    clipBehavior: Clip.none,
...)
Run Code Online (Sandbox Code Playgroud)