Вам нужно свойство Offset
для BoxShadow
,
Свойство offset
используется для управления положением тени. По умолчанию это zero
, поэтому вам нужно добавить Offset
:
Я добавил демонстрацию, используя ваше дерево виджетов в качестве примера:
class CBottomNavBar extends StatefulWidget {
@override
_CBottomNavBarState createState() => _CBottomNavBarState();
}
class _CBottomNavBarState extends State<CBottomNavBar> {
@override
Widget build(BuildContext context) {
return Consumer<SManageIndex>(
builder: (context, manageIndex, child) => Container(
height: 80,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: primaryColorDark,
boxShadow: [
BoxShadow(
color: primaryColorDark, blurRadius: 4, spreadRadius: 2,
// add the offset property
offset: Offset(0, 5), // new line [move to the right[horizontally] by 0 ,move to the top[vertically] by 5]
),
],
borderRadius: BorderRadius.only(
topRight: Radius.circular(20), topLeft: Radius.circular(20))),
child: BottomNavigationBar(
backgroundColor: primaryColorDark,
items: [
BottomNavigationBarItem(
icon: Icon(
FontAwesomeIcons.hospital,
),
title: Text('Appointments')),
BottomNavigationBarItem(
icon: Icon(
FontAwesomeIcons.pills,
),
title: Text('Medicines'),
),
BottomNavigationBarItem(
icon: Icon(
FontAwesomeIcons.bookMedical,
),
title: Text('Documents'),
),
],
currentIndex: manageIndex.index,
onTap: (value) => manageIndex.changePage(value),
),
),
);
}
}