[英]Flutter position Text in floating-action-button?
Is there anyway that I can position text in the extended floating action button.无论如何我可以在扩展的浮动操作按钮中定位文本。
For example I want to position text at the right corner of the button.例如,我想在按钮的右上角放置文本。
How can I do this ?我怎样才能做到这一点 ?
Thank you for your help.感谢您的帮助。
The FloatingActionButton in the Scaffold accepts a widget. Scaffold 中的 FloatingActionButton 接受一个小部件。 So you can do something like this:
所以你可以做这样的事情:
floatingActionButton: Stack(
children: [
FloatingActionButton.extended(
// label cannot be null, but it's a widget
// so it can be an empty container or something else
label: Text("button"),
icon: Icon(Icons.add),
onPressed: () {},
),
Positioned(right: 0.0, top: 0.0, child: Text("text")),
],
),
尝试使用 Padding 包裹 Text Widget 或将 padding 设置为浮动操作按钮。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.