在颤振中如何打开底部栏上方的底部工作表

Sac*_*ure 5 flutter bottom-sheet bottombar

我正在使用https://pub.dev/packages/persistent_bottom_nav_bar包来显示底部栏。当按下底部栏选项卡之一时,我需要打开底部表格。我已设法使用 showModalBottomSheet 显示底部工作表,但问题是它覆盖了现有的底部栏。我需要打开底部栏上方的底部工作表,而不是从屏幕底部打开。这就是我想要实现的目标。

在此输入图像描述

所以我设法使用带有容器和底部边距的 showGeneralDialog 进行显示。以下是我的解决方案。

showGeneralDialog(
        barrierLabel: AppLocalizations.of(context).translate(LanguageConstant.more),
        barrierDismissible: true,
        barrierColor: Colors.grey.withOpacity(0.1),
        transitionDuration: Duration(milliseconds: 100),
        context: context,
        pageBuilder: (dialogContext, anim1, anim2) {
          return Align(
            alignment: Alignment.bottomCenter,
            child: Container(
              margin: EdgeInsets.only(bottom: CommonConstants.BOTTOM_BAR_HEIGHT, top: MediaQuery.of(context).size.height/2, left: 0, right: 0),
              decoration: BoxDecoration(
                  color: Theme.of(context).colorScheme.surface,
                  border: Border.all(width: 0.5,color: ColorConstants.blackShade3),
              ),
              child: <Your child widgets>,
            ),
          );
        },
        transitionBuilder: (dialogContext, anim1, anim2, child) {
          return SlideTransition(
            position: Tween(begin: Offset(0, 1), end: Offset(0, 0)).animate(anim1),
            child: child,
          );
        },
      );
Run Code Online (Sandbox Code Playgroud)