- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我想模糊脚手架的 BottomNavigationBar 的背景,这样它可以给后面的项目带来很酷的模糊效果。我该怎么做?
更多信息:我尝试通过为 BottomNaviagtionBar 创建一个新主题来为 canvasColor 添加不透明度。这是我的代码:
底部导航栏:新主题(
数据:Theme.of(context).copyWith(
Canvas 颜色:颜色(0xff424242).withOpacity(0.5),
),
child :新的底部导航栏(
onTap: navigationTapped,
当前索引:_page,
项目: [
新的 BottomNavigationBarItem(
图标:新图标(Icons.home),
标题:新文本('主页')
),
新的 BottomNavigationBarItem(
图标:新图标(Icons.dashboard),
标题:新文本('菜单')
),
新的 BottomNavigationBarItem(
图标:新图标(Icons.date_range),
标题:新文本('日期')
)
],
),
)
这是我得到的输出:Image
令人惊讶的是,如您所见,完全没有应用不透明度。我实际上不希望 BottomNavigationBar 不透明。我希望它变得模糊,以便它后面的内容可以在 BottomNaviagtionBar 上被视为模糊。我也尝试过将 BottomNavigationBar 包装在 ImageFilter.blur() 中,但这也没有用。
最佳答案
为此,我必须将底部导航与屏幕的其他内容放在一个堆栈中。我结合使用了 ClipRect、BackdropFilter 和 Opacity。这是工作解决方案:
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: _buildAppBar(context),
body: Stack(
//these are the screens that will be loaded for every bottom nav item
children: <Widget>[
IndexedStack(
index: _currentTab,
children: _pages,
),
_buildBottomNavigation()
],
),
);
}
Widget _buildBottomNavigation() => Align(
alignment: FractionalOffset.bottomCenter,
//this is very important, without it the whole screen will be blurred
child: ClipRect(
//I'm using BackdropFilter for the blurring effect
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 10.0,
sigmaY: 10.0,
),
child: Opacity(
//you can change the opacity to whatever suits you best
opacity: 0.8,
child: BottomNavigationBar(
currentIndex: _currentTab,
onTap: (int index) {
setState(() {
_currentTab = index;
});
},
type: BottomNavigationBarType.fixed,
unselectedItemColor: AppColors.colorBlack,
items: allRoutes.map((NavigationRoute route) {
return _buildBottomNavigationBarItem(route);
}).toList(),
),
),
),
),
);
关于flutter - 如何模糊 Flutter 中的 BottomNavigationBar?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50133651/
我正在学习 Javascript,我正在尝试创建一个简单的下拉菜单。我想要的功能的示例可以在 Google 主页的顶部菜单中看到,其中包含“更多”和“设置”下拉菜单。 我有一个使用 onclick()
我尝试捕捉 tinyMce 编辑器的模糊和焦点事件。 我为此找到了以下方法。 ed.onInit.add(function(ed) { tiny
这里完全被难住了。尝试一些很简单的东西,但它不起作用: $("input.input1, textarea.input1").focus(function(){ $(this).addClas
我有以下 jQuery 函数: 提交表单 $(".content").delegate('.entryButton','click', function() {var form = $(this).c
如何使用 jQuery 在焦点/模糊上切换元素的 CSS? $('.answerSpace').bind('blur', function(){ $('.normProf').toggleClass(
在我的 iPhone 应用程序中,我有一个黑白 UIImage。我需要模糊该图像(高斯模糊即可)。 iPhone 显然知道如何模糊图像,如 it does that when it draws sha
这个问题已经有答案了: Blurring an image via CSS? (6 个回答) 已关闭 7 年前。 我有一个场景。我想随着循环的进行模糊我的图像。我怎样才能做到这一点?这是我的代码。
这个错误是在子字符串方法上抛出的,我发现很多线程都在处理这个问题,但我遇到的问题似乎有所不同。我知道如果您的字符串短于子字符串(开始,结束)大小,它会抛出此错误,但在任何内容传递到方法调用之前都会抛出
是否有简单的解决方案可以在 Qt 中为图像添加运动模糊?还没有找到任何关于模糊的好教程。我需要一些非常简单的东西,我可以理解,如果我可以改变模糊角度,那就太好了。 最佳答案 Qt 没有运动模糊过滤器。
我的搜索框在正常状态下很小。焦点对准时,它会展开,并显示一个提交按钮。这样做是为了节省空间。现在,在模糊时,搜索框再次缩小,提交按钮消失。 问题是,通过使提交按钮成为“竞赛”以在正确的位置单击它,对提
您好,我正在使用 PngBitmapEncoder 从 Canvas 在内存中创建图像。 public void CaptureGraphic() { Canvas canvas = new
我已经搜索过谷歌、这个和其他论坛,但无济于事……太棒了,有没有可能有像 onMiddleClick="blur();"这样的东西?在单击鼠标中键时隐藏链接的焦点边框? 最佳答案 $('a').clic
我无法在我的应用程序中正确渲染我的纹理。我使用的艺术品是精确的,并且已经缩放且尺寸合适,但是当我在手机上渲染它时,我的纹理突然不如原始艺术品清晰/精确,我不明白为什么。 有人遇到过这个问题吗? 最佳答
这里有与上述主题相同的问题但没有得到答复 我这里有布局 我需要在底部布局中使用与顶部布局相同的图像,但使用模糊样式 设置 alpha 没有帮助 - TextView 也会影响 如何虚化down布局的背
我已经搜索了一段时间,但到目前为止没有找到适合我需要的东西。 ( This was helpful, but not convincing ) 从两个不同的来源,我得到两个不同的字符串。我想检查较短的
我有这样的代码: var passwordTextBox = angular.element("#password"); passwordTextBox.blur(function()
设置此 JQuery 函数无法正常工作。有时,如果我单击元素,什么也没有发生,并且它会触发隐藏可折叠菜单的功能,如果单击文档上的任意位置,则不会重定向到正确的 href。有什么更好的方法吗? HTML
尝试通过将坐标列表保存到数组来在多个位置裁剪我的图像后,裁剪区域中的字母变得非常模糊,我无法弄清楚原因。 原图看起来像 裁剪后的图像看起来像 题中代码如下: import numpy as np im
我知道我们可以调暗/模糊屏幕,如 this post 所示. 我应该怎么做才能使它的一部分变暗/模糊,使单个(或多个) View 没有任何效果,从而使整个屏幕具有突出显示 View 的效果? 此外,即
如果有人曾经向 digg 提交过故事,它会检查该故事是否已经提交,我假设是通过模糊搜索。 我想实现类似的东西,想知道他们是否使用开源的 php 类? Soundex 不这样做,句子/字符串的长度可达
我是一名优秀的程序员,十分优秀!