|
|
|
|
@ -2,14 +2,17 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
import 'package:tangheem/api/tangheem_user_api_client.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/models/navigation_model.dart';
|
|
|
|
|
import 'package:tangheem/models/quick_links_model.dart';
|
|
|
|
|
import 'package:tangheem/ui/dialogs/change_password_dialog.dart';
|
|
|
|
|
import 'package:tangheem/ui/screens/bookmark_screen.dart';
|
|
|
|
|
import 'package:tangheem/ui/screens/content_info_screen.dart';
|
|
|
|
|
import 'package:tangheem/ui/screens/forgot_password_screen.dart';
|
|
|
|
|
import 'package:tangheem/ui/screens/login_screen.dart';
|
|
|
|
|
import 'package:tangheem/ui/screens/pdf_viewer_screen.dart';
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
@ -146,6 +149,21 @@ class _CommonAppbarState extends State<CommonAppbar> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void updatePassword(String email, String oldPassword, String password) async {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
try {
|
|
|
|
|
await UserApiClient().updatePassword(email, oldPassword, password);
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
Utils.handleException(ex, null);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
return;
|
|
|
|
|
} finally {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
}
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
Utils.showToast("تم تغيير كلمة المرور بنجاح");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget drawerView() {
|
|
|
|
|
var height = MediaQuery.of(context).padding.top;
|
|
|
|
|
return Drawer(
|
|
|
|
|
@ -267,6 +285,37 @@ class _CommonAppbarState extends State<CommonAppbar> {
|
|
|
|
|
}
|
|
|
|
|
Navigator.pushNamed(context, LoginScreen.routeName);
|
|
|
|
|
}),
|
|
|
|
|
if (AppState().isUserLogin)
|
|
|
|
|
Expanded(
|
|
|
|
|
child: PopupMenuButton(
|
|
|
|
|
padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
|
onSelected: (int index) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
Future.delayed(Duration(milliseconds: 200), () {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
barrierColor: ColorConsts.secondaryWhite.withOpacity(0.8),
|
|
|
|
|
builder: (BuildContext context) => ChangePasswordDialog(
|
|
|
|
|
onPassword: (oldPassword, password) => updatePassword(AppState().userEmail, oldPassword, password),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
icon: Icon(Icons.settings, color: ColorConsts.textGrey1),
|
|
|
|
|
itemBuilder: (_) => <PopupMenuItem<int>>[
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
value: 1,
|
|
|
|
|
padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
|
height: 16,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
'تغيير كلمة المرور',
|
|
|
|
|
style: TextStyle(color: ColorConsts.primaryBlack, fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -277,8 +326,9 @@ class _CommonAppbarState extends State<CommonAppbar> {
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
for (QuickLinksData _quickLink in quickLinks)
|
|
|
|
|
// commonIconButton(ApiConsts.baseUrl + _quickLink.exposeFilePath, () { for live produciton server
|
|
|
|
|
commonIconButton( _quickLink.exposeFilePath, () {
|
|
|
|
|
commonIconButton(ApiConsts.baseUrl + _quickLink.exposeFilePath, () {
|
|
|
|
|
//for live production server
|
|
|
|
|
// commonIconButton( _quickLink.exposeFilePath, () {
|
|
|
|
|
_launchURL(_quickLink.imageUrl);
|
|
|
|
|
}, size: 35, isAsset: false),
|
|
|
|
|
],
|
|
|
|
|
|