task removeable, added header, more todos 🤷♀️ ..
This commit is contained in:
parent
33ff8b1f7d
commit
9f8e0c875c
@ -8,12 +8,18 @@ A Reminder based on todo.txt synced via nextcloud
|
|||||||
- [ ] define isomorphism for 'repeat:'-meta-tag
|
- [ ] define isomorphism for 'repeat:'-meta-tag
|
||||||
- [ ] add interface for repeat-datatype in addReminder.dart
|
- [ ] add interface for repeat-datatype in addReminder.dart
|
||||||
- [x] save/load data to/from disk
|
- [x] save/load data to/from disk
|
||||||
|
- [x] adding/removing tasks
|
||||||
- [ ] respect ordering that was used when starting the app when saving.
|
- [ ] respect ordering that was used when starting the app when saving.
|
||||||
- [ ] add Nextcloud-login for getting a Token
|
- [ ] add Nextcloud-login for getting a Token
|
||||||
- [ ] use webdav for synchronizing with Nextcloud using that token
|
- [ ] use webdav for synchronizing with Nextcloud using that token
|
||||||
- [ ] sorting by "next up", "priority"
|
- [ ] sorting by "next up", "priority"
|
||||||
- [ ] respect 'color:'-meta-tag (usual formats like "#aabbcc", html-colors like "red")
|
- [ ] respect 'color:'-meta-tag (usual formats like "#aabbcc", html-colors like "red")
|
||||||
- [ ] use color in rendering todos
|
- [ ] use color in rendering todos
|
||||||
|
- [ ] make application-settings
|
||||||
|
- [ ] store/load settings
|
||||||
|
- [ ] setting for number of days into the future
|
||||||
|
- [ ] theme (light/dark mode, system theme)
|
||||||
|
- [ ] fancy pop-animation & sound for the checkbox
|
||||||
|
|
||||||
## Current looks:
|
## Current looks:
|
||||||
|
|
||||||
@ -22,3 +28,6 @@ A Reminder based on todo.txt synced via nextcloud
|
|||||||
|
|
||||||
### Adding Tasks
|
### Adding Tasks
|
||||||
![](img/2023-01-08_addTask.png)
|
![](img/2023-01-08_addTask.png)
|
||||||
|
|
||||||
|
### Details/Removing tasks
|
||||||
|
![](img/2023-01-10_Task_details.png)
|
BIN
img/2023-01-10_Task_details.png
Normal file
BIN
img/2023-01-10_Task_details.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
@ -103,7 +103,7 @@ class _AddTaskWidgetState extends State<AddTaskWidget> with RestorationMixin {
|
|||||||
children: [
|
children: [
|
||||||
Text("Begin: ", style: Theme.of(context).textTheme.labelLarge),
|
Text("Begin: ", style: Theme.of(context).textTheme.labelLarge),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text("${_beginDate.value.year}-${_beginDate.value.month.toString().padLeft(2,'0')}-${_beginDate.value.day.toString().padLeft(2,'0')}")
|
child: Text(Task.formatDate(_beginDate.value))
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => _restorableDatePickerRouteFuture.present(),
|
onPressed: () => _restorableDatePickerRouteFuture.present(),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_window_close/flutter_window_close.dart';
|
||||||
import 'package:nextcloud_reminder/addReminder.dart';
|
import 'package:nextcloud_reminder/addReminder.dart';
|
||||||
import 'package:nextcloud_reminder/parser/todotxt.dart';
|
import 'package:nextcloud_reminder/parser/todotxt.dart';
|
||||||
import 'package:nextcloud_reminder/repeating_task.dart';
|
import 'package:nextcloud_reminder/repeating_task.dart';
|
||||||
@ -28,7 +29,7 @@ class HomeWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _HomeWidgetState extends State<HomeWidget> with WidgetsBindingObserver {
|
class _HomeWidgetState extends State<HomeWidget> with WidgetsBindingObserver {
|
||||||
|
|
||||||
final ScrollTable _checkboxes = ScrollTable(title: "TODOs");
|
late final ScrollTable _checkboxes;
|
||||||
int _counter = 1;
|
int _counter = 1;
|
||||||
late final Directory appDocDirectory;
|
late final Directory appDocDirectory;
|
||||||
late final File todotxt = File('${appDocDirectory.path}/todo.txt');
|
late final File todotxt = File('${appDocDirectory.path}/todo.txt');
|
||||||
@ -45,7 +46,6 @@ class _HomeWidgetState extends State<HomeWidget> with WidgetsBindingObserver {
|
|||||||
appDocDirectory = (await getApplicationDocumentsDirectory());
|
appDocDirectory = (await getApplicationDocumentsDirectory());
|
||||||
if (await todotxt.exists()) {
|
if (await todotxt.exists()) {
|
||||||
var data = await todotxt.readAsLines();
|
var data = await todotxt.readAsLines();
|
||||||
debugPrint(data.toString());
|
|
||||||
tasks.addAll(TodoParser.parse(data));
|
tasks.addAll(TodoParser.parse(data));
|
||||||
_loadTodos();
|
_loadTodos();
|
||||||
} else {
|
} else {
|
||||||
@ -57,7 +57,12 @@ class _HomeWidgetState extends State<HomeWidget> with WidgetsBindingObserver {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
_checkboxes = ScrollTable(title: "TODOs", deleteCallback: _removeTask);
|
||||||
initLazy();
|
initLazy();
|
||||||
|
FlutterWindowClose.setWindowShouldCloseHandler(() async {
|
||||||
|
saveData();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -81,16 +86,6 @@ class _HomeWidgetState extends State<HomeWidget> with WidgetsBindingObserver {
|
|||||||
await todotxt.writeAsString(data);
|
await todotxt.writeAsString(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _addDummyTask() {
|
|
||||||
setState(() {
|
|
||||||
// This call to setState tells the Flutter framework that something has
|
|
||||||
// changed in this State, which causes it to rerun the build method below
|
|
||||||
// so that the display can reflect the updated values. If we changed
|
|
||||||
// stuff without calling setState(), then the build method would not be
|
|
||||||
// called again, and so nothing would appear to happen.
|
|
||||||
_checkboxes.addTask(RepeatingTask(task: Task(title: "Dummy Task #$_counter", begin: DateTime.now()), repeat: _counter++));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
void _addTask(RepeatingTask? t) {
|
void _addTask(RepeatingTask? t) {
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -99,6 +94,11 @@ class _HomeWidgetState extends State<HomeWidget> with WidgetsBindingObserver {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void _removeTask(RepeatingTask t) {
|
||||||
|
setState(() {
|
||||||
|
tasks.remove(t.task);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -23,9 +23,13 @@ class _RepeatingTaskState extends State<RepeatingTask> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
return Container(
|
||||||
|
decoration: const BoxDecoration(border: Border(bottom: BorderSide(),)),
|
||||||
|
margin: const EdgeInsets.all(0.0),
|
||||||
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: _occurrences,
|
children: _occurrences,
|
||||||
);
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,8 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:nextcloud_reminder/repeating_task.dart';
|
import 'package:nextcloud_reminder/repeating_task.dart';
|
||||||
|
import 'package:nextcloud_reminder/types/tasks.dart';
|
||||||
|
|
||||||
class ScrollTable extends StatefulWidget {
|
class ScrollTable extends StatefulWidget {
|
||||||
ScrollTable({super.key, required this.title});
|
ScrollTable({super.key, required this.title, required this.deleteCallback});
|
||||||
|
|
||||||
// This class is the configuration for the state. It holds the values (in this
|
// This class is the configuration for the state. It holds the values (in this
|
||||||
// case the title) provided by the parent (in this case the App widget) and
|
// case the title) provided by the parent (in this case the App widget) and
|
||||||
@ -11,6 +12,7 @@ class ScrollTable extends StatefulWidget {
|
|||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
final _ScrollTableState _internalState = _ScrollTableState();
|
final _ScrollTableState _internalState = _ScrollTableState();
|
||||||
|
final ValueChanged<RepeatingTask> deleteCallback;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ScrollTable> createState() => _internalState;
|
State<ScrollTable> createState() => _internalState;
|
||||||
@ -31,19 +33,64 @@ class _ScrollTableState extends State<ScrollTable> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> _buildTitles() {
|
removeTask(RepeatingTask task) {
|
||||||
|
setState(() {
|
||||||
|
_content.remove(task);
|
||||||
|
});
|
||||||
|
widget.deleteCallback(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _showDetailsAndRemoveTask(BuildContext context, RepeatingTask t) {
|
||||||
|
return showDialog(context: context,
|
||||||
|
barrierDismissible: true,
|
||||||
|
builder: (BuildContext context)
|
||||||
|
{
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text("Task details"),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: [ Text(t.task.title),
|
||||||
|
Text("Projects: ${t.task.projects.isEmpty ? "none" : t.task.projects.join(", ")}"),
|
||||||
|
Text("Contexts: ${t.task.contexts.isEmpty ? "none" : t.task.contexts.join(", ")}"),
|
||||||
|
Padding(padding: EdgeInsets.only(top: 16),
|
||||||
|
child: Text(t.task.meta.isEmpty ? "" : "Meta:", style: Theme.of(context).textTheme.bodyLarge,)
|
||||||
|
),
|
||||||
|
] + List.of(t.task.meta.entries.map((e) => Text("${e.key}: ${e.value}"))),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(onPressed: () {
|
||||||
|
removeTask(t);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
style: TextButton.styleFrom(foregroundColor: Theme
|
||||||
|
.of(context)
|
||||||
|
.errorColor),
|
||||||
|
child: const Text("remove"),),
|
||||||
|
TextButton(onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: const Text("close")),
|
||||||
|
]
|
||||||
|
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> _buildTitles(BuildContext context) {
|
||||||
return List<Widget>.from(_content.map((RepeatingTask t) =>
|
return List<Widget>.from(_content.map((RepeatingTask t) =>
|
||||||
Container(
|
Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.centerLeft,
|
||||||
width: 120.0,
|
width: 150.0,
|
||||||
height: 60.0,
|
height: 60.0,
|
||||||
color: Colors.white,
|
margin: const EdgeInsets.only(left: 4, top: 1),
|
||||||
margin: const EdgeInsets.all(4.0),
|
decoration: const BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(),)),
|
||||||
child: Text(t.task.title, style: Theme
|
child: TextButton(
|
||||||
.of(context)
|
onPressed: () => _showDetailsAndRemoveTask(context,t),
|
||||||
.textTheme
|
child: Text(t.task.title,
|
||||||
.labelMedium),
|
style: Theme.of(context).textTheme.labelMedium),
|
||||||
)));
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -54,14 +101,15 @@ class _ScrollTableState extends State<ScrollTable> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: _buildTitles(),
|
//TODO: Text in container wie bei _buildTitles oben und width/height/margin/etc. festnageln.
|
||||||
|
children: List<Widget>.from([Text("Todo", style: Theme.of(context).dataTableTheme.headingTextStyle,)]) + _buildTitles(context),
|
||||||
),
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: _content,
|
children: List<Widget>.from([Text("header ... date, date, date .. fancy turned 60 degrees", style: Theme.of(context).dataTableTheme.headingTextStyle)]) + List<Widget>.from(_content),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -27,7 +27,7 @@ class _TaskItemState extends State<TaskItem>{
|
|||||||
width: 60.0,
|
width: 60.0,
|
||||||
height: 60.0,
|
height: 60.0,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
margin: const EdgeInsets.all(4.0),
|
margin: const EdgeInsets.all(0.0),
|
||||||
child: _done == null ? null : Checkbox(value: _done, onChanged: (newState) => setState(() {
|
child: _done == null ? null : Checkbox(value: _done, onChanged: (newState) => setState(() {
|
||||||
_done = newState!;
|
_done = newState!;
|
||||||
})),
|
})),
|
||||||
|
@ -19,12 +19,16 @@ class Task {
|
|||||||
this.end,
|
this.end,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
static String formatDate(DateTime dt) {
|
||||||
|
return "${dt!.year}-${dt!.month.toString().padLeft(2,'0')}-${dt!.day.toString().padLeft(2,'0')}";
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return (done ? "x " : "")
|
return (done ? "x " : "")
|
||||||
+ (priority == null ? "" : "(${priority!}) ")
|
+ (priority == null ? "" : "(${priority!}) ")
|
||||||
+ (begin == null ? "" : "${begin!.year}-${begin!.month}-${begin!.day} ")
|
+ (begin == null ? "" : "${Task.formatDate(begin!)} ")
|
||||||
+ (end == null ? "" : "${end!.year}-${end!.month}-${end!.day} ")
|
+ (end == null ? "" : "${Task.formatDate(end!)} ")
|
||||||
+ ("$title ")
|
+ ("$title ")
|
||||||
+ meta.entries.map((entry) => "${entry.key}:${entry.value}").join(" ")
|
+ meta.entries.map((entry) => "${entry.key}:${entry.value}").join(" ")
|
||||||
;
|
;
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
#include <flutter_window_close/flutter_window_close_plugin.h>
|
||||||
|
|
||||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||||
|
g_autoptr(FlPluginRegistrar) flutter_window_close_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterWindowClosePlugin");
|
||||||
|
flutter_window_close_plugin_register_with_registrar(flutter_window_close_registrar);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
|
flutter_window_close
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
import flutter_window_close
|
||||||
import path_provider_macos
|
import path_provider_macos
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
FlutterWindowClosePlugin.register(with: registry.registrar(forPlugin: "FlutterWindowClosePlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
}
|
}
|
||||||
|
19
pubspec.lock
19
pubspec.lock
@ -81,6 +81,25 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_web_plugins:
|
||||||
|
dependency: transitive
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
|
flutter_window_close:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_window_close
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.2"
|
||||||
|
js:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: js
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.4"
|
||||||
lints:
|
lints:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -39,6 +39,7 @@ dependencies:
|
|||||||
path_provider: ^2.0.11
|
path_provider: ^2.0.11
|
||||||
petitparser: ^5.1.0
|
petitparser: ^5.1.0
|
||||||
tuple: ^2.0.1
|
tuple: ^2.0.1
|
||||||
|
flutter_window_close: ^0.2.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
#include <flutter_window_close/flutter_window_close_plugin.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
|
FlutterWindowClosePluginRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("FlutterWindowClosePlugin"));
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
|
flutter_window_close
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
|
Loading…
Reference in New Issue
Block a user