Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ccb56ffa9c | ||
|
|
bf3a9c552d | ||
|
|
c2196663ae | ||
|
|
6d9eb5f4db | ||
|
|
b284a3d6d6 | ||
|
|
d69c7ab525 | ||
|
|
c0c090085f | ||
|
|
850497301c | ||
|
|
4121239e36 | ||
|
|
abc0926f49 | ||
|
|
0d53d1421f | ||
|
|
b81cfc70fb | ||
|
|
0fb537d24e | ||
|
|
06a3712d0a | ||
|
|
65ed67b8f6 | ||
|
|
bf7981671d | ||
|
|
2f851bc630 | ||
|
|
4c4dcc2654 | ||
| 05386ac20f | |||
| 9f26bc8595 | |||
|
|
c35684c8f1 | ||
| 205f575db5 | |||
| ecf7011302 | |||
| 58e013a709 |
27
lib/Components/Note.dart
Normal file
27
lib/Components/Note.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../pages/NoteDetailView.dart';
|
||||
|
||||
class Note extends StatefulWidget {
|
||||
const Note({super.key});
|
||||
|
||||
@override
|
||||
State<Note> createState() => _NotesViewState();
|
||||
}
|
||||
|
||||
class _NotesViewState extends State<Note> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
title: Text("Titolo"),
|
||||
subtitle: Text('Testo'),
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const NoteDetailView(),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'myApp.dart';
|
||||
import '../myApp.dart';
|
||||
|
||||
void main() {
|
||||
runApp(MyApp());
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'pages/testUI.dart';
|
||||
import 'pages/TodayView.dart';
|
||||
import 'pages/InboxView.dart';
|
||||
import 'pages/NotesView.dart';
|
||||
|
||||
89
lib/pages/CreateNewNote.dart
Normal file
89
lib/pages/CreateNewNote.dart
Normal file
@@ -0,0 +1,89 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:progetto_m335_flutter/pages/NotesView.dart';
|
||||
|
||||
class CreateNewNote extends StatefulWidget {
|
||||
const CreateNewNote({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<CreateNewNote> createState() => _CreateNewNoteState();
|
||||
}
|
||||
|
||||
class _CreateNewNoteState extends State<CreateNewNote> {
|
||||
TextEditingController _titleController = TextEditingController();
|
||||
TextEditingController _textController = TextEditingController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_titleController.dispose();
|
||||
_textController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Create New 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"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
], //
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
], //
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../Components/Note.dart';
|
||||
import 'CreateNewNote.dart';
|
||||
import 'NoteDetailView.dart';
|
||||
|
||||
class NotesView extends StatefulWidget {
|
||||
const NotesView({super.key});
|
||||
const NotesView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<NotesView> createState() => _NotesViewState();
|
||||
}
|
||||
|
||||
|
||||
class _NotesViewState extends State<NotesView> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: Icon(Icons.note),
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Note'),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const CreateNewNote(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.add),
|
||||
),
|
||||
|
||||
|
||||
body:ListView(
|
||||
children: const <Widget>[
|
||||
Note(),
|
||||
Note(),
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
sqflite:
|
||||
path:
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
|
||||
@@ -13,7 +13,6 @@ import 'package:progetto_m335_flutter/myApp.dart';
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(const MyApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
|
||||
Reference in New Issue
Block a user