我怎样才能使一个网页半透明显示在扑前一屏幕的背景是什么?

问题描述 投票:1回答:2

我试图制定一个透明背景,显示上一个屏幕(一个之前导航堆栈上)的屏幕。

这里是我到目前为止所。我试图通过包装在一个不透明物体的支架的身体来调整其不透明度,但是这丝毫不影响背景的不透明度。我可能会以错误的方式使用屏幕而不是弹出栏或菜单逼近这一点 - 我是新来的扑动和可以使用一些指导和建议!谢谢!

return new Scaffold(
  body: new Opacity( // This controls the opacity of the buttons.
    opacity: 1.0,
    child: Column( 
      children: <Widget>[
        Row(
          children: <Widget>[
            _actionButton('email', '/home'), // _actionButton returns a rounded button with the route to push to the navigation stack.
            _actionButton('sms', '/smsRedirect'),
          ]
        ),
        Row(
          children: <Widget>[
            _actionButton('jira', '/jiraRedirect'),
            _actionButton('slack', '/slackRedirect')
          ]
        ),
        Row(
          children: <Widget>[
            _actionButton('override', '/override')
          ]
        ),
        Row(
          children: <Widget>[
            _exitButton() // _exitButton returns a button to return to the home screen.
          ]
        )
      ]
    )
  )
);
mobile dart flutter opacity transparent
2个回答
0
投票

当你把一个网页,它默认使用PageRouteBuilder,其具有不透明背景 - 见the source

很难告诉你从你的代码做什么,但如果你想使一个模态对话框你会使用showDialog功能和a Dialog的更好。

如果你绝对必须使用一个页面,这是可能的,但你必须基本上重新写PageRouteBuilder不具有不透明屏障。


0
投票

您需要创建一个自定义PageRoute。看看这个堆栈溢出的答案,我想这是你要搜索的内容:

Transparent PageRoute in Flutter for displaying a (semi-) transparent page

© www.soinside.com 2019 - 2024. All rights reserved.