mirror of
https://github.com/hmalik144/easy_cc_flutter.git
synced 2026-03-18 15:45:56 +00:00
Layout created for single screen app
This commit is contained in:
24
lib/BaseViewModel.dart
Normal file
24
lib/BaseViewModel.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import 'Utils/ViewState.dart';
|
||||
|
||||
abstract class BaseViewmodel extends BaseViewModel{
|
||||
|
||||
ViewState _viewState = Idle();
|
||||
ViewState get viewState => _viewState;
|
||||
|
||||
void onStart() {
|
||||
_viewState = HasStarted();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void onSuccess(dynamic data) {
|
||||
_viewState = HasData(data);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void onError(String error) {
|
||||
_viewState = HasError(error);
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user