facebook twitter hatena line email

Flutter/UI/ListTile

提供: 初心者エンジニアの簡易メモ
2019年11月27日 (水) 01:47時点におけるAdmin (トーク | 投稿記録)による版 (小技)

移動: 案内検索

ListTileとは

ListViewの1行を表す。

サンプル

ListTile(
  title: Text("リスト1",
    style: TextStyle(
      locale: Locale("ja", "JP"),
    )
  ),
  trailing: Icon(Icons.more_vert),
  onTap: () {
     // tap時の挙動
  },
);

小技

heightで高さ幅を小さくできる。

new Container(
                height: 56.0,
                color: Colors.white,
                child: Row(
                  children: <Widget>[
                    Expanded(
                      child: new ListTile(
                        leading: new CircleAvatar(
                          backgroundColor: StaticFunction.toColorByStr(
                              listdatas[index].color),
                          child: new Text(listdatas[index].thumbtitle,),
                          foregroundColor: Colors.white,
                        ),
                        title: new Text(listdatas[index].title,
                          style: TextStyle(
                              locale: Locale("ja", "JP")
                          ),
                        ),
                        subtitle: new Text(
                          listdatas[index].subtitle,
                          style: TextStyle(
                            locale: Locale("ja", "JP"),
                            fontSize: 10,
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              ),