class FormularioDeTransferencia extends StatelessWidget {
final TextEditingController _controladorCampoNumeroConta =
TextEditingController();
final TextEditingController _controladorCampoValor = TextEditingController();
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Criando Transferencia'),
),
body: Column(
children: <Widget>[
Editor(
controlador: _controladorCampoNumeroConta,
rotulo: 'Número da Conta',
dica: '0000',
),
Editor(
controlador: _controladorCampoValor,
rotulo: 'Valor',
dica: '00.00',
icone: Icons.monetization_on,
),
RaisedButton(
child: Text('Confirmar'),
onPressed: () {
final int numeroConta =
int.tryParse(_controladorCampoNumeroConta.text);
final double valor =
double.tryParse(_controladorCampoValor.text);
if (numeroConta != null && valor != null) {
final tranferenciaCriada = Transferencia(valor, numeroConta);
debugPrint('Criando transferencia');
debugPrint('$tranferenciaCriada');
BuildContext context;
Navigator.pop(context, tranferenciaCriada);
}
},
),
],
));
}
}
Abaixo é o erro que aparece
═══════ Exception caught by gesture ═══════════════════════════════════════════ The following NoSuchMethodError was thrown while handling a gesture: The method 'findAncestorStateOfType' was called on null. Receiver: null Tried calling: findAncestorStateOfType()
When the exception was thrown, this was the stack
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
#1 Navigator.of _package:flutter/…/widgets/navigator.dart:2706
#2 Navigator.pop_______________________________________________________________________________________________package:flutter/…/widgets/navigator.dart:2592
#3 FormularioDeTransferencia.build._package:bytebank/main.dart:55
#4 InkResponseState.handleTap_____________________________________________________________________________package:flutter/…/material/ink_well.dart:991 ... Handler: "onTap" Recognizer: TapGestureRecognizer#014ea debugOwner: GestureDetector state: possible won arena finalPosition: Offset(226.0, 304.0) finalLocalPosition: Offset(67.8, 6.0) button: 1 sent tap down ════════════════════════════════════════════════════════════════════════════════