【发布时间】:2023-01-17 02:31:44
【问题描述】:
我想当我点击“Nova Reserva”按钮时,它会打开一个新屏幕,但在同一个选项卡中,而不会丢失 TabBar。
应用程序 enter image description here
当前的 enter image description here
代码 TabBarView
TabBarView(
controller: _tabController,
children: const [
HomeTab(),
ResearchesTab(),
SchedulesTab(),
Center(
child: Text('MENSAGENS'),
),
Center(
child: Text('CADASTROS'),
),
],
),
代码标签栏
child: TabBar(
physics: const BouncingScrollPhysics(),
controller: _tabController,
isScrollable: true,
indicatorPadding: EdgeInsets.symmetric(
vertical: size.height * .005,
),
indicatorSize: TabBarIndicatorSize.label,
indicator: BoxDecoration(
border: Border(
bottom: BorderSide(
color: CustomColors.orange,
width: size.height * .004,
),
),
),
labelPadding: EdgeInsets.symmetric(
horizontal: size.width * .04,
),
tabs: const [
TabBarTile(
image: 'assets/images/home.png',
label: 'Home',
),
TabBarTile(
image: 'assets/images/pesquisas.png',
label: 'Pesquisas',
),
TabBarTile(
image: 'assets/images/agendamentos.png',
label: 'Agendamentos',
),
TabBarTile(
image: 'assets/images/mensagens.png',
label: 'Mensagens',
),
TabBarTile(
image: 'assets/images/cadastros.png',
label: 'Cadastros',
),
],
),
在按钮中,我使用 GetX 导航,但我也尝试使用 MaterialPageRoute,但没有成功。
【问题讨论】: