diff --git a/lib/pages/CreateNewNote.dart b/lib/pages/CreateNewNote.dart index 7d2ca8d..f0a8b8f 100644 --- a/lib/pages/CreateNewNote.dart +++ b/lib/pages/CreateNewNote.dart @@ -1,19 +1,55 @@ import 'package:flutter/material.dart'; +import 'package:progetto_m335_flutter/pages/NotesView.dart'; class CreateNewNote extends StatefulWidget { - const CreateNewNote({super.key}); + const CreateNewNote({Key? key}) : super(key: key); @override State createState() => _CreateNewNoteState(); } class _CreateNewNoteState 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('CreateNewNote'), - ) + return Scaffold( + appBar: AppBar( + title: Text('Create New Note'), + ), + body: Padding( + padding: const EdgeInsets.all(16.0), + 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,), + ), + ], + ), + ), + 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, + ), ); } -} \ No newline at end of file +} diff --git a/lib/pages/NotesView.dart b/lib/pages/NotesView.dart index b6a5f2c..ddaf7a0 100644 --- a/lib/pages/NotesView.dart +++ b/lib/pages/NotesView.dart @@ -27,7 +27,7 @@ class _NotesViewState extends State { ), ); }, - child: Icon(Icons.add), + child: Icon(Icons.add, color: Colors.white,), backgroundColor: Colors.lightBlue.shade900, ),