【发布时间】:2020-06-10 07:55:06
【问题描述】:
我有一个主屏幕,底部标签栏有 4 个栏。现在我关心的是第一个标签栏。
第一个标签栏中显示了不同的类别,例如。正如您在屏幕截图中看到的那样,有 2 个类别:
1) 第 1 类(摩托车越野赛、公路和配件) 2) 热门类别
现在,当我单击任何类别 1 时,我想要底部的标签栏(4 个标签栏),但是当我打开流行类别时,我不想要那个标签栏。
所以我被困在这里了。
下面是我的代码sn-p。
Scaffold(
backgroundColor: Colors.white,
body: GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
},
child: SafeArea(
top: true,
child: SizedBox.expand(
child: PageView(
physics: new NeverScrollableScrollPhysics(),
controller: _pageController,
onPageChanged: (index) {
setState(() => currentIndex = index);
},
children: <Widget>[
Products(),
News(),
Service(),
Events(),
],
),
),
),
),
floatingActionButton: FloatingActionButton(
elevation: 0,
child: Image.asset('assets/icons/bottom_center.png'),
backgroundColor: Colors.transparent,
focusElevation: 10,
disabledElevation: 10,
highlightElevation: 10,
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) {
return WorldCategories();
}));
},
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: BottomNavigationBar(
currentIndex: currentIndex,
onTap: (index) {
setState(() {
currentIndex = index;
_pageController.jumpToPage(index);
});
},
items: [
BottomNavigationBarItem(
icon: Icon(Icons.ac_unit), title: Text("A")),
BottomNavigationBarItem(
icon: Icon(Icons.ac_unit), title: Text("X")),
BottomNavigationBarItem(
icon: Icon(Icons.ac_unit), title: Text("Y")),
BottomNavigationBarItem(
icon: Icon(Icons.ac_unit), title: Text("Z")),
]),
);
并且还在第二个屏幕上设置了浮动操作按钮。
【问题讨论】:
-
您能否显示产品页面,因为它可能会从那里重定向并且看不到该产品页面的代码
-
你的意思是要查看产品页面点击的代码?
-
只需检查我发布的代码
-
是的,无论您发布什么都是正确的。我还将该代码设置为打开整页,但我主要关心的是第二页。如何在该屏幕上设置底部并管理后台以打开第一个屏幕?
-
我显示了主屏幕和第二屏幕。我要管理的。