52 lines
1.2 KiB
Dart
52 lines
1.2 KiB
Dart
enum Page { lists, templates }
|
|
|
|
class List {
|
|
List(this.name, {this.id, this.description, this.isTemplate});
|
|
|
|
int? id;
|
|
String name;
|
|
String? description;
|
|
bool? isTemplate;
|
|
|
|
Map<String, dynamic> toMap() {
|
|
var map = <String, dynamic>{};
|
|
if (id != null) map["id"] = id;
|
|
map["list_name"] = name;
|
|
if (description != null) map["list_desc"] = description;
|
|
if (isTemplate != null) map["is_template"] = isTemplate! ? 1 : 0;
|
|
return map;
|
|
}
|
|
|
|
static List fromMap(Map<String, dynamic> map) {
|
|
return List(
|
|
map["list_name"],
|
|
id: map["id"],
|
|
description: map["list_desc"],
|
|
isTemplate: map["is_template"] == 1,
|
|
);
|
|
}
|
|
}
|
|
|
|
class Check {
|
|
Check(this.text, this.value, {this.id, this.listID});
|
|
|
|
int? id;
|
|
String text;
|
|
bool value;
|
|
int? listID;
|
|
|
|
Map<String, dynamic> toMap() {
|
|
var map = <String, dynamic>{};
|
|
if (id != null) map["id"] = id;
|
|
map["check_text"] = text;
|
|
map["status"] = value ? 1 : 0;
|
|
if (listID != null) map["list_id"] = listID!;
|
|
return map;
|
|
}
|
|
|
|
static Check fromMap(Map<String, dynamic> map) {
|
|
return Check(map["check_text"], map["status"] == 1,
|
|
id: map["id"], listID: map["list_id"]);
|
|
}
|
|
}
|