Skip to content

Commit

Permalink
issue #61, #62
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonavichus committed Apr 21, 2024
1 parent 52e26f0 commit daed67c
Show file tree
Hide file tree
Showing 24 changed files with 331 additions and 135 deletions.
5 changes: 4 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,7 @@ flutter {
source '../..'
}

dependencies {}
dependencies {
implementation("androidx.core:core-remoteviews:1.0.0")
implementation("androidx.work:work-runtime-ktx:2.9.0")
}
12 changes: 12 additions & 0 deletions lib/app/controller/todo_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,18 @@ class TodoController extends GetxController {
todos.refresh();
}

Future<void> updateTodoFix(Todos todo) async {
isar.writeTxnSync(() {
todo.fix = todo.fix == true ? false : true;
isar.todos.putSync(todo);
});

var newTodo = todo;
int oldIdx = todos.indexOf(todo);
todos[oldIdx] = newTodo;
todos.refresh();
}

Future<void> updateTodo(
Todos todo, Tasks task, String title, String desc, String time) async {
DateTime? date;
Expand Down
35 changes: 3 additions & 32 deletions lib/app/data/schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Settings {
String timeformat = '24';
bool materialColor = true;
bool amoledTheme = false;
bool? isImage = true;
String? language;
}

Expand All @@ -33,21 +34,6 @@ class Tasks {
required this.taskColor,
this.index,
});

Tasks.fromJson(Map<String, dynamic> json)
: id = json['id'],
title = json['title'],
description = json['description'] ?? '',
taskColor = json['taskColor'],
archive = json['archive'] ?? false;

Map<String, dynamic> toJson() => {
'id': id,
'name': title,
'description': description,
'todoCompletedTime': taskColor,
'done': archive,
};
}

@collection
Expand All @@ -57,6 +43,7 @@ class Todos {
String description;
DateTime? todoCompletedTime;
bool done;
bool fix;

final task = IsarLink<Tasks>();

Expand All @@ -66,22 +53,6 @@ class Todos {
this.description = '',
this.todoCompletedTime,
this.done = false,
this.fix = false,
});

Todos.fromJson(Map<String, dynamic> json)
: id = json['id'],
name = json['name'],
description = json['description'] ?? '',
todoCompletedTime = json['todoCompletedTime'] != null
? DateTime.fromMicrosecondsSinceEpoch(json['todoCompletedTime'])
: json['todoCompletedTime'],
done = json['done'] ?? false;

Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'description': description,
'todoCompletedTime': todoCompletedTime,
'done': done,
};
}
Loading

0 comments on commit daed67c

Please sign in to comment.