add structure

This commit is contained in:
2020-05-29 07:45:27 +06:30
parent 4c851d9971
commit bad27ba5c4
272 changed files with 36065 additions and 174 deletions

36
lib/model/base_model.dart Normal file
View File

@@ -0,0 +1,36 @@
import 'package:flutter/foundation.dart';
import 'package:fcs/model/api_helper.dart';
import 'package:fcs/model/main_model.dart';
import '../vo/setting.dart';
import '../vo/user.dart';
abstract class BaseModel extends ChangeNotifier {
User user;
Setting setting;
MainModel mainModel;
void initUser(User user) async {
this.user = user;
}
void initSetting(Setting setting) async {
this.setting = setting;
}
void logout();
// request makes http request
// if token is null
dynamic request(
String path,
method, {
dynamic payload,
String token,
String url,
}) async {
mainModel.resetPinTimer();
return await requestAPI(path, method,
payload: payload, token: token, url: url);
}
}