This commit is contained in:
jyuesong
2022-01-13 10:17:22 +08:00
parent 5d7fc83f91
commit 6acf427fb6
15 changed files with 258 additions and 95 deletions

View File

@@ -1,11 +1,10 @@
import 'package:flutter/cupertino.dart';
class ViewModel extends ChangeNotifier{}
class ViewModel extends ChangeNotifier {}
class BaseViewModel extends ViewModel {
PageState currentState = PageState.START;
String? failReason;
void loading({bool notify = false}) {
currentState = PageState.LOADING;
@@ -21,8 +20,9 @@ class BaseViewModel extends ViewModel {
}
}
void failed({bool notify = false}) {
void failed(String? reason, {bool notify = false}) {
currentState = PageState.FAILED;
failReason = reason;
if (notify) {
notifyListeners();
}