Bem, vou tentar explicar melhor. Nesta aula o professor explica como criar uma classe e fazer a estender esta classe para utiliza-la no body do scaffold, quando eu faço isso exatamente como esta na aula meu app para de funcionar como se estivesse faltando algo na criação da classe, creio que seja por conta da versão que estou utilizando. Eu tentei dar uma olhada na documentação porém como conheço pouco do flutter não estou conseguindo evoluir, travei nessa aula.
*Meu código esta desta forma.
*
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: Scaffold(
body: ListaTransferencias(),
appBar: AppBar(
title: Text('Transferências'),
),
floatingActionButton: FloatingActionButton(
onPressed: () {},
child: Icon(Icons.add),
),
),
));
class ListaTransferencias extends StatelessWidget{
@override
Widget build(BuildContext context) {
// TODO: implement build
return Column(
children: [
Card(
child: ListTile(
leading: Icon(Icons.monetization_on),
title: Text('100.0'),
subtitle: Text('1000'),
),
),
Card(
child: ListTile(
leading: Icon(Icons.monetization_on),
title: Text('200.0'),
subtitle: Text('1000'),
),
),
],
);
}
}
}
*E eu tenho o seguinte retorno :
*
Launching lib\main.dart on Android SDK built for x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
lib/main.dart:6:13: Error: Method not found: 'ListaTransferencias'.
body: ListaTransferencias(),
^^^^^^^^^^^^^^^^^^^
lib/main.dart:17:3: Error: 'class' can't be used as an identifier because it's a keyword.
Try renaming this to be an identifier that isn't a keyword.
class ListaTransferencias extends StatelessWidget{
^^^^^
lib/main.dart:17:3: Error: Expected ';' after this.
class ListaTransferencias extends StatelessWidget{
^^^^^
lib/main.dart:17:3: Error: Undefined name 'class'.
class ListaTransferencias extends StatelessWidget{
^^^^^
lib/main.dart:17:9: Error: Expected ';' after this.
class ListaTransferencias extends StatelessWidget{
^^^^^^^^^^^^^^^^^^^
lib/main.dart:17:9: Error: Undefined name 'ListaTransferencias'.
class ListaTransferencias extends StatelessWidget{
^^^^^^^^^^^^^^^^^^^
lib/main.dart:17:29: Error: 'extends' can't be used as an identifier because it's a keyword.
Try renaming this to be an identifier that isn't a keyword.
class ListaTransferencias extends StatelessWidget{
^^^^^^^
lib/main.dart:17:29: Error: Expected ';' after this.
class ListaTransferencias extends StatelessWidget{
^^^^^^^
lib/main.dart:17:29: Error: Undefined name 'extends'.
class ListaTransferencias extends StatelessWidget{
^^^^^^^
lib/main.dart:17:37: Error: Expected ';' after this.
class ListaTransferencias extends StatelessWidget{
^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\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 3m 1s
Exception: Gradle task assembleDebug failed with exit code 1