Skip to content

[Bug]: 从iOS原生端模态弹出Flutter页面,Flutter页面设置透明,结果Flutter页面呈现白色全屏 #2155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
applebest opened this issue Nov 21, 2024 · 5 comments

Comments

@applebest
Copy link

请描述遇到的问题,以及您所期望的正确的结果

iOS原生端:


       let vc:FBFlutterViewContainer = FlutterVC()
        vc.setName(options.pageName, uniqueId: options.uniqueId, params: options.arguments,opaque: options.opaque)
        vc.view.backgroundColor = .clear
        self.present(vc, animated: true, completion: nil)

Flutter端路由代理:


   RouterPath.memberAlert: (settings, uniqueId) {
 

      return ModalBottomSheetRoute(
        settings: settings,
        enableDrag: true,
        isDismissible: true,
        backgroundColor: Colors.transparent,
        modalBarrierColor: Colors.transparent,
        builder: (context) {
          // return const MemberAlert();

          return AnimatedPadding(
              padding: MediaQuery.of(context).viewInsets,
              // padding: EdgeInsets.zero,
              duration: const Duration(milliseconds: 100),
              curve: Curves.decelerate,
              child: const MemberAlert());
        },
        isScrollControlled: false,
      );
    }

Widget


const MemberAlert({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.transparent,
      body: Align(
        alignment: Alignment.bottomCenter,
        child: ClickWidget(
          onTap: () => Nav.unfocus(),
          child: ClipRRect(
            borderRadius: BorderRadius.only(
                topLeft: Radius.circular(12.r),
                topRight: Radius.circular(12.r)),
            child: Container(
              height: 280.h,
              padding: EdgeInsets.symmetric(horizontal: 24.h),
              color: Colors.white,
              // width: 1.sw,
              child: Column(
                children: [
                  Container(
                    margin: EdgeInsets.only(top: 8.h),
                    width: 28.w,
                    height: 4.h,
                    decoration: BoxDecoration(
                        color: rgba(221, 222, 226, 1),
                        borderRadius: BorderRadius.circular(2.r)),
                  ),
                  Box.gapV(41.h),
                  TextWidget(
                    MemberKeys.todaysFreeAlChatUsedUp.tr,
                    fontSize: 28.sp,
                    textAlign: TextAlign.center,
                    color: rgba(1, 1, 1, 1),
                    style: TextWidgetStyle.bold,
                  ),
                  Box.gapV(12.h),
                  TextWidget(
                    MemberKeys.upgradeForUnlimitedAlChat.tr,
                    textAlign: TextAlign.center,
                    fontSize: 14.sp,
                    color: rgba(1, 1, 1, 1),
                    style: TextWidgetStyle.regular,
                  ),
                  Box.gapV(24.h),
                  ClickableContainer(
                    onTap: () {
                      Nav.pushReplacement(RouterPath.member);
                      // Navigator.of(context).pop();
                      // Nav.push(RouterPath.member);
                    },
                    alignment: Alignment.center,
                    // width: 1.sw,
                    height: 44.h,
                    // padding: EdgeInsets,
                    borderRadius: BorderRadius.circular(12.r),
                    color: rgba(42, 112, 255, 1),
                    child: TextWidget(
                      MemberKeys.upgrade.tr,
                      fontSize: 16.sp,
                      color: Colors.white,
                      style: TextWidgetStyle.bold,
                    ),
                  ),
                  Box.gapV(30.h),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }


xCode , Debug View Hierarchy打印

image 发现FlutterView背景是UIExtendedGrayColorSpace

希望能在现有的页面之上,弹出一个透明的提示框

请说明如何操作会遇到上述问题

No response

在下面填入关键复现代码

复现的平台

iOS

Flutter SDK版本

3.22.0

FlutterBoost版本

master分支

是否延迟初始化FlutterBoost

No

解决方案

@applebest applebest changed the title [Bug]: 从iOS原生端模态弹出Flutter页面,Flutter页面呈现白色, Flutter页面不会透明 [Bug]: 从iOS原生端模态弹出Flutter页面,Flutter页面设置透明,结果Flutter页面呈现白色全屏 Nov 21, 2024
@yaotiancheng-ola
Copy link

yaotiancheng-ola commented Feb 27, 2025

+1 同样可复现

boost: 4.6.5/5.0.2
flutter sdk: 3.24.5

@joechan-cq

@rgmyyw
Copy link

rgmyyw commented Mar 11, 2025

+1 同样可复现

boost: 4.6.5
flutter sdk: 3.24.2

@forping
Copy link

forping commented Mar 26, 2025

opaque参数给false了吗?
类似 BoostNavigator.instance.push("study_task_guide",
arguments: {"animated": false}, opaque: false, withContainer: true);

@applebest
Copy link
Author

opaque参数给false了吗? 类似 BoostNavigator.instance.push("study_task_guide", arguments: {"animated": false}, opaque: false, withContainer: true);

都试了,无效

@xd-jeff
Copy link

xd-jeff commented Apr 1, 2025

宝~, 这个问题能不能解决一下~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants