My implementation of bottom nav bar in flutter is not getting transparent when I am using Colors.red.withOpacity(0.2), I am applying transparency to my nav bar because later I want to use backdrop filter to apply guassion blurr on it. However it is not getting transparent.
Scaffold(
drawer: DrawerReskined(
drawerItems: drawerItems,
),
key: drawerKey,
body: _children[_currentIndex],
extendBody: true,
bottomNavigationBar: BottomNavigationBar(
showSelectedLabels: false,
showUnselectedLabels: false,
elevation: 0.0,
type: BottomNavigationBarType.fixed,
backgroundColor: Colors.red.withOpacity(0.2),
iconSize: 30,
currentIndex: _currentIndex,
onTap: (int index) {
Provider.of<NavigationBarModel>(context, listen: false).setSelectedIndex(index);
},
items: [
BottomNavigationBarItem(
icon: Column(
children: [
SvgPicture.asset(
"assets/svg/home.svg",
width: 19,
height: 20,
color: _currentIndex == 0 ? Colors.blue : ProjectColors.fireFly,
),
SizedBox(height: 8),
SvgPicture.asset(
"assets/svg/selected.svg",
color: _currentIndex == 0 ? ProjectColors.warning : Colors.white,
),
],
),
label: ''),
BottomNavigationBarItem(
icon: Column(
children: [
SvgPicture.asset(
"assets/svg/on_going.svg",
color: _currentIndex == 1 ? Colors.blue : ProjectColors.fireFly,
),
SizedBox(height: 8),
SvgPicture.asset(
"assets/svg/selected.svg",
color: _currentIndex == 1 ? ProjectColors.warning : Colors.white,
),
],
),
label: ''),
BottomNavigationBarItem(
icon: Padding(
padding: const EdgeInsets.only(bottom: 15.0),
child: Container(
width: 45,
height: 45,
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(10),
),
child: IconButton(
icon: isTemplatesLoading
? CircularProgressIndicator(
color: Colors.white,
)
: Icon(Icons.add, color: Colors.white),
onPressed: () async {
setState(() => isTemplatesLoading = true);
Boxes.addAllTemplate(await TemplateCorba.templates());
setState(() => isTemplatesLoading = false);
AddTemplateRoles.show(
context,
AddTemplate(position: _floatingButtonKey.getOffset),
);
},
),
),
),
label: '',
),
BottomNavigationBarItem(
icon: Column(
children: [
SvgPicture.asset(
"assets/svg/business_overview.svg",
color: _currentIndex == 3 ? Colors.blue : ProjectColors.fireFly,
),
SizedBox(height: 8),
SvgPicture.asset(
"assets/svg/selected.svg",
color: _currentIndex == 3 ? ProjectColors.warning : Colors.white,
),
],
),
label: ''),
BottomNavigationBarItem(
icon: Column(
children: [
SvgPicture.asset(
"assets/svg/profile.svg",
color: _currentIndex == 4 ? Colors.blue : ProjectColors.fireFly,
),
SizedBox(height: 8),
SvgPicture.asset(
"assets/svg/selected.svg",
color: _currentIndex == 4 ? ProjectColors.warning : Colors.white,
),
],
),
label: ''),
],
),
))
also it would be helpful if someone suggest good ways to apply backdrop filter for guasion blur.
2
Answers
Try wrapping your bottom navigation bar in a theme data and aligning it at the bottom-center
Its working on me are you sure it is not transparent??