[英]How to use ListTileTheme to style ListTile inside ListView?
I'm trying to use ListTileStyle after ListView我正在尝试在 ListView 之后使用 ListTileStyle
ListView(
ListTileStyle(),
Children:<widget>[
ListTile(),
ListTile(),
ListTile(),
]
),
but not able to use any property of ListTile.但不能使用 ListTile 的任何属性。 Can any one explain how ListTileStyle works.
任何人都可以解释 ListTileStyle 是如何工作的。
You should use "ListTileTheme" instead with your ListView as a child, so you can change any property of all the ListTiles you're going to use as childs. 您应该将“ ListTileTheme”与ListView一起用作子项,以便可以更改要用作子项的所有ListTiles的任何属性。
ListTileTheme(
//properties you want to add
child: ListView(
children: <Widget>[//your code],
),
),
ListView( Children:<widget>[ ListTile(), ListTile(), ListTileTheme( //do sth. child: ListTile( ), ) ] ),
Flutter now has the field listTileTheme
in ThemeData
, so if you want to share the same list tile theme across your app, you can set it in the theme you provide to the MaterialApp
: Flutter 现在在 ThemeData 中有字段
listTileTheme
,所以如果你想在你的应用程序中共享相同的列表ThemeData
贴主题,你可以在你提供给MaterialApp
的主题中设置它:
MaterialApp(
theme: ThemeData(
listTileTheme: ListTileThemeData(
// The properties you want to set.
),
),
home: // Your home screen.
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.