0

我正在使用Flash包,但每次调用该showFlash函数并Flash.dialog显示 a 时,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) {

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

4

0 回答 0