|

Flutterの練習9-1:ListView(その1)

ListViewは何かと使う機会が多いと思います。まずは基本となる1つ1つリストを追加していく方法です。
Leadingは、最初に配置、trailingは最後に配置となります。できたのはこちら

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Simple ListView'),
        ),
        body: ListView(
          children: [
            ListTile(
              leading: Icon(Icons.map),
              title: Text('Map'),
              subtitle: Text("Google Map"),
              trailing: Icon(Icons.delete),
            ),
            ListTile(
              leading: Icon(Icons.photo_album),
              title: Text('Album'),
              subtitle: Text("Beatles One"),
              trailing: Icon(Icons.air),
            ),
            ListTile(
              leading: Icon(Icons.phone),
              title: Text('Phone'),
              subtitle: Text("ET phone home"),
              subtitleTextStyle: TextStyle(color: Colors.blue),
              trailing: Icon(Icons.note),
            ),
          ],
        ),
      ),
    );
  }
}

類似投稿

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

This site uses Akismet to reduce spam. Learn how your comment data is processed.