后退按钮取代了AppBar的标题 [英] Back Button displaced title of AppBar
本文介绍了后退按钮取代了AppBar的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
像标题一样,我已经使用Navigator.push()创建了一个按钮进入新页面,该页面会在appBar上自动生成一个后退按钮,我很欣赏该自动生成的后退按钮,但是我希望该后退按钮不移位我的
Like the title, i have created a button with Navigator.push() into a new page, the page auto generates a back button on the appBar, i appreciated that autogenerated back button but i want the back button to not displace my title's positioning, is that possible?
下面是我的按钮代码进入此页面:
Below is my code for the button to enter this page:
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) {
return FeedTest();
},
),
);
这是我在新页面上的完整代码:
This is my full code for the new page:
Widget build(BuildContext context) {
return ScrollConfiguration(
behavior: MyBehavior(),
child: SafeArea(
child: DefaultTabController(
length: 2,
child: Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.grey[850],
title: Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'images/logo2.png',
isAntiAlias: true,
scale: 1.8,
fit: BoxFit.fitHeight,
alignment: Alignment.center,
)
]),
bottom: TabBar(
indicatorColor: Colors.white,
tabs: [
Tab(
text: 'Submit Feedback',
),
Tab(
text: 'Submit Testimony',
)
],
),
),
body: TabBarView(
children: [SubmitFeedback(), SubmitTestimony()],
),
),
),
),
);
}
出于隐私保护目的,标题图像已经模糊化
P.S. Title image has been blurred for privacy purposes
推荐答案
centerTitle:正确
是用于在 AppBar
AppBar(
centerTitle: true,
...
)
输出:
这篇关于后退按钮取代了AppBar的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文