背景:你好。我刚刚开始学习 Flutter,在我正在构建的应用程序的左上角尝试创建下拉菜单时遇到了溢出错误。
问题: 如何准确格式化我的应用左上角的下拉菜单。我希望菜单与左侧屏幕的一侧齐平,并且图标位于相对于最右侧图标的对称相反位置,如附图中所示。以前,我有一个 IconButton 而不是 DropdownButton,而 IconButton 本身是自动正确定位的。我还想正确地将菜单图标居中,因为如您所见,它略微偏离中心垂直。
代码:
appBar: AppBar(
leading: DropdownButton(icon: Icon(Icons.menu, color: colorPalette.chooseColor('black')), items: [DropdownMenuItem(child: Text('Events'),],),
centerTitle: true,
title: Text('Some Title', style: TextStyle(color: colorPalette.chooseColor('black'), fontSize: 23),),
actions: <Widget>[
IconButton(
icon: Icon(Icons.map_outlined,
),
onPressed: () {
// do something
},
)
],
),