I am make settings page and want make like iOS settings (grey background and white tile). I am try add Container so can add color to ListTile but always get error.
Anyone know how to add Container here?
body: new SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Column(
children: <Widget>[
ListTile(
leading: Icon(
Icons.person,
color: Colors.grey,
),
title: Text("Account"),
trailing: Icon(Icons.keyboard_arrow_right),
),
Just wrap your ListTile
in a Container
Container(
color: Colors.grey[200],
child: ListTile(
leading: Icon(
Icons.person,
color: Colors.grey,
),
title: Text("Account"),
trailing: Icon(Icons.keyboard_arrow_right),
),
)
I wrap the ListTile
with a Material
widget and set the color. This will preserve the ripple effect of the listTile.
eg.
Material(
color: Colors.grey[300],
child: ListTile(
title: Text('Hello')
)
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.