Tô aqui com esses erros no momento, e não consigo resolver. Alguma sugestão?
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
lib/main.dart:63:16: Error: The parameter 'controlador' can't have a value of 'null' because of its type 'TextEditingController', but the implicit default value is 'null'.
- 'TextEditingController' is from 'package:flutter/src/widgets/editable_text.dart' ('../flutter/packages/flutter/lib/src/widgets/editable_text.dart').
Try adding either an explicit non-'null' default value or the 'required' modifier.
Editor({this.controlador, this.rotulo, this.dica, this.icone});
^^^^^^^^^^^
lib/main.dart:63:34: Error: The parameter 'rotulo' can't have a value of 'null' because of its type 'String', but the implicit default value is 'null'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
Editor({this.controlador, this.rotulo, this.dica, this.icone}); ^^^^^^
lib/main.dart:63:47: Error: The parameter 'dica' can't have a value of 'null' because of its type 'String', but the implicit default value is 'null'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
Editor({this.controlador, this.rotulo, this.dica, this.icone}); ^^^^
lib/main.dart:63:58: Error: The parameter 'icone' can't have a value of 'null' because of its type 'IconData', but the implicit default value is 'null'. - 'IconData' is from 'package:flutter/src/widgets/icon_data.dart' ('../flutter/packages/flutter/lib/src/widgets/icon_data.dart').
Try adding either an explicit non-'null' default value or the 'required' modifier.
Editor({this.controlador, this.rotulo, this.dica, this.icone});
^^^^^
FAILURE: Build failed with an exception.
Where:
Script 'C:\Dev\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\Dev\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 9s
Exception: Gradle task assembleDebug failed with exit code 1
C O D I G O
class FormularioTransferencia extends StatelessWidget {
final TextEditingController _controladorCampoNumeroConta =
TextEditingController();
final TextEditingController _controladorCampoValor = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Criando Transferência')),
body: Column(
children: [
Editor(
controlador: controladorCampoNumeroConta,
dica: '0000',
rotulo: 'Número da conta'),
Editor(
dica: '0.00',
controlador: _controladorCampoValor,
rotulo: 'Valor',
icone: Icons.monetizationon,
),
ElevatedButton(
child: Text('Confirmar'),
onPressed: () {
debugPrint('clicou confirmar');
final int? numeroConta =
int.tryParse(controladorCampoNumeroConta.text);
final double? valor =
double.tryParse(controladorCampoValor.text);
if (numeroConta != null && valor != null) {
final transferenciaCriada = Transferencia(valor, numeroConta);
debugPrint('$transferenciaCriada');
}
},
),
],
),
);
}
}
class Editor extends StatelessWidget {
final TextEditingController controlador;
final String rotulo;
final String dica;
final IconData icone;
Editor({this.controlador, this.rotulo, this.dica, this.icone});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 2, 16, 0),
child: TextField(
controller: controlador,
style: TextStyle(fontSize: 20),
decoration: InputDecoration(
icon: Icon(icone),
labelText: rotulo,
hintText: dica,
),
),
);
}
}