add account delection page
This commit is contained in:
@@ -24,6 +24,8 @@ import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
import '../../helpers/theme.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
import 'account_delection_page.dart';
|
||||
|
||||
typedef void ProfileCallback();
|
||||
|
||||
class Profile extends StatefulWidget {
|
||||
@@ -82,8 +84,8 @@ class _ProfileState extends State<Profile> {
|
||||
labelTextKey: "profile.currency",
|
||||
iconData: FontAwesome5Regular.money_bill_alt,
|
||||
);
|
||||
final deleteacbox = DisplayText(
|
||||
labelTextKey: "profile.delete",
|
||||
final deleteAccountBox = DisplayText(
|
||||
labelTextKey: "profile.delete.title",
|
||||
iconData: MaterialCommunityIcons.delete,
|
||||
);
|
||||
|
||||
@@ -128,8 +130,11 @@ class _ProfileState extends State<Profile> {
|
||||
);
|
||||
|
||||
final logoutbutton = fcsButton(
|
||||
context, getLocalString(context, "profile.logout"),
|
||||
callack: _logout, iconData: Icons.exit_to_app);
|
||||
context, getLocalString(context, "profile.logout"), callack: () {
|
||||
showConfirmDialog(context, "profile.logout.confirm", () async {
|
||||
await _logout();
|
||||
});
|
||||
}, iconData: Icons.exit_to_app);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
@@ -187,7 +192,9 @@ class _ProfileState extends State<Profile> {
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(child: deleteacbox,),
|
||||
Expanded(
|
||||
child: deleteAccountBox,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 0),
|
||||
child: IconButton(
|
||||
@@ -196,7 +203,6 @@ class _ProfileState extends State<Profile> {
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
getPrivilegeBox(context),
|
||||
SizedBox(height: 15),
|
||||
logoutbutton,
|
||||
@@ -359,10 +365,16 @@ class _ProfileState extends State<Profile> {
|
||||
),
|
||||
);
|
||||
}
|
||||
_editDelete() {
|
||||
Navigator.of(context)
|
||||
.push<void>(CupertinoPageRoute(builder: (context) => ProfileEdit()));
|
||||
|
||||
_editDelete() {
|
||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
builder: (context) => AccountDelectionPage(
|
||||
onlogout: () {
|
||||
_logout();
|
||||
},
|
||||
)));
|
||||
}
|
||||
|
||||
_editName() {
|
||||
Navigator.of(context)
|
||||
.push<void>(CupertinoPageRoute(builder: (context) => ProfileEdit()));
|
||||
@@ -373,25 +385,23 @@ _editDelete() {
|
||||
CupertinoPageRoute(builder: (context) => ProfileCurrencyEdit()));
|
||||
}
|
||||
|
||||
_logout() {
|
||||
showConfirmDialog(context, "profile.logout.confirm", () async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
await context.read<MainModel>().signout();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
Future.delayed(Duration(seconds: 1), () {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
Navigator.of(context).pushNamedAndRemoveUntil(
|
||||
"/welcome", ModalRoute.withName('/welcome'));
|
||||
}
|
||||
_logout() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
await context.read<MainModel>().signout();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
Future.delayed(Duration(seconds: 1), () {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
Navigator.of(context)
|
||||
.pushNamedAndRemoveUntil("/welcome", ModalRoute.withName('/welcome'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user