Fiz o passo a passo do vídeo, porém está dando erro, segue o código e posteriormente o erro que está aparecendo pra mim.
home: Scaffold(
appBar: AppBar(
title: Text('Tarefas'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Task(),
Task(),
Task(),
],
),
floatingActionButton: FloatingActionButton(onPressed: () {}),
));
}
}
class Task extends StatelessWidget {
const Task({super.key});
@override
Widget build(BuildContext context) {
return const 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('Aprender Flutter'),
ElevatedButton(
onPressed: () {}, child: Icon(Icons.arrow_drop_up),
),
],
),
),
],
),
);
}
}
Erro: lib/main.dart:45:11: Error: Cannot invoke a non-'const' constructor where a const expression is expected. Try using a constructor or factory that is 'const'. Container( ^^^^^^^^^ lib/main.dart:55:17: Error: Cannot invoke a non-'const' constructor where a const expression is expected. Try using a constructor or factory that is 'const'. Container( ^^^^^^^^^ lib/main.dart:62:30: Error: Not a constant expression. onPressed: () {}, child: Icon(Icons.arrow_drop_up), ^^ lib/main.dart:49:11: Error: Cannot invoke a non-'const' constructor where a const expression is expected. Try using a constructor or factory that is 'const'. Container( ^^^^^^^^^ lib/main.dart:42:18: Error: Cannot invoke a non-'const' constructor where a const expression is expected. Try using a constructor or factory that is 'const'. return const Container( ^^^^^^^^^