fix notes
This commit is contained in:
@@ -13,8 +13,8 @@ class _NotesViewState extends State<Note> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("ciao", style: TextStyle(color: Colors.lightBlue.shade900, fontWeight: FontWeight.bold),),
|
title: Text("Titolo"),
|
||||||
subtitle: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [Text('Descrizione della nota:'),],),
|
subtitle: Text('Testo'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
|
|||||||
@@ -30,26 +30,60 @@ class _CreateNewNoteState extends State<CreateNewNote> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text('Title:', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),),
|
TextField(
|
||||||
TextField(controller: _titleController, decoration: InputDecoration(hintText: 'Enter a title',),),
|
controller: _titleController,
|
||||||
SizedBox(height: 16), // Spacing between title and text
|
decoration: InputDecoration(
|
||||||
Text('Text:', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),),
|
hintText: 'Enter a title',
|
||||||
TextField(controller: _textController, maxLines: null, decoration: InputDecoration(hintText: 'Enter text', border: InputBorder.none,),
|
),
|
||||||
),
|
),
|
||||||
],
|
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:flutter/material.dart';
|
||||||
|
import 'package:progetto_m335_flutter/pages/NotesView.dart';
|
||||||
|
|
||||||
class NoteDetailView extends StatefulWidget {
|
class NoteDetailView extends StatefulWidget {
|
||||||
const NoteDetailView({super.key});
|
const NoteDetailView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<NoteDetailView> createState() => _NoteDetailViewState();
|
State<NoteDetailView> createState() => _NoteDetailViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _NoteDetailViewState extends State<NoteDetailView> {
|
class _NoteDetailViewState extends State<NoteDetailView> {
|
||||||
|
TextEditingController _titleController = TextEditingController();
|
||||||
|
TextEditingController _textController = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_titleController.dispose();
|
||||||
|
_textController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
appBar: AppBar(
|
||||||
child: Text('NoteDetailView'),
|
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,),
|
child: Icon(Icons.add),
|
||||||
backgroundColor: Colors.cyan.shade700,
|
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user