如何创建自定义半底导航布局
How to create custom half bottom navigation layout
我正在尝试为底部导航栏创建自定义 UI。任何人都知道如何做这样的事情。
示例:仅在蓝色部分显示导航按钮,而将黄色部分留空。
bottomNavigationBar:Stack(
children: <Widget>[
Container(width: 150,height: 60,color: Colors.yellowAccent,),
Theme(
data: Theme.of(context).copyWith(canvasColor: Colors.transparent),
child:Row(
children: <Widget>[
Container(width: 0.4*MediaQuery.of(context).size.width,height: 60,),
**Container(constraints: BoxConstraints(maxWidth: 0.6*MediaQuery.of(context).size.width),
child: BottomNavigationBar(**
elevation: 0,
currentIndex: index,
onTap: changeIndex,
selectedItemColor: Colors.deepOrange,
type: BottomNavigationBarType.fixed,
items: [
BottomNavigationBarItem(
backgroundColor: Color.fromRGBO(0, 0, 0, 0),
icon: Padding(
padding: const EdgeInsets.only(top: 4),
child: Container(
width: 30,
child: Container(
height: 30,
width: 30,
child: Icon(Icons.access_alarm),
),
),
),
title: Text(
'',
style: TextStyle(
fontSize: 0,
),
),
),
BottomNavigationBarItem(
icon: Padding(
padding: const EdgeInsets.only(top: 4),
child: Container(
width: 30,
child: Container(
height: 30,
width: 30,
child: Icon(Icons.access_alarm),
),
),
),
title: Text(
'',
style: TextStyle(
fontSize: 0,
),
),
),
BottomNavigationBarItem(
icon: Padding(
padding: const EdgeInsets.only(top: 4),
child: Container(
width: 30,
child: Container(
height: 30,
width: 30,
child: Icon(Icons.access_alarm),
),
),
),
title: Text(
'',
style: TextStyle(
fontSize: 0,
),
),
),
],
),
),
],
),
),
],
),
我正在尝试为底部导航栏创建自定义 UI。任何人都知道如何做这样的事情。
示例:仅在蓝色部分显示导航按钮,而将黄色部分留空。
bottomNavigationBar:Stack(
children: <Widget>[
Container(width: 150,height: 60,color: Colors.yellowAccent,),
Theme(
data: Theme.of(context).copyWith(canvasColor: Colors.transparent),
child:Row(
children: <Widget>[
Container(width: 0.4*MediaQuery.of(context).size.width,height: 60,),
**Container(constraints: BoxConstraints(maxWidth: 0.6*MediaQuery.of(context).size.width),
child: BottomNavigationBar(**
elevation: 0,
currentIndex: index,
onTap: changeIndex,
selectedItemColor: Colors.deepOrange,
type: BottomNavigationBarType.fixed,
items: [
BottomNavigationBarItem(
backgroundColor: Color.fromRGBO(0, 0, 0, 0),
icon: Padding(
padding: const EdgeInsets.only(top: 4),
child: Container(
width: 30,
child: Container(
height: 30,
width: 30,
child: Icon(Icons.access_alarm),
),
),
),
title: Text(
'',
style: TextStyle(
fontSize: 0,
),
),
),
BottomNavigationBarItem(
icon: Padding(
padding: const EdgeInsets.only(top: 4),
child: Container(
width: 30,
child: Container(
height: 30,
width: 30,
child: Icon(Icons.access_alarm),
),
),
),
title: Text(
'',
style: TextStyle(
fontSize: 0,
),
),
),
BottomNavigationBarItem(
icon: Padding(
padding: const EdgeInsets.only(top: 4),
child: Container(
width: 30,
child: Container(
height: 30,
width: 30,
child: Icon(Icons.access_alarm),
),
),
),
title: Text(
'',
style: TextStyle(
fontSize: 0,
),
),
),
],
),
),
],
),
),
],
),