complete admin, mandor and user page

This commit is contained in:
kicap
2023-11-03 23:24:23 +08:00
parent 4cc9967ab8
commit 8eacfa6dee
41 changed files with 1335 additions and 492 deletions

View File

@ -36,6 +36,18 @@ class MandorTrackingIndexView extends StatelessWidget {
backgroundColor: mainColor,
elevation: 0,
automaticallyImplyLeading: false,
actions: [
// create logout button
IconButton(
onPressed: () {
model.logout();
},
icon: const Icon(
Icons.logout,
color: Colors.white,
),
),
],
),
body: ExtendedNavigator(
navigatorKey: StackedService.nestedNavigationKey(4),

View File

@ -5,10 +5,14 @@ import 'package:stacked_services/stacked_services.dart';
import '../../../app/app.locator.dart';
import '../../../app/app.logger.dart';
import '../../../app/app.router.dart';
import '../../../services/shared_prefs.dart';
class MandorTrackingIndexViewModel extends IndexTrackingViewModel {
final log = getLogger('MandorTrackingIndexViewModel');
final _navigationService = locator<NavigationService>();
final _mySharedPrefs = locator<MySharedPrefs>();
final _dialogService = locator<DialogService>();
final _snackbarService = locator<SnackbarService>();
final _bottomNavBarList = [
{'name': 'List', 'icon': Icons.list_alt_rounded, 'header': 'List Pemilik'},
@ -43,4 +47,26 @@ class MandorTrackingIndexViewModel extends IndexTrackingViewModel {
id: 4,
);
}
logout() {
_dialogService
.showConfirmationDialog(
title: 'Logout',
description: 'Apakah Anda yakin ingin logout?',
cancelTitle: 'Batal',
confirmationTitle: 'Logout',
)
.then((value) async {
if (value!.confirmed) {
await _mySharedPrefs.clear();
_navigationService.clearStackAndShow(Routes.loginScreenView);
_snackbarService.showSnackbar(
message: 'Logout berhasil',
duration: const Duration(seconds: 2),
);
}
});
// await _mySharedPrefs.clear();
// _navigationService.clearStackAndShow(Routes.loginScreenView);
}
}