如何解决在Flutter中的FAB后面添加模糊效果
如何在FAB后面添加这种模糊效果? 我尝试使用BottomAppBar实现此目的,但BottomAppBar在LinearGradient中不接受透明色 我也尝试降低BottomAppBar背景的不透明度,但效果不佳
Widget build(BuildContext context) {
return Scaffold(
body: _myListView(context),bottomNavigationBar: BottomAppBar(
child: Container(
height: MediaQuery.of(context).size.height/10,decoration: BoxDecoration(
gradient: LinearGradient(colors: [Colors.transparent,Colors.white],begin: Alignment.topCenter,end: Alignment.bottomCenter
)
),child: MyFloatingActionButton(),),);
}
解决方法
我能够在Stack的帮助下解决问题
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
_myListView(context),Positioned(child:
Container(
padding: EdgeInsets.all(5.0),alignment: Alignment.bottomCenter,decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,end: Alignment.bottomCenter,colors: <Color>[
Colors.white.withAlpha(0),Colors.white12,Colors.white70
],),child: MyFloatingActionButton(),bottom: 0,top: MediaQuery.of(context).size.height/1.5,width: MediaQuery.of(context).size.width,],);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。