简体   繁体   English

如何在Appbar左侧创建按钮[flutter]

[英]How to create button on the left in Appbar [flutter]

I tried to make the button[that pop new screen]on the left of the app-bar but I found only drawer that is not what I want.我试图在应用栏左侧制作按钮[弹出新屏幕],但我发现只有抽屉不是我想要的。

what I want in AppBar:我在 AppBar 中想要什么:

------------------------------------------------<br>
| button |----------text----------| button |<br>
------------------------------------------------<br>

what I have now:我现在拥有的:

------------------------------------------------<br>
----------------text----------------| button | <- form actions in AppBar<br>
------------------------------------------------<br>

If I understand correctly, you want to add a left button to your AppBar .如果我理解正确,您想在AppBar中添加一个左按钮。 You can achieve that by using the leading property, like this:您可以通过使用leading属性来实现这一点,如下所示:

AppBar(
  title: Text("AppBar with leading button"),
  automaticallyImplyLeading: false,
  leading: IconButton (
                 icon: Icon(Icons.arrow_back), 
                 onPressed: () { 
                       /** Do something */ 
                 },
            ),
)

To insert a widget on the left side of an Appbar, you must use the property: "leading" , in addition to this, you can increase the width of this widget with the property: "leadingWidth"要在 Appbar 的左侧插入一个小部件,您必须使用属性: "leading" ,除此之外,您可以使用属性: "leadingWidth"增加这个小部件的宽度

appbar: AppBar(
  leading: Widget(),
  leadingWidth: 100
 )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM