如何修改flutter_zoom_drawer包中的黑色背景?
修改flutter_zoom_drawer的黑色背景
你可以通过ZoomDrawer组件的核心参数调整对应的黑色背景,分两种情况处理:
1. 修改侧边抽屉的背景色
如果截图里的黑色区域是侧边抽屉本身,直接设置drawerBackgroundColor参数自定义颜色:
ZoomDrawer( drawerBackgroundColor: Colors.white, // 替换为你需要的颜色 menuScreen: YourMenuWidget(), mainScreen: YourMainWidget(), )
2. 修改主页面遮罩的黑色背景
如果是侧边栏打开时主页面上的半透明黑色遮罩,通过overlayColor参数自定义颜色及透明度:
ZoomDrawer( overlayColor: Colors.grey.withOpacity(0.4), // 自定义颜色和透明度 menuScreen: YourMenuWidget(), mainScreen: YourMainWidget(), )
如果是主页面自身的背景为黑色,直接在主页面的Scaffold中设置backgroundColor即可:
Scaffold( backgroundColor: Colors.white, // 替换为需要的颜色 // 其他页面内容 )
内容的提问来源于stack exchange,提问作者Maurizio Mancini
相关产品推荐
相关产品推荐

