diff --git a/lib/Components/Note.dart b/lib/Components/Note.dart index c0d31c8..b2e00d9 100644 --- a/lib/Components/Note.dart +++ b/lib/Components/Note.dart @@ -13,8 +13,8 @@ class _NotesViewState extends State { @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( diff --git a/lib/pages/CreateNewNote.dart b/lib/pages/CreateNewNote.dart index f0a8b8f..2f8f941 100644 --- a/lib/pages/CreateNewNote.dart +++ b/lib/pages/CreateNewNote.dart @@ -30,26 +30,60 @@ class _CreateNewNoteState extends State { 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, - ), ); } } diff --git a/lib/pages/NoteDetailView.dart b/lib/pages/NoteDetailView.dart index a9802da..7f3b04d 100644 --- a/lib/pages/NoteDetailView.dart +++ b/lib/pages/NoteDetailView.dart @@ -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 createState() => _NoteDetailViewState(); } class _NoteDetailViewState extends State { + 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"), + ), + ), + ], + ), + ], // + ), + ), ); } } diff --git a/lib/pages/NotesView.dart b/lib/pages/NotesView.dart index dbea091..4ad2961 100644 --- a/lib/pages/NotesView.dart +++ b/lib/pages/NotesView.dart @@ -27,8 +27,7 @@ class _NotesViewState extends State { ), ); }, - child: Icon(Icons.add, color: Colors.white,), - backgroundColor: Colors.cyan.shade700, + child: Icon(Icons.add), ),