I have question - I want to create bottomNavigationBar but in some custom way. Please take a look on this image:
我为一个愚蠢的问题向你道歉/ 我试着把每一件东西都放在底部,但现在我完全不知道该怎么做……
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:streeti/static/static_colors.dart';
class CustomBottomNavigationBar extends StatefulWidget {
const CustomBottomNavigationBar({super.key});
@override
State<CustomBottomNavigationBar> createState() =>
_CustomBottomNavigationBarState();
}
class _CustomBottomNavigationBarState extends State<CustomBottomNavigationBar> {
@override
Widget build(BuildContext context) {
return Container(
height: 108,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
),
border: Border.all(
color: AppColors.blueColor,
),
),
child: BottomNavigationBar(
showUnselectedLabels: true,
selectedFontSize: 10,
unselectedLabelStyle:
const TextStyle(color: Colors.black, fontSize: 10),
backgroundColor: Colors.transparent,
fixedColor: Colors.black,
unselectedItemColor: Colors.black,
items: [
BottomNavigationBarItem(
icon: Padding(
padding: EdgeInsets.only(bottom: 5),
child: SvgPicture.asset('lib/assets/images/email2.svg'),
),
label: 'Nachricht',
),
BottomNavigationBarItem(
icon: Padding(
padding: EdgeInsets.only(bottom: 5),
child: SvgPicture.asset('lib/assets/images/map.svg'),
),
label: 'Karte',
),
BottomNavigationBarItem(
icon: Padding(
padding: EdgeInsets.only(bottom: 5),
child: SvgPicture.asset('lib/assets/images/hot.svg'),
),
label: 'Angebote',
),
BottomNavigationBarItem(
icon: Padding(
padding: EdgeInsets.only(bottom: 5),
child: SvgPicture.asset('lib/assets/images/community.svg'),
),
label: 'Community',
),
BottomNavigationBarItem(
icon: Padding(
padding: EdgeInsets.only(bottom: 10),
child: SvgPicture.asset('lib/assets/images/profil.svg'),
),
label: 'Profil',
),
],
),
);
}
}
要调整Container以使中间的图标显示在我理解的Container的略上方,我应该使用Stack()吗?