flutter listtile
ListTile(
title: Text('ListTile'),
isThreeLine: true,
subtitle: Text('Secondary text\nTertiary text'),
leading: Icon(Icons.label),
trailing: Text('Metadata'),
),
flutter listtile
ListTile(
title: Text('ListTile'),
isThreeLine: true,
subtitle: Text('Secondary text\nTertiary text'),
leading: Icon(Icons.label),
trailing: Text('Metadata'),
),
flutter list tile
ListTile(
leading: const Icon(Icons.flight_land),
title: const Text("Trix's airplane"),
subtitle: const Text('The airplane is only in Act II.'),
onTap: () => print("ListTile")
)
listtile flutter
ListTile(
tileColor: Colors.white,
leading: Image(
image: NetworkImage(
'https://jardin-secrets.com/image.php?/12435/photo-dracaena-fragrans_krzysztof-ziarnek.jpg'),
),
title: Text("Dragonnier"),
subtitle: Text("Dracaena"),
isThreeLine: true,
trailing: Icon(Icons.more_vert)
),
how to put two trailing icons in list tile flutter
Adding mainAxisSize: MainAxisSize.min to the Row() instance fixes the issue.
flutter listtile height
class CustomListItem extends StatelessWidget {
const CustomListItem({
this.thumbnail,
this.title,
this.user,
this.viewCount,
});
final Widget thumbnail;
final String title;
final String user;
final int viewCount;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 5.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 2,
child: thumbnail,
),
Expanded(
flex: 3,
child: _VideoDescription(
title: title,
user: user,
viewCount: viewCount,
),
),
const Icon(
Icons.more_vert,
size: 16.0,
),
],
),
);
}
}
class _VideoDescription extends StatelessWidget {
const _VideoDescription({
Key key,
this.title,
this.user,
this.viewCount,
}) : super(key: key);
final String title;
final String user;
final int viewCount;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(5.0, 0.0, 0.0, 0.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
title,
style: const TextStyle(
fontWeight: FontWeight.w500,
fontSize: 14.0,
),
),
const Padding(padding: EdgeInsets.symmetric(vertical: 2.0)),
Text(
user,
style: const TextStyle(fontSize: 10.0),
),
const Padding(padding: EdgeInsets.symmetric(vertical: 1.0)),
Text(
'$viewCount views',
style: const TextStyle(fontSize: 10.0),
),
],
),
);
}
}
// ...
Widget build(BuildContext context) {
return ListView(
padding: const EdgeInsets.all(8.0),
itemExtent: 106.0,
children: <CustomListItem>[
CustomListItem(
user: 'Flutter',
viewCount: 999000,
thumbnail: Container(
decoration: const BoxDecoration(color: Colors.blue),
),
title: 'The Flutter YouTube Channel',
),
CustomListItem(
user: 'Dash',
viewCount: 884000,
thumbnail: Container(
decoration: const BoxDecoration(color: Colors.yellow),
),
title: 'Announcing Flutter 1.0',
),
],
);
}
listtile flutter
// main.dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// Remove the debug banner
debugShowCheckedModeBanner: false,
title: 'Kindacode.com',
theme: ThemeData(
primarySwatch: Colors.deepPurple,
),
home: HomePage());
}
}
class HomePage extends StatelessWidget {
// Generate some dummy data
final List<Map<String, dynamic>> _items = List.generate(
10,
(index) =>
{"id": index, "title": "Item $index", "subtitle": "Subtitle $index"});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Kindacode.com'),
),
body: ListView(
children: ListTile.divideTiles(
color: Colors.deepPurple,
tiles: _items.map((item) => ListTile(
leading: CircleAvatar(
backgroundColor: Colors.amber,
child: Text(item['id'].toString()),
),
title: Text(item['title']),
subtitle: Text(item['subtitle']),
trailing: IconButton(
icon: Icon(Icons.delete),
onPressed: () {},
),
))).toList()));
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us