我试图制定一个透明背景,显示上一个屏幕(一个之前导航堆栈上)的屏幕。
这里是我到目前为止所。我试图通过包装在一个不透明物体的支架的身体来调整其不透明度,但是这丝毫不影响背景的不透明度。我可能会以错误的方式使用屏幕而不是弹出栏或菜单逼近这一点 - 我是新来的扑动和可以使用一些指导和建议!谢谢!
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.
]
)
]
)
)
);
当你把一个网页,它默认使用PageRouteBuilder
,其具有不透明背景 - 见the source。
很难告诉你从你的代码做什么,但如果你想使一个模态对话框你会使用showDialog
功能和a Dialog
的更好。
如果你绝对必须使用一个页面,这是可能的,但你必须基本上重新写PageRouteBuilder
不具有不透明屏障。
您需要创建一个自定义PageRoute。看看这个堆栈溢出的答案,我想这是你要搜索的内容:
Transparent PageRoute in Flutter for displaying a (semi-) transparent page