可以将 RiveAnimation.asset 放在 Stack 中,并将其放在悬浮按钮的下面,如下所示:

Stack(
  children: [
    // Rive Animation
    RiveAnimation.asset(
      'assets/birds.riv',
      animations: const [
        'Fly2',
      ],
    ),
    // Floating Action Button
    Positioned(
      bottom: 16,
      right: 16,
      child: FloatingActionButton(
        tooltip: '回到今天',
        onPressed: () {
          hItems(DateTime.now());
          setState(() {
            print('回到今天');
            _calendarAgendaControllerAppBar.goToDay(DateTime.now());
          });
        },
        child: Text('回到
今天',
          style: TextStyle(
            color: Colors.white,
            fontSize: 13,
          )
        ),
        backgroundColor: Global.home_currentcolor,
      ),
    ),
  ],
)

这样,Rive 动画就会显示在悬浮按钮的下面。您可以使用 Positioned 小部件来调整动画的位置。

Flutter 如何将 Rive 动画置于悬浮按钮下方

原文地址: https://www.cveoy.top/t/topic/ob8w 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录