import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Transferências'),
),
body: const ListaTransferencias(),
floatingActionButton: const FloatingActionButton(
onPressed: null,
child: Icon(Icons.add),
),
),
),
);
class ListaTransferencias extends StatelessWidget {
const ListaTransferencias({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
children: [
ItemTransferencia(
transferencia: Transferencia(100.00, 859528),
),
ItemTransferencia(
transferencia: Transferencia(200, 859528),
),
ItemTransferencia(
transferencia: Transferencia(300, 859528),
),
],
);
}
}
class ItemTransferencia extends StatelessWidget {
final Transferencia transferencia;
const ItemTransferencia({
Key? key,
required this.transferencia,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Card(
child: ListTile(
leading: const Icon(
Icons.monetization_on,
color: Colors.green,
),
title: Text('R\$ ${transferencia.valor.toString()}'),
subtitle: Text(transferencia.numeroConta.toString()),
),
);
}
}
class Transferencia {
final double valor;
final int numeroConta;
Transferencia(this.valor, this.numeroConta);
}