fix notes
This commit is contained in:
@@ -13,8 +13,8 @@ class _NotesViewState extends State<Note> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
title: Text("ciao", style: TextStyle(color: Colors.lightBlue.shade900, fontWeight: FontWeight.bold),),
|
||||
subtitle: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [Text('Descrizione della nota:'),],),
|
||||
title: Text("Titolo"),
|
||||
subtitle: Text('Testo'),
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
|
||||
@@ -30,26 +30,60 @@ class _CreateNewNoteState extends State<CreateNewNote> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Title:', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),),
|
||||
TextField(controller: _titleController, decoration: InputDecoration(hintText: 'Enter a title',),),
|
||||
SizedBox(height: 16), // Spacing between title and text
|
||||
Text('Text:', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),),
|
||||
TextField(controller: _textController, maxLines: null, decoration: InputDecoration(hintText: 'Enter text', border: InputBorder.none,),
|
||||
TextField(
|
||||
controller: _titleController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Enter a title',
|
||||
),
|
||||
),
|
||||
],
|
||||
SizedBox(height: 16),
|
||||
TextField(
|
||||
controller: _textController,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Enter text',
|
||||
border: InputBorder.none,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Spacer(),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
print("Delete button pressed");
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.red,
|
||||
),
|
||||
child: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.delete),
|
||||
Text("Delete"),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
String title = _titleController.text;
|
||||
String text = _textController.text;
|
||||
_titleController.clear();
|
||||
_textController.clear();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text("Save"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
], //
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () {
|
||||
String title = _titleController.text;
|
||||
String text = _textController.text;
|
||||
_titleController.clear();
|
||||
_textController.clear();
|
||||
|
||||
},
|
||||
child: Icon(Icons.save, color: Colors.white,),
|
||||
backgroundColor: Colors.lightBlue.shade900,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,89 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:progetto_m335_flutter/pages/NotesView.dart';
|
||||
|
||||
class NoteDetailView extends StatefulWidget {
|
||||
const NoteDetailView({super.key});
|
||||
const NoteDetailView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<NoteDetailView> createState() => _NoteDetailViewState();
|
||||
}
|
||||
|
||||
class _NoteDetailViewState extends State<NoteDetailView> {
|
||||
TextEditingController _titleController = TextEditingController();
|
||||
TextEditingController _textController = TextEditingController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_titleController.dispose();
|
||||
_textController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: Text('NoteDetailView'),
|
||||
)
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Edit note'),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextField(
|
||||
controller: _titleController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Enter a title',
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
TextField(
|
||||
controller: _textController,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Enter text',
|
||||
border: InputBorder.none,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Spacer(),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
print("Delete button pressed");
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.red,
|
||||
),
|
||||
child: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.delete),
|
||||
Text("Delete"),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
String title = _titleController.text;
|
||||
String text = _textController.text;
|
||||
_titleController.clear();
|
||||
_textController.clear();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text("Save"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
], //
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,7 @@ class _NotesViewState extends State<NotesView> {
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.add, color: Colors.white,),
|
||||
backgroundColor: Colors.cyan.shade700,
|
||||
child: Icon(Icons.add),
|
||||
),
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user