backup. before shop update
This commit is contained in:
52
lib/dialog/logout_dialog.dart
Normal file
52
lib/dialog/logout_dialog.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
import '../events/eventbus.dart';
|
||||
import '../events/events.dart';
|
||||
import '../generated/l10n.dart';
|
||||
import '../routes.dart';
|
||||
import '../store/actions.dart';
|
||||
import '../store/store.dart';
|
||||
import '../utils/utils.dart';
|
||||
|
||||
AlertDialog logoutDialog(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(S
|
||||
.of(context)
|
||||
.warning),
|
||||
content: Text(S
|
||||
.of(context)
|
||||
.are_you_sure_to_logout),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text(S
|
||||
.of(context)
|
||||
.cancel),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(S
|
||||
.of(context)
|
||||
.yes_i_am_sure),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
Utils.getBox().then((box) {
|
||||
box.delete(Constants.KEY_USER_ID);
|
||||
box.delete(
|
||||
Constants.KEY_ACCESS_TOKEN);
|
||||
store.dispatch(
|
||||
new UpdateCurrentUser(null));
|
||||
eventBus.fire(
|
||||
new OnCurrentUserUpdated());
|
||||
Routes.router.navigateTo(
|
||||
context, '/', replace: true,
|
||||
clearStack: true);
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user