显示闪光灯时无法点击颤动屏幕

时间:2021-07-20 16:24:49

标签: flutter dart flutter-notification

我正在使用 Flash 包,但每次当我调用 showFlash 函数并显示 Flash.dialog 时,Flash 下方的屏幕不再检测手势,只有当flash 又被关闭了。
这是我的 flash,我在整个应用程序中调用它来可视化成功的操作。

void showSuccessNoti({
  required String message,
  required BuildContext context,
}) {
  showFlash(
    context: context,
    duration: const Duration(seconds: 2),
    builder: (context, controller) {
      return Flash.dialog(
        barrierColor: Colors.transparent,
        controller: controller,
        alignment: Alignment.topCenter,
        borderRadius: const BorderRadius.all(Radius.circular(4)),
        backgroundColor: Theme.of(context).backgroundColor,
        boxShadows: [
          BoxShadow(
            color: Colors.black.withOpacity(0.12),
            offset: const Offset(3.0, 3.0),
            blurRadius: 6,
          )
        ],
        margin: const EdgeInsets.only(top: kMediumPadding),
        child: Padding(
          padding: const EdgeInsets.symmetric(
            horizontal: kMediumPadding,
            vertical: kSmallPadding,
          ),
          child: Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
            const Icon(
              Icons.check_circle,
              color: Color(0xFF52C41A),
              size: 18.0,
            ),
            const SizedBox(
              width: 8,
            ),
            Text(
              message,
              style: Theme.of(context).textTheme.bodyText2,
            )
          ]),
        ),
      );
    },
  );
}

这就是当状态改变时我在我的应用程序中调用 flash 的方式:

BlocConsumer<UpdatePersonalBloc, UpdatePersonalState>(
  listener: (context, state) {
    if (state.formStatus is SubmissionSuccess) {
      showSuccessNoti(
          message: L.of(context).updateSuccessAddress,
          context: context);
      Navigator.pop(context);
    } else if (state.formStatus is SubmissionFailed) {
      showErrorNoti(
          message: L.of(context).updateErrorMessage,
          context: context);
    }
  },
  builder: (context, state) {

我很想知道这种行为是否是有意的,如果它是一个错误,如何修复。

0 个答案:

没有答案