O Widget em negrito abaixo está sendo marcado com o seguinte erro: The named parameter 'onPressed' is required, but there's no corresponding argument. Try adding the required argument.
O que fazer neste caso?
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp( home: Scaffold( body: ListaTransferencias(), appBar: AppBar( title: Text('Transferências'), ), floatingActionButton: FloatingActionButton( child: Icon(Icons.add), ), ), ));
class ListaTransferencias extends StatelessWidget { @override Widget build(BuildContext context) { return Column( children: [ ItemTransferencia(Transferencia(100.0, 1000)), ItemTransferencia(Transferencia(200.0, 2000)), ItemTransferencia(Transferencia(300.0, 3000)), ], ); } }
class ItemTransferencia extends StatelessWidget {
final Transferencia _transferencia;
ItemTransferencia(this._transferencia);
@override Widget build(BuildContext context) { return Card( child: ListTile( leading: Icon(Icons.monetization_on), title: Text(transferencia.valor.toString()), subtitle: Text(transferencia.numeroConta.toString()), )); } }
class Transferencia { final double valor; final int numeroConta;
Transferencia(this.valor, this.numeroConta); }