37 lines
1013 B
Dart
37 lines
1013 B
Dart
import 'package:yimaru_app/app/app.bottomsheets.dart';
|
|
import 'package:yimaru_app/app/app.dialogs.dart';
|
|
import 'package:yimaru_app/app/app.locator.dart';
|
|
import 'package:yimaru_app/ui/common/app_strings.dart';
|
|
import 'package:stacked/stacked.dart';
|
|
import 'package:stacked_services/stacked_services.dart';
|
|
|
|
class HomeViewModel extends BaseViewModel {
|
|
final _dialogService = locator<DialogService>();
|
|
final _bottomSheetService = locator<BottomSheetService>();
|
|
|
|
String get counterLabel => 'Counter is: $_counter';
|
|
|
|
int _counter = 0;
|
|
|
|
void incrementCounter() {
|
|
_counter++;
|
|
rebuildUi();
|
|
}
|
|
|
|
void showDialog() {
|
|
_dialogService.showCustomDialog(
|
|
variant: DialogType.infoAlert,
|
|
title: 'Stacked Rocks!',
|
|
description: 'Give stacked $_counter stars on Github',
|
|
);
|
|
}
|
|
|
|
void showBottomSheet() {
|
|
_bottomSheetService.showCustomSheet(
|
|
variant: BottomSheetType.notice,
|
|
title: ksHomeBottomSheetTitle,
|
|
description: ksHomeBottomSheetDescription,
|
|
);
|
|
}
|
|
}
|