如何在 flutter 中创建下拉选项卡
How to create a drop down tab in flutter
嗨,我是 flutter 的新手,我想知道有什么方法可以创建如上图所示的下拉菜单。它应该是可点击的,里面有文字,当用户点击它时,会显示更多关于标题的文字。我能得到的最接近的东西是墨水瓶,但我不知道如何在它上面添加下拉效果。如果你能帮助我,我将不胜感激
如果您正在寻找与图像类似的东西,那么 ExpansionTile 是正确的小部件,您只需要将 Text 作为子项放在 ExpansionTile 中,这样它将被隐藏,除非用户单击它,像这样:
Card(
child: ExpansionTile(
title: Text('Click on me',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w500),
),
children: <Widget>[
Text('Your text here',
style: TextStyle(fontWeight: FontWeight.w700),
)
],
),
);
嗨,我是 flutter 的新手,我想知道有什么方法可以创建如上图所示的下拉菜单。它应该是可点击的,里面有文字,当用户点击它时,会显示更多关于标题的文字。我能得到的最接近的东西是墨水瓶,但我不知道如何在它上面添加下拉效果。如果你能帮助我,我将不胜感激
如果您正在寻找与图像类似的东西,那么 ExpansionTile 是正确的小部件,您只需要将 Text 作为子项放在 ExpansionTile 中,这样它将被隐藏,除非用户单击它,像这样:
Card(
child: ExpansionTile(
title: Text('Click on me',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w500),
),
children: <Widget>[
Text('Your text here',
style: TextStyle(fontWeight: FontWeight.w700),
)
],
),
);