|
|
|
@ -9,9 +9,13 @@ import 'package:provider/provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/extensions/string_extensions.dart';
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/helper/utils.dart';
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/views/widgets/dialogs/dialog.dart';
|
|
|
|
import 'package:test_sa/views/widgets/item_views/info_header_widget.dart';
|
|
|
|
import 'package:test_sa/views/widgets/item_views/info_header_widget.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../common_widgets/default_app_bar.dart';
|
|
|
|
import '../common_widgets/default_app_bar.dart';
|
|
|
|
@ -100,6 +104,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
|
|
|
return Scaffold(
|
|
|
|
return Scaffold(
|
|
|
|
appBar: DefaultAppBar(title: context.translation.settings),
|
|
|
|
appBar: DefaultAppBar(title: context.translation.settings),
|
|
|
|
body: Column(
|
|
|
|
body: Column(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
spacing: 12,
|
|
|
|
spacing: 12,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
@ -170,6 +176,38 @@ class _SettingsPageState extends State<SettingsPage> {
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).toShadowContainer(context, borderRadius: 16, padding: 16).paddingAll(16),
|
|
|
|
).toShadowContainer(context, borderRadius: 16, padding: 16).paddingAll(16),
|
|
|
|
|
|
|
|
// 12.height,
|
|
|
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
|
|
|
label: "Delete Account",
|
|
|
|
|
|
|
|
buttonColor: AppColor.red30,
|
|
|
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
|
|
|
bool result = await showDialog(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
builder: (_) => AAlertDialog(
|
|
|
|
|
|
|
|
title: "Confirm".addTranslation,
|
|
|
|
|
|
|
|
content: "By deleting your account, all your data will be permanently removed. Are you sure you want to proceed?".addTranslation,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
|
|
|
await Future.delayed(const Duration(seconds: 2));
|
|
|
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
|
|
|
|
// bool isSuccess = await userProvider.logout(context);
|
|
|
|
|
|
|
|
// if (isSuccess) {
|
|
|
|
|
|
|
|
// Provider.of<SettingProvider>(context, listen: false).resetSettings();
|
|
|
|
|
|
|
|
// userProvider.reset();
|
|
|
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
|
|
|
// Navigator.of(context).pushNamedAndRemoveUntil(LoginPage.routeName, (routes) => true);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
).paddingAll(16),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|