I want to apply elevation in the bottom navigation bar. I tried elevation property but it doesn't work. Elevation property has a very negligible shadow effect. But according to my design I want higher elevation.
I want the following output...
'
import 'package:flutter/material.dart';
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text('Sample App'),
),
bottomNavigationBar: BottomNavigationBar(
elevation: 10,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.ac_unit),
title: Text('Test')
),
BottomNavigationBarItem(
icon: Icon(Icons.access_alarm),
title: Text('Test')
),
BottomNavigationBarItem(
icon: Icon(Icons.access_alarm),
title: Text('Test'),
),
],
),
);
}
}
In this post, we'll look at how to solve the Chang Height Of The Bottom Navigation Bar In Flutter programming puzzle. bottomNavigationBar: SizedBox( height: 70, child: BottomNavigationBar(), ), With many examples, we have shown how to resolve the Chang Height Of The Bottom Navigation Bar In Flutter problem.
By default, the shape of the floating action button (FAB) in the flutter is circular and the location is bottom right floated. You can change the location and shape of the floating action button using properties in Scaffold() widget class and FloatingActionButton() widget class.
I know it may not seem the best solution for this issue but you can wrap your Bottom Nav Bar inside a Container, and then apply a BoxDecoration on that.
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text('Sample App'),
),
bottomNavigationBar: Container(
decoration: BoxDecoration(
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.black,
blurRadius: 10,
),
],
),
child: BottomNavigationBar(
elevation: 10,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.ac_unit),
title: Text('Test'),
),
BottomNavigationBarItem(
icon: Icon(Icons.access_alarm),
title: Text('Test'),
),
BottomNavigationBarItem(
icon: Icon(Icons.access_alarm),
title: Text('Test'),
),
],
),
),
);
}
}
I hope someone come with a better solution for this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With