@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('New Task'),
),
body: Center(
child: Container(
decoration: BoxDecoration(
color: Colors.grey.shade300,
borderRadius: const BorderRadius.all(
Radius.circular(15),
),
border: Border.all(color: Colors.black)),
height: 650,
width: 375,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
controller: nameController,
textAlign: TextAlign.center,
decoration: const InputDecoration(
border: UnderlineInputBorder(),
hintText: 'Nome',
fillColor: Colors.white70,
filled: true,
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
controller: difficultyController,
textAlign: TextAlign.center,
decoration: const InputDecoration(
border: UnderlineInputBorder(),
hintText: 'Dificuldade',
fillColor: Colors.white70,
filled: true,
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
onChanged: (text){
setState(() {
});
},
controller: imageController,
textAlign: TextAlign.center,
decoration: const InputDecoration(
border: UnderlineInputBorder(),
hintText: 'Imagem',
fillColor: Colors.white70,
filled: true,
),
),
),
Container(
height: 100,
width: 72,
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(10),
border: Border.all(width: 2, color: Colors.blue),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Image.network(
imageController.text,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset('assets/images/nophoto.png');
} ,
fit: BoxFit.cover,
),
),
),
const SizedBox(
height: 15,
),
ElevatedButton(
onPressed: () {
//TextEditingController tem varios parametros '.text' imprime só o texto.
// print(nameController.text);
// print(int.parse(difficultyController.text));
// print(imageController.text);
},
child: const Text('Adicionar!'),
),
],
),
),
),
);
}
}