Switch List Tile in flutter
- 2021年8月27日
- 技術情報
Take a moment to think back to the last time you looked at the settings page. If you wish you would quickly and easily create a list of toggle switches like that, just use SwitchListTile.

Switch List Tile, you get a little tile that’s tappable anywhere to switch a toggle from off to on.
SwitchListTitles API looks a lot like widgets of similar names. ListTile, CheckboxListTile, RadioListTile, SwitchListTile all follow the same pattern.
ListTile(
title: Text("List Tile"),
),
SwitchListTile(
title: Text("Switch List Tile"),
/*.....*/
),
Start with the title : Text, which will appear in the middle of the tile. Then you can add Icons to either end, and with the control tiles like SwitchListTile.

ListTile(
title: Text("List Tile"),
leading: Icon(Icons.ac_unit),
trailing: Fire(),
),
SwitchListTile(
title: Text("Switch List Tile"),
secondary: Icon(Icons.ac_unit),
),
Hope you enjoyed this article!
By Ami
asahi at 2021年08月27日 10:00:52