我怎样才能使这个堆栈小部件颤动?

how can I make this stack widget in flutter?

我正在开发一个应用程序,我需要知道如何制作这个小部件,

我需要在图像上放置一个容器 我尝试使用堆栈小部件,但我有一些错误 你能帮忙吗?

你可以试试这样的

Stack(
      children: <Widget>[
        Container(
          child: Image.asset(url),
          ),
        ),
        Container(
          child: Text('Show text here')
        ),
]),

默认情况下,堆栈小部件 child 位于屏幕的左上角。 第一个 child 在堆栈的底部,任何在它之后的东西都会在它上面。解决方案很简单,使用 Positioned 小部件将堆栈 child 小部件放置在屏幕上任何您想要的位置。 这段代码应该可以为您解决问题。我不知道它是否适合你的情况,但它有效

Stack(
        fit: StackFit.expand,
        children: [
          Container(
            width: double.infinity,
            height: 220,
            color: Colors.indigo,
            child: const Text(
              'consider this is an Image',
              textAlign: TextAlign.center,
            ),
          ),
          Positioned(
            top: 180,
            width: 395,
            child: Container(
              decoration: const BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.only(
                  topRight: Radius.circular(32),
                  topLeft: Radius.circular(32),
                ),
              ),
              height: 600,
              width: 395,
              child: Column(
                children: const [
                  // ** Your child widgets**
                ],
              ),
            ),
          ),
        ],
      ),

您可以使用 stack 来相互重叠,而不是在该堆栈中您可以使用 DraggableScrollableSheet class 来放置那张 scrollable white 卡片。

Stack(
        fit: StackFit.expand,
        children: [
          Container(
               Image(),
          ),
           DraggableScrollableSheet(
          builder: (BuildContext context, ScrollController scrollController){
                 return Container(),
              
                }
              ),
            
          ),
        ],
      ),

这里是 link 更多 Here