我正在尝试实现一个 BottomNavigationBar,但我无法完成它,我正在使用 Get 来处理应用程序的路线和状态。
我是flutter新手,但是阅读文档我仍然不明白
这是主要的小部件。
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
backgroundColor: AppColors.black,
title: Center(
child: CommonAssetImage(
asset: 'logo.png',
color: AppColors.white,
height: 30,
),
),
),
body: BodyTabsScreen(),
bottomNavigationBar: HomeScreenBottomNavigatorBar()),
);
Run Code Online (Sandbox Code Playgroud)
}
然后,我有这个小部件可以调用其他小部件。在这个小部件中我使用 Obs。
class HomeScreenBottomNavigatorBar extends StatelessWidget {
const HomeScreenBottomNavigatorBar({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Material(
elevation: 10,
color: AppColors.white,
child: Container(
height: 60,
padding: const EdgeInsets.symmetric(horizontal: 27),
color: AppColors.white,
child: Obx(() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ …Run Code Online (Sandbox Code Playgroud)