我想在DrawerHeader中显示多行文本。现在,我正在用一个实际的Text小部件来实现它,该小部件的值是一个字符串,其中包含多个“ \ n”值,以实现我的目标。
我有以下代码:
Widget _buildDrawer() {
return ListView(
// Important: Remove any padding from the ListView.
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
child: Text(
_currentUser.displayName + "\n" + "Something 1 \n" + "Something 2", //Here is the problem, I would like to create a custom Text widget for each of these texts.
maxLines: 3,
style: TextStyle(
color: Colors.white
),
),
decoration: BoxDecoration(
color: Colors.blue,
),
),
ListTile(
title: Text('Stúdium jelentkezés'),
onTap: () {
// Update the state of the app.
// ...
// Then close the drawer.
Navigator.pop(context);
},
),
ListTile(
title: Text('Koleszhírek'),
onTap: () {
// Update the state of the app.
// ...
},
),
ListTile(
title: Text('Profil'),
onTap: () {
// Update the state of the app.
// ...
},
),
],
);
}
您可以使用Wrap
小部件官方文档。
Wrap(
children: <Widget>[
Text(...),
Text(...),
],
)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句