basic api access, state managment etc

This commit is contained in:
2024-02-11 01:08:51 +01:00
parent 306d9a006a
commit 46897cc51b
16 changed files with 431 additions and 50 deletions

View File

@@ -0,0 +1,16 @@
import 'package:flutter/foundation.dart';
class AppTheme extends ChangeNotifier {
bool _darkmode = false;
bool get darkMode => _darkmode;
void setDarkMode(bool v) {
_darkmode = v;
notifyListeners();
}
void switchDarkMode() {
_darkmode = !_darkmode;
notifyListeners();
}
}

View File

@@ -0,0 +1,28 @@
import 'package:flutter/foundation.dart';
import '../models/key_token_auth.dart';
import '../models/user.dart';
class UserAccount extends ChangeNotifier {
User? _user;
User? get user => _user;
KeyTokenAuth? _auth;
KeyTokenAuth? get auth => _auth;
void setToken(KeyTokenAuth auth) {
_auth = auth;
_user = user;
notifyListeners();
}
void setUser(User user) {
_user = user;
notifyListeners();
}
void clearUser() {
_user = null;
notifyListeners();
}
}