import 'package:flutter/material.dart';
class formScreen extends StatefulWidget {
const formScreen({super.key});
@override
State<formScreen> createState() => _formScreenState();
}
class _formScreenState extends State<formScreen> {
TextEditingController nameController = TextEditingController();
TextEditingController difficultyController = TextEditingController();
TextEditingController imageController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: const Icon(
Icons.keyboard_return,
size: 30,
color: Colors.white,
),
backgroundColor: Colors.blueGrey,
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text('Nova tarefa',
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.w500)),
],
),
),
body: Center(
child: Container(
width: 375,
height: 650,
decoration: BoxDecoration(
color: Colors.black12,
borderRadius: BorderRadius.circular(10),
border: Border.all(width: 1)),
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
controller: nameController,
decoration: InputDecoration(
border: OutlineInputBorder(),
hintText: 'Nome',
fillColor: Colors.white70,
filled: true,
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
controller: difficultyController,
decoration: InputDecoration(
border: OutlineInputBorder(),
hintText: 'Dificuldade',
fillColor: Colors.white70,
filled: true,
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
onChanged: (text) {
setState(() {
});
},
controller: imageController,
decoration: InputDecoration(
border: OutlineInputBorder(),
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: 1, color: Colors.blue),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Image.network(
imageController.text, fit: BoxFit.cover,
errorBuilder: (BuildContext context, Object exeption, StackTrace? stackTrace){
return Image.asset('assets/images/nophoto.jpg', fit: BoxFit.fitHeight,);
},),
),
),
ElevatedButton(
onPressed: () {
print(nameController.text);
print(difficultyController.text);
print(imageController.text);
},
child: Text('adicionar'),
)
],
),
)),
);
}
}