Está dando esse erro quando coloco pra rodar o código, o que pode ser? Performing hot restart... Syncing files to device sdk gphone64 x86 64... lib/main.dart:41:23: Error: Expected ')' before this. const Task(this.nome{super.key}); ^
Segue código:
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: Scaffold(
appBar: AppBar(
title: Text('Tarefas'),
),
body: ListView(
children: [
const Task('Aprender Flutter'),
const Task('Andar de bike'),
const Task('Meditar'),
const Task('Meditar'),
const Task('Meditar'),
const Task('Meditar'),
],
),
floatingActionButton: FloatingActionButton(onPressed: () {}),
));
}
}
class Task extends StatelessWidget {
final String nome;
const Task(this.nome{super.key});
@override
Widget build(BuildContext context) {
return Container(
child: Stack(
children: [
Container(
color: Colors.blue,
height: 140,
),
Container(
color: Colors.white,
height: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
color: Colors.black26,
width: 72,
height: 100,
),
Text(nome),
ElevatedButton(
onPressed: () {}, child: Icon(Icons.arrow_drop_up),
),
],
),
),
],
),
);
}
}