容器在动画期间丢失框阴影

Container loses box shadow during animation

我将这个 Container 包裹在一个 AnimatedSize 小部件中,但是当容器动画到新尺寸时,它会失去它的 BoxShadow :

是否可以修复此行为,以便 BoxShadowContainer 一起动画?

class SCExpansionPanel extends StatefulWidget {
  final Widget body;
  const SCExpansionPanel(
    {Key? key,
    required this.body}) : super(key: key);

  @override
  State<SCExpansionPanel> createState() => _SCExpansionPanelState();
}

class _SCExpansionPanelState extends State<SCExpansionPanel> {
  
  bool isExpanded = false;

  @override
  Widget build(BuildContext context) {
    return AnimatedSize(
      
      duration: const Duration(milliseconds: 200),
      curve: Curves.easeIn,
      alignment: Alignment.topCenter,
      child: 
      Container(
      clipBehavior: Clip.antiAlias,
      width: 0.9.sw,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(8),
        boxShadow: [
         cardShadow
        ],
       color: Colors.white
    
      ),
      child: Column(children: [
        InkWell(
          onTap: () {
            setState(() {
              isExpanded = !isExpanded;
            });
          },
          child: Padding(
            padding: const EdgeInsets.symmetric(
              horizontal: 4,
              vertical:8
            ),
            child: Row(children:const [
                 Icon(Remix.arrow_right_s_line, size: 40, color: Color(0xff6D6D70),),
                 Text("Detalhes",
                style:
                TextStyle(
                  color: Color(0xff6B3300),
                  fontFamily: "JosefinSans",
                  fontWeight: FontWeight.w600,
                  fontSize: 26

                ),)
            ],),
          ),
        ),
        isExpanded ? widget.body : Container()
      ],)
    )
    );
  }
}

将您的 BoxDecoration 移动到包裹在 AnimatedSize

上方的容器中
Container(
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8),
          boxShadow: [cardShasow],
          color: Colors.white),
      child: AnimatedSize(
                ...