Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51f964833e | ||
|
|
5c68d85b98 |
@@ -1,17 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../pages/EditReminder.dart';
|
||||
|
||||
class EditReminderButton extends StatelessWidget{
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => EditReminder()),
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.list),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
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,10 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../Components/EditReminderButton.dart';
|
||||
import '../model/promemoria.dart';
|
||||
import '../pages/EditReminder.dart';
|
||||
|
||||
class Reminder extends StatefulWidget {
|
||||
const Reminder({super.key});
|
||||
final Promemoria? promemoria;
|
||||
const Reminder(this.promemoria, {super.key});
|
||||
|
||||
@override
|
||||
State<Reminder> createState() => _ReminderState();
|
||||
@@ -26,12 +27,12 @@ class _ReminderState extends State<Reminder> {
|
||||
value: _value,
|
||||
onChanged: _onChanged,
|
||||
),
|
||||
title: Text("Reminder"),
|
||||
title: Text(widget.promemoria?.description ?? 'Nessun titolo'),
|
||||
subtitle: Text(DateTime.now().toString()),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => EditReminder()),
|
||||
MaterialPageRoute(builder: (context) => EditReminder(widget.promemoria)),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../myApp.dart';
|
||||
import 'myApp.dart';
|
||||
|
||||
void main() {
|
||||
runApp(MyApp());
|
||||
|
||||
@@ -1,19 +1,8 @@
|
||||
abstract class BaseEntity{
|
||||
static String id = 'id';
|
||||
static String title = 'Title';
|
||||
static String creationDate = 'CreationDate';
|
||||
static String lastEditDate = 'LastEditDate';
|
||||
String id = 'id';
|
||||
String title = 'Title';
|
||||
String creationDate = 'CreationDate';
|
||||
String lastEditDate = 'LastEditDate';
|
||||
|
||||
static String get getId{
|
||||
return id;
|
||||
}
|
||||
static String get getTitle{
|
||||
return title;
|
||||
}
|
||||
static String get getCreationDate{
|
||||
return creationDate;
|
||||
}
|
||||
static String get getLastEditDate{
|
||||
return lastEditDate;
|
||||
}
|
||||
BaseEntity();
|
||||
}
|
||||
@@ -7,10 +7,13 @@ const String promemoriaTable = 'promemoria';
|
||||
class Promemoria extends BaseEntity {
|
||||
static String expirationDate = '';
|
||||
static String arrayPromemoria = '';
|
||||
static String description = '';
|
||||
String description = '';
|
||||
static Priority priority = Priority.none;
|
||||
|
||||
static Color color = Color.none;
|
||||
|
||||
Promemoria(String description) : super(){
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'pages/testUI.dart';
|
||||
import 'pages/TodayView.dart';
|
||||
import 'pages/InboxView.dart';
|
||||
import 'pages/NotesView.dart';
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
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,7 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../model/promemoria.dart';
|
||||
|
||||
class EditReminder extends StatefulWidget {
|
||||
const EditReminder({super.key});
|
||||
final Promemoria? promemoria;
|
||||
const EditReminder(this.promemoria, {super.key});
|
||||
|
||||
@override
|
||||
State<EditReminder> createState() => _EditReminderState();
|
||||
@@ -28,7 +30,7 @@ class _EditReminderState extends State<EditReminder> {
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
TextField(
|
||||
controller: TextEditingController(text: _title),
|
||||
controller: TextEditingController(text: widget.promemoria?.description ?? ""),
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Title',
|
||||
|
||||
@@ -19,8 +19,8 @@ class _InboxViewState extends State<InboxView> {
|
||||
),
|
||||
body: ListView(
|
||||
children: const <Widget>[
|
||||
Reminder(),
|
||||
Reminder(),
|
||||
/* Reminder(),
|
||||
Reminder(),*/
|
||||
],
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1,89 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:progetto_m335_flutter/pages/NotesView.dart';
|
||||
|
||||
class NoteDetailView extends StatefulWidget {
|
||||
const NoteDetailView({Key? key}) : super(key: key);
|
||||
const NoteDetailView({super.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 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"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
], //
|
||||
),
|
||||
),
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: Text('NoteDetailView'),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../Components/Note.dart';
|
||||
import 'CreateNewNote.dart';
|
||||
import 'NoteDetailView.dart';
|
||||
|
||||
class NotesView extends StatefulWidget {
|
||||
const NotesView({Key? key}) : super(key: key);
|
||||
const NotesView({super.key});
|
||||
|
||||
@override
|
||||
State<NotesView> createState() => _NotesViewState();
|
||||
}
|
||||
|
||||
|
||||
class _NotesViewState extends State<NotesView> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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(),
|
||||
],
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: Icon(Icons.note),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,15 @@ class _TodayViewState extends State<TodayView> {
|
||||
|
||||
var _selectedDate = DateTime.now();
|
||||
|
||||
List<Promemoria> listaPromemoria = [
|
||||
new Promemoria("Primo promemoria"),
|
||||
new Promemoria("Secondo promemoria"),
|
||||
new Promemoria("Terzo promemoria"),
|
||||
new Promemoria("Quarto promemoria"),
|
||||
new Promemoria("Quinto promemoria"),
|
||||
new Promemoria("Sesto promemoria"),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -33,10 +42,18 @@ class _TodayViewState extends State<TodayView> {
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
children: const <Widget>[
|
||||
Reminder(),
|
||||
Reminder(),
|
||||
QuickReminder()
|
||||
children: [
|
||||
ListView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
itemCount: listaPromemoria.length,
|
||||
itemBuilder: (BuildContext context, int index){
|
||||
return Reminder(
|
||||
listaPromemoria[index]
|
||||
);
|
||||
},
|
||||
),
|
||||
QuickReminder(),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -30,8 +30,7 @@ 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,6 +13,7 @@ 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