tangheem detail improvements
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M3 12C3 4.5885 4.5885 3 12 3C19.4115 3 21 4.5885 21 12C21 19.4115 19.4115 21 12 21C4.5885 21 3 19.4115 3 12Z" stroke="#323232" stroke-width="2"/>
|
||||
<path d="M12 8L12 16" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M15 11L12.087 8.08704V8.08704C12.039 8.03897 11.961 8.03897 11.913 8.08704V8.08704L9 11" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 673 B |
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M17.75 20.75C17.5974 20.747 17.4487 20.702 17.32 20.62L12 16.91L6.68 20.62C6.56249 20.6915 6.42757 20.7294 6.29 20.7294C6.15243 20.7294 6.01751 20.6915 5.9 20.62C5.78491 20.5607 5.68741 20.4722 5.61722 20.3634C5.54703 20.2546 5.50661 20.1293 5.5 20V6C5.5 5.27065 5.78973 4.57118 6.30546 4.05546C6.82118 3.53973 7.52065 3.25 8.25 3.25H15.75C16.4793 3.25 17.1788 3.53973 17.6945 4.05546C18.2103 4.57118 18.5 5.27065 18.5 6V20C18.5005 20.1362 18.4634 20.2698 18.3929 20.3863C18.3223 20.5027 18.2209 20.5974 18.1 20.66C17.9927 20.7189 17.8724 20.7498 17.75 20.75ZM12 15.25C12.1532 15.2484 12.3033 15.2938 12.43 15.38L17 18.56V6C17 5.66848 16.8683 5.35054 16.6339 5.11612C16.3995 4.8817 16.0815 4.75 15.75 4.75H8.25C7.91848 4.75 7.60054 4.8817 7.36612 5.11612C7.1317 5.35054 7 5.66848 7 6V18.56L11.57 15.38C11.6967 15.2938 11.8468 15.2484 12 15.25Z" fill="#000000"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 76 76" xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full"
|
||||
enable-background="new 0 0 76.00 76.00" xml:space="preserve">
|
||||
<path fill="#000000" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round"
|
||||
d="M 57,45L 57,39.1667L 51,45L 51,40L 25,40L 25,45L 19,39.1666L 19,44.9999L 16,44.9999L 16,30.9999L 19,30.9999L 19,36.8333L 25,31L 25,36L 51,36L 51,31L 57,36.8334L 57,31L 60,31L 60,45L 57,45 Z " />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 750 B |
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 27.3.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 32 32"
|
||||
style="enable-background:new 0 0 32 32;" xml:space="preserve">
|
||||
<g id="Protection">
|
||||
<g>
|
||||
<path style="fill:#40696C" class="st0" d="M15.6,31.9C7.4,28.7,2,20.9,2,12.1V11c0-0.6,0.4-1,1-1s1,0.4,1,1v1.1c0,7.8,4.8,14.9,12,17.9
|
||||
c7.2-3,12-10,12-17.9V7.6L16,2.1L3.4,7.9c-0.5,0.2-1.1,0-1.3-0.5s0-1.1,0.5-1.3l13-6c0.3-0.1,0.6-0.1,0.8,0l13,6
|
||||
C29.8,6.3,30,6.6,30,7v5.1c0,8.8-5.4,16.7-13.6,19.9C16.1,32,15.9,32,15.6,31.9z" />
|
||||
<path style="fill:#40696C" class="st0" d="M15.6,27.6C9.8,25.2,6,19.6,6,13.3V10c0-0.4,0.2-0.7,0.6-0.9l9-4.6c0.3-0.1,0.6-0.1,0.9,0l9,4.6
|
||||
C25.8,9.3,26,9.6,26,10v3.3c0,6.3-3.8,12-9.6,14.4C16.1,27.7,15.9,27.7,15.6,27.6z M8,10.6v2.7c0,5.3,3.1,10.2,8,12.4
|
||||
c4.9-2.2,8-7,8-12.4v-2.6l-8-4.1L8,10.6z" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="9" y="2" width="6" height="12" rx="3" stroke="#000000" stroke-width="1.5"/>
|
||||
<path d="M5 3V5M1 2V6M19 3V5M23 2V6" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M5 10V11C5 14.866 8.13401 18 12 18V18V18C15.866 18 19 14.866 19 11V10" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M12 18V22M12 22H9M12 22H15" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 721 B |
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M20 5.75a3.25 3.25 0 0 1-5.532 2.314L9.31 10.906a3.245 3.245 0 0 1-.001 2.192l5.156 2.84a3.25 3.25 0 1 1-.922 1.775l-5.478-3.017a3.25 3.25 0 1 1 .004-5.389l5.474-3.018A3.25 3.25 0 1 1 20 5.75z" fill="#000000"/></svg>
|
||||
|
After Width: | Height: | Size: 486 B |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM7.07 18.28C7.5 17.38 10.12 16.5 12 16.5C13.88 16.5 16.51 17.38 16.93 18.28C15.57 19.36 13.86 20 12 20C10.14 20 8.43 19.36 7.07 18.28ZM12 14.5C13.46 14.5 16.93 15.09 18.36 16.83C19.38 15.49 20 13.82 20 12C20 7.59 16.41 4 12 4C7.59 4 4 7.59 4 12C4 13.82 4.62 15.49 5.64 16.83C7.07 15.09 10.54 14.5 12 14.5ZM12 6C10.06 6 8.5 7.56 8.5 9.5C8.5 11.44 10.06 13 12 13C13.94 13 15.5 11.44 15.5 9.5C15.5 7.56 13.94 6 12 6ZM10.5 9.5C10.5 10.33 11.17 11 12 11C12.83 11 13.5 10.33 13.5 9.5C13.5 8.67 12.83 8 12 8C11.17 8 10.5 8.67 10.5 9.5Z" fill="#000000"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 917 B |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 11C4 7.13401 7.13401 4 11 4C14.866 4 18 7.13401 18 11C18 14.866 14.866 18 11 18C7.13401 18 4 14.866 4 11ZM11 2C6.02944 2 2 6.02944 2 11C2 15.9706 6.02944 20 11 20C13.125 20 15.078 19.2635 16.6177 18.0319L20.2929 21.7071C20.6834 22.0976 21.3166 22.0976 21.7071 21.7071C22.0976 21.3166 22.0976 20.6834 21.7071 20.2929L18.0319 16.6177C19.2635 15.078 20 13.125 20 11C20 6.02944 15.9706 2 11 2Z" fill="#000000"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 14C10 14.5523 10.4477 15 11 15C11.5523 15 12 14.5523 12 14V12H14C14.5523 12 15 11.5523 15 11C15 10.4477 14.5523 10 14 10H12V8C12 7.44772 11.5523 7 11 7C10.4477 7 10 7.44772 10 8V10H8C7.44772 10 7 10.4477 7 11C7 11.5523 7.44772 12 8 12H10V14Z" fill="#000000"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1004 B |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 11C4 7.13401 7.13401 4 11 4C14.866 4 18 7.13401 18 11C18 14.866 14.866 18 11 18C7.13401 18 4 14.866 4 11ZM11 2C6.02944 2 2 6.02944 2 11C2 15.9706 6.02944 20 11 20C13.125 20 15.078 19.2635 16.6177 18.0319L20.2929 21.7071C20.6834 22.0976 21.3166 22.0976 21.7071 21.7071C22.0976 21.3166 22.0976 20.6834 21.7071 20.2929L18.0319 16.6177C19.2635 15.078 20 13.125 20 11C20 6.02944 15.9706 2 11 2Z" fill="#000000"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 11C7 10.4477 7.44772 10 8 10H14C14.5523 10 15 10.4477 15 11C15 11.5523 14.5523 12 14 12H8C7.44772 12 7 11.5523 7 11Z" fill="#000000"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 878 B |
@ -0,0 +1,119 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:tangheem/app_state/app_state.dart';
|
||||
import 'package:tangheem/classes/colors.dart';
|
||||
import 'package:tangheem/extensions/int_extensions.dart';
|
||||
import 'package:tangheem/extensions/string_extensions.dart';
|
||||
import 'package:tangheem/extensions/widget_extensions.dart';
|
||||
import 'package:tangheem/ui/screens/bookmark_screen.dart';
|
||||
import 'package:tangheem/ui/screens/login_screen.dart';
|
||||
import 'package:tangheem/ui/screens/user_profile_screen.dart';
|
||||
|
||||
class AppMenuDialog extends StatelessWidget {
|
||||
final VoidCallback onTap;
|
||||
final Function(int) goToIndex;
|
||||
final VoidCallback onFontIncrease;
|
||||
final VoidCallback onFontDecrease;
|
||||
|
||||
AppMenuDialog({Key key, this.onTap, this.goToIndex, this.onFontIncrease, this.onFontDecrease}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
|
||||
child: Dialog(
|
||||
insetPadding: EdgeInsets.symmetric(horizontal: 60.0, vertical: 24.0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.transparent,
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 245 / 375,
|
||||
padding: EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(.91),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
58.height,
|
||||
menuItem("الرئيسية", "assets/icons/new/home.svg", 0),
|
||||
Container(width: 50, height: 1, color: ColorConsts.greyB5Color).paddingOnly(top: 16, bottom: 16),
|
||||
menuItem("عن الموسوعة", "assets/icons/new/intro.svg", 1),
|
||||
Container(width: 50, height: 1, color: ColorConsts.greyB5Color).paddingOnly(top: 16, bottom: 16),
|
||||
menuItem("اللجنة الإشرافية", "assets/icons/new/members.svg", 4),
|
||||
Container(width: 50, height: 1, color: ColorConsts.greyB5Color).paddingOnly(top: 16, bottom: 16),
|
||||
menuItem("قراءة القرآن الكريم", "assets/icons/new/quran.svg", 2),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
menuOptions("assets/icons/new/bookmark.svg").onPress(() {
|
||||
Navigator.pop(context);
|
||||
Navigator.pushNamed(context, BookmarkScreen.routeName);
|
||||
}),
|
||||
14.width,
|
||||
menuOptions("assets/icons/new/zoom_in.svg").onPress(onFontIncrease),
|
||||
14.width,
|
||||
menuOptions("assets/icons/new/zoom_out.svg").onPress(onFontDecrease),
|
||||
14.width,
|
||||
menuOptions("assets/icons/new/user_acount.svg").onPress(() {
|
||||
Navigator.pop(context);
|
||||
if (AppState().isUserLogin) {
|
||||
Navigator.pushNamed(context, UserProfileScreen.routeName);
|
||||
} else
|
||||
Navigator.pushNamed(context, LoginScreen.routeName);
|
||||
}),
|
||||
],
|
||||
).paddingOnly(top: 32, bottom: 32),
|
||||
Container(
|
||||
height: 26,
|
||||
padding: EdgeInsets.only(right: 16, left: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(32.0),
|
||||
color: ColorConsts.brownLightColor,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Icon(Icons.play_arrow_outlined, size: 20, color: Colors.white),
|
||||
"تصفح وتحميل الموسوعة".toText(13),
|
||||
],
|
||||
),
|
||||
).onPress(() {
|
||||
goToIndex(5);
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget menuOptions(String icon) {
|
||||
return SvgPicture.asset(
|
||||
icon,
|
||||
width: 25,
|
||||
height: 25,
|
||||
color: ColorConsts.greyBAColor,
|
||||
);
|
||||
}
|
||||
|
||||
Widget menuItem(String title, String icon, int index) {
|
||||
return Column(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
icon,
|
||||
width: 25,
|
||||
height: 25,
|
||||
color: ColorConsts.darkText,
|
||||
),
|
||||
6.height,
|
||||
title.toText(13, color: ColorConsts.darkText)
|
||||
],
|
||||
).onPress(() => goToIndex(index));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,143 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:tangheem/api/user_api_client.dart';
|
||||
import 'package:tangheem/app_state/app_state.dart';
|
||||
import 'package:tangheem/classes/colors.dart';
|
||||
import 'package:tangheem/classes/consts.dart';
|
||||
import 'package:tangheem/classes/utils.dart';
|
||||
import 'package:tangheem/extensions/int_extensions.dart';
|
||||
import 'package:tangheem/extensions/string_extensions.dart';
|
||||
import 'package:tangheem/extensions/widget_extensions.dart';
|
||||
import 'package:tangheem/ui/dialogs/general_dialog.dart';
|
||||
import 'package:tangheem/widgets/login_textfield_widget.dart';
|
||||
|
||||
class ChangePasswordScreen extends StatefulWidget {
|
||||
static const String routeName = "/changePassword";
|
||||
|
||||
ChangePasswordScreen({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ChangePasswordScreenState createState() {
|
||||
return _ChangePasswordScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _ChangePasswordScreenState extends State<ChangePasswordScreen> {
|
||||
final TextEditingController _currentPasswordController = TextEditingController();
|
||||
final TextEditingController _passwordController = TextEditingController();
|
||||
final TextEditingController _confirmPasswordController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void updatePassword(String email, String oldPassword, String password) async {
|
||||
Utils.showLoading(context);
|
||||
try {
|
||||
await UserApiClient().updatePassword(email, oldPassword, password);
|
||||
} catch (ex) {
|
||||
if (mounted) Utils.handleException(ex, null);
|
||||
Utils.hideLoading(context);
|
||||
return;
|
||||
} finally {
|
||||
Utils.hideLoading(context);
|
||||
}
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await prefs.remove(GlobalConsts.userAuthData);
|
||||
AppState().setAuthenticationModel(null);
|
||||
await showDialog(
|
||||
context: context,
|
||||
barrierColor: Colors.white.withOpacity(0.2),
|
||||
builder: (BuildContext context) => GeneralDialog(
|
||||
message: "تم تغيير كلمة المرور بنجاح , الرجاء إعادة تسجيل الدخول من خلال الرابط المرسل إلى بريدك الإلكتروني",
|
||||
backgroundColor: Color(0xff598A8D),
|
||||
),
|
||||
);
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
alignment: Alignment.topCenter,
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/icons/new/home_dark.jpg",
|
||||
fit: BoxFit.cover,
|
||||
height: double.infinity,
|
||||
opacity: const AlwaysStoppedAnimation(1),
|
||||
),
|
||||
Container(color: ColorConsts.darkText.withOpacity(0.8)),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
100.height,
|
||||
Image.asset('assets/icons/new/Tangeem-logo-W.png', width: 50),
|
||||
100.height,
|
||||
Container(
|
||||
width: 54,
|
||||
height: 54,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: ColorConsts.dark2Text,
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
"assets/icons/new/user_acount.svg",
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
14.height,
|
||||
(AppState().userName ?? "").toText(18),
|
||||
50.height,
|
||||
"تغيير كلمة المرور".toText(20),
|
||||
24.height,
|
||||
LoginTextFieldWidget(hint: "كلمة المرور الحالية", controller: _currentPasswordController, iconData: Icons.lock_rounded, isPassword: true, isForChangePassword: true),
|
||||
10.height,
|
||||
LoginTextFieldWidget(hint: "كلمة المرور الجديدة", controller: _passwordController, iconData: Icons.lock_rounded, isForChangePassword: true),
|
||||
10.height,
|
||||
LoginTextFieldWidget(hint: "تأكيد كلمة المرور الجديدة", controller: _confirmPasswordController, iconData: Icons.lock_rounded, isPassword: true, isForChangePassword: true),
|
||||
16.height,
|
||||
Container(
|
||||
height: 45,
|
||||
// width: 165,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(32),
|
||||
border: Border.all(color: ColorConsts.brownLightColor, width: 2),
|
||||
),
|
||||
child: "إعادة تعيين كلمة لمرور".toText(13),
|
||||
).onPress(() {
|
||||
if (_currentPasswordController.text.length < 1) {
|
||||
Utils.showToast("يرجى إاخال كلمة المرور");
|
||||
return;
|
||||
}
|
||||
if (_passwordController.text.length < 1) {
|
||||
Utils.showToast("يرجى إاخال كلمة المرور");
|
||||
return;
|
||||
}
|
||||
if (_confirmPasswordController.text.length < 1) {
|
||||
Utils.showToast("يرجى تأكيد كلمة المرور");
|
||||
return;
|
||||
}
|
||||
if (_passwordController.text != _confirmPasswordController.text) {
|
||||
Utils.showToast("خطأ في تطابق كلمات المرور");
|
||||
return;
|
||||
}
|
||||
updatePassword(AppState().userEmail, _currentPasswordController.text, _passwordController.text);
|
||||
})
|
||||
],
|
||||
).paddingOnly(left: 65, right: 65),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,138 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:tangheem/api/user_api_client.dart';
|
||||
import 'package:tangheem/app_state/app_state.dart';
|
||||
import 'package:tangheem/classes/colors.dart';
|
||||
import 'package:tangheem/classes/consts.dart';
|
||||
import 'package:tangheem/classes/utils.dart';
|
||||
import 'package:tangheem/extensions/int_extensions.dart';
|
||||
import 'package:tangheem/extensions/string_extensions.dart';
|
||||
import 'package:tangheem/extensions/widget_extensions.dart';
|
||||
import 'package:tangheem/ui/dialogs/change_password_dialog.dart';
|
||||
import 'package:tangheem/ui/dialogs/general_dialog.dart';
|
||||
import 'package:tangheem/ui/screens/change_password_screen.dart';
|
||||
|
||||
class UserProfileScreen extends StatefulWidget {
|
||||
static const String routeName = "/profile";
|
||||
|
||||
UserProfileScreen({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_UserProfileScreenState createState() {
|
||||
return _UserProfileScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _UserProfileScreenState extends State<UserProfileScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void deleteUserAccount() async {
|
||||
Utils.showLoading(context);
|
||||
try {
|
||||
await UserApiClient().deleteAccount(AppState().userId);
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await prefs.remove(GlobalConsts.userAuthData);
|
||||
AppState().setAuthenticationModel(null);
|
||||
Utils.showToast("تم حذف الحساب");
|
||||
Navigator.pop(context);
|
||||
Utils.hideLoading(context);
|
||||
} catch (ex) {
|
||||
if (mounted) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(ex, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
alignment: Alignment.topCenter,
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/icons/new/home_dark.jpg",
|
||||
fit: BoxFit.cover,
|
||||
height: double.infinity,
|
||||
opacity: const AlwaysStoppedAnimation(1),
|
||||
),
|
||||
Container(color: ColorConsts.darkText.withOpacity(0.8)),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
100.height,
|
||||
Image.asset('assets/icons/new/Tangeem-logo-W.png', width: 50),
|
||||
100.height,
|
||||
Container(
|
||||
width: 78,
|
||||
height: 78,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: ColorConsts.dark2Text,
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
"assets/icons/new/user_acount.svg",
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
14.height,
|
||||
(AppState().userName ?? "").toText(25),
|
||||
50.height,
|
||||
button("تغيير كلمة المرور").onPress(() {
|
||||
Navigator.pushNamed(context, ChangePasswordScreen.routeName);
|
||||
}),
|
||||
Container(width: 50, height: 1, color: ColorConsts.dark99Text).paddingOnly(top: 15, bottom: 15),
|
||||
button("تسجيل الخروج").onPress(() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await prefs.remove(GlobalConsts.userAuthData);
|
||||
AppState().setAuthenticationModel(null);
|
||||
Utils.showToast("تسجيل خروج المستخدم");
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
Container(width: 50, height: 1, color: ColorConsts.dark99Text).paddingOnly(top: 15, bottom: 15),
|
||||
button("حذف الحساب").onPress(() {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierColor: Colors.white.withOpacity(0.2),
|
||||
builder: (BuildContext context) => GeneralDialog(
|
||||
message: "هل تود حذف حسابك عبر تطبيق تنغيم؟",
|
||||
backgroundColor: Color(0xff598A8D),
|
||||
buttonTitle: "تأكيد الحذف",
|
||||
buttonBorderColor: ColorConsts.brownLightColor,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
deleteUserAccount();
|
||||
},
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget button(String title) {
|
||||
return Container(
|
||||
height: 36,
|
||||
width: 165,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(32),
|
||||
border: Border.all(color: Colors.white, width: 1),
|
||||
),
|
||||
child: title.toText(13),
|
||||
);
|
||||
}
|
||||
}
|
||||