I have wrapped BottomAppBar with PreffredSize widget to set its height based on requirnment but its not giving the height which is applied by Size.fromHeight(20)
so how to solve?
bottomNavigationBar: const PreferredSize(
preferredSize: Size.fromHeight(20),
child: BottomAppBar(
padding: EdgeInsets.zero,
elevation: 0,
color: Colors.blue,
child: Row(children: [
Expanded(child: Text('Add to cart')),
Expanded(child: Text('Buy Now'))
],)
),
),
I think no need to use PreferredSize
Widget just wrap your BottomAppBar
inside SizedBox
and provide your expected height.
Refer below code.
bottomNavigationBar: const SizedBox(
height: 200,
child: BottomAppBar(
padding: EdgeInsets.zero,
elevation: 0,
color: Colors.blue,
child: Row(
children: [
Expanded(child: Text('Add to cart')),
Expanded(child: Text('Buy Now'))
],
),
),
),
Result Image