add homepage

This commit is contained in:
jyuesong
2022-01-12 15:00:55 +08:00
parent 7bfae045fb
commit 9f7164db48
15 changed files with 786 additions and 135 deletions

View File

@@ -0,0 +1,41 @@
import 'package:flutter/cupertino.dart';
class BaseViewModel extends ChangeNotifier {
PageState currentState = PageState.START;
void loading({bool notify = false}) {
currentState = PageState.LOADING;
if (notify) {
notifyListeners();
}
}
void success({bool notify = true}) {
currentState = PageState.CONTENT;
if (notify) {
notifyListeners();
}
}
void failed({bool notify = false}) {
currentState = PageState.FAILED;
if (notify) {
notifyListeners();
}
}
void empty({bool notify = false}) {
currentState = PageState.EMPTY;
if (notify) {
notifyListeners();
}
}
}
enum PageState {
START,
LOADING,
EMPTY,
CONTENT,
FAILED,
}