Init
This commit is contained in:
94
lib/Data.dart
Normal file
94
lib/Data.dart
Normal file
@@ -0,0 +1,94 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
class Category{
|
||||
|
||||
Category(this.category_id, this.name, this.color, this.productive);
|
||||
|
||||
String category_id;
|
||||
String name;
|
||||
String color;
|
||||
bool productive;
|
||||
|
||||
static String colCatId = "category_id";
|
||||
static String colName = "name";
|
||||
static String colColor = "color";
|
||||
static String colProductive = "productive";
|
||||
}
|
||||
|
||||
class TaskType{
|
||||
|
||||
TaskType(this.id, this.name, this.category, [this.cat = null]);
|
||||
|
||||
String id;
|
||||
String name;
|
||||
String category;
|
||||
Category? cat;
|
||||
|
||||
static String colId = "id";
|
||||
static String colName="name";
|
||||
static String colCategory = "category_id";
|
||||
}
|
||||
|
||||
class Activity{
|
||||
|
||||
Activity(this.taskType, this.startTime, this.endTime);
|
||||
|
||||
TaskType taskType;
|
||||
DateTime startTime;
|
||||
DateTime endTime;
|
||||
|
||||
static String colType = "type";
|
||||
static String colStartTime = "s_time";
|
||||
static String colEndTime = "e_time";
|
||||
}
|
||||
|
||||
class InitialData{
|
||||
static List<TaskType> getTaskTypes(String username){
|
||||
List<TaskType> tasks =[
|
||||
TaskType(username + 'Sleep','Sleep', 'Relax'),
|
||||
TaskType(username + 'Physics','Physics', 'Study'),
|
||||
TaskType(username + 'History','History','Study'),
|
||||
TaskType(username + 'Football','Football', 'Play'),
|
||||
TaskType(username + 'At work','At work', 'Work'),
|
||||
TaskType(username + 'Chores','Chores', 'Daily Activities'),
|
||||
TaskType(username + 'Eat','Eat','Daily Activities'),
|
||||
TaskType(username + 'Hang out','Hang out', 'Social')
|
||||
];
|
||||
return tasks;
|
||||
}
|
||||
|
||||
static List<Category> getCategories(String username){
|
||||
List<Category> cats = [
|
||||
Category(username+'Relax','Relax', '#555555', false),
|
||||
Category(username+'Daily Activities','Daily Activities', '#009955',false),
|
||||
Category(username+'Study','Study', '#00FF00', true),
|
||||
Category(username+'Play','Play', '#FF0000', false),
|
||||
Category(username+'Work','Work', '#00AAFF', true),
|
||||
Category(username+'Social','Social', '#00AAAA', false)
|
||||
];
|
||||
|
||||
return cats;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Queries{
|
||||
static String colLink= "file";
|
||||
static String colData = "data";
|
||||
}
|
||||
|
||||
|
||||
class Settings{
|
||||
|
||||
static Future<String> UUID() async{
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
if(prefs.containsKey('uuid')){
|
||||
return await Future.value(prefs.getString('uuid'));
|
||||
}else{
|
||||
var uuid = Uuid();
|
||||
String _uuid = uuid.v4();
|
||||
await prefs.setString('uuid',_uuid);
|
||||
return Future.value(_uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user