nickname changing

This commit is contained in:
55nknown
2022-11-15 09:00:38 +01:00
parent 82671f5ec9
commit f8cfa04d04
7 changed files with 14 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ class UserProvider with ChangeNotifier {
String? get password => user?.password;
Role? get role => user?.role;
Student? get student => user?.student;
String? get nickname => user?.nickname;
void setUser(String userId) {
_selectedUserId = userId;

View File

@@ -17,8 +17,10 @@ const settingsDB = DatabaseStruct("settings", {
"x_filc_id": String, "graph_class_avg": int, "presentation_mode": int, "bell_delay": int, "bell_delay_enabled": int,
"grade_opening_fun": int, "icon_pack": String,
});
const usersDB = DatabaseStruct(
"users", {"id": String, "name": String, "username": String, "password": String, "institute_code": String, "student": String, "role": int});
const usersDB = DatabaseStruct("users", {
"id": String, "name": String, "username": String, "password": String, "institute_code": String, "student": String, "role": int,
"nickname": String // premium only
});
const userDataDB = DatabaseStruct("user_data", {
"id": String, "grades": String, "timetable": String, "exams": String, "homework": String, "messages": String, "notes": String,
"events": String, "absences": String, "group_averages": String,

View File

@@ -13,6 +13,7 @@ class User {
String name;
Student student;
Role role;
String nickname;
User({
String? id,
@@ -22,6 +23,7 @@ class User {
required this.instituteCode,
required this.student,
required this.role,
this.nickname = "",
}) {
if (id != null) {
this.id = id;
@@ -39,6 +41,7 @@ class User {
name: map["name"].trim(),
student: Student.fromJson(jsonDecode(map["student"])),
role: Role.values[map["role"] ?? 0],
nickname: map["nickname"] ?? "",
);
}
@@ -51,6 +54,7 @@ class User {
"name": name,
"student": jsonEncode(student.json),
"role": role.index,
"nickname": nickname,
};
}

View File

@@ -20,6 +20,8 @@ dependencies:
path: "../filcnaplo_desktop_ui/"
filcnaplo_kreta_api:
path: "../filcnaplo_kreta_api/"
filcnaplo_premium:
path: "../filcnaplo_premium/"
flutter_localizations:
sdk: flutter