@ -10,9 +10,11 @@ import 'package:tangheem/classes/colors.dart';
import ' package:tangheem/classes/consts.dart ' ;
import ' package:tangheem/classes/utils.dart ' ;
import ' package:tangheem/models/authentication_user_model.dart ' ;
import ' package:tangheem/models/content_info_model.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/dialogs/general_dialog.dart ' ;
import ' package:tangheem/ui/screens/bookmark_screen.dart ' ;
import ' package:tangheem/ui/screens/content_info_screen.dart ' ;
import ' package:tangheem/ui/screens/home_screen.dart ' ;
@ -37,6 +39,7 @@ class _CommonAppbarState extends State<CommonAppbar> {
final GlobalKey < ScaffoldState > _scaffoldKey = new GlobalKey < ScaffoldState > ( ) ;
List < QuickLinksData > quickLinks = [ ] ;
List < NavigationDataModel > navigationList = [ ] ;
ContentInfoDataModel _userCopyRight ;
@ override
void initState ( ) {
@ -44,24 +47,21 @@ class _CommonAppbarState extends State<CommonAppbar> {
getPrefs ( ) ;
getNavigation ( ) ;
getQuickLinks ( ) ;
/ / getCopyRight ( ) ;
getCopyRight ( ) ;
}
/ / void getCopyRight ( ) async {
/ / if ( AppState ( ) . getContentInfoModel = = null ) {
/ / try {
/ / var model = await TangheemUserApiClient ( ) . getContentInfo ( 3 ) ;
/ / var contentList = model ? . data ? ? [ ] ;
/ / if ( contentList . length > 0 ) {
/ / _copyRight = contentList . first ;
/ / AppState ( ) . setContentInfoModel ( _copyRight ) ;
/ / }
/ / } catch ( ex ) { }
/ / } else {
/ / _copyRight = AppState ( ) . getContentInfoModel ;
/ / }
/ / setState ( ( ) { } ) ;
/ / }
void getCopyRight ( ) async {
if ( AppState ( ) . getCopyRightContentInfoModel = = null ) {
try {
ContentInfoModel _userCopyRight = await TangheemUserApiClient ( ) . getContentInfo ( 3 ) ;
this . _userCopyRight = _userCopyRight . data . first ;
AppState ( ) . setCopyRightContentInfoModel ( this . _userCopyRight ) ;
} catch ( ex ) { }
} else {
_userCopyRight = AppState ( ) . getCopyRightContentInfoModel ;
}
setState ( ( ) { } ) ;
}
void getNavigation ( ) async {
if ( AppState ( ) . getNavigationModel ? . data = = null ) {
@ -176,8 +176,15 @@ class _CommonAppbarState extends State<CommonAppbar> {
} finally {
Utils . hideLoading ( context ) ;
}
SharedPreferences prefs = await SharedPreferences . getInstance ( ) ;
await prefs . remove ( GlobalConsts . userAuthData ) ;
AppState ( ) . setAuthenticationModel ( null ) ;
await showDialog (
context: context ,
barrierColor: ColorConsts . secondaryWhite . withOpacity ( 0.8 ) ,
builder: ( BuildContext context ) = > GeneralDialog ( message: " تم تغيير كلمة المرور بنجاح , الرجاء إعادة تسجيل الدخول من خلال الرابط المرسل إلى بريدك الإلكتروني " ) ,
) ;
Navigator . pop ( context ) ;
Utils . showToast ( " تم تغيير كلمة المرور بنجاح " ) ;
}
Widget drawerView ( ) {
@ -371,18 +378,40 @@ class _CommonAppbarState extends State<CommonAppbar> {
) ,
Padding (
padding: EdgeInsets . only ( left: 32 , right: 32 , bottom: 8 ) ,
child: Row (
crossAxisAlignment: CrossAxisAlignment . center ,
mainAxisAlignment: MainAxisAlignment . center ,
child: Column (
mainAxisSize: MainAxisSize . min ,
children: [
Text (
" Powered by Cloud Solutions " ,
maxLines: 1 ,
textAlign: TextAlign . right ,
style: TextStyle ( fontSize: 14 , color: Colors . black87 ) ,
if ( _userCopyRight ! = null ) . . . [
Row (
crossAxisAlignment: CrossAxisAlignment . center ,
mainAxisAlignment: MainAxisAlignment . center ,
children: [
Text (
_userCopyRight . content ,
maxLines: 1 ,
textAlign: TextAlign . right ,
style: TextStyle ( fontSize: 14 , color: Colors . black87 ) ,
) ,
SizedBox ( width: 8 ) ,
Image . network ( ApiConsts . baseUrl + _userCopyRight . exposeFilePath , height: 25 , width: 30 )
] ,
) ,
SizedBox ( height: 8 ) ,
] ,
Row (
crossAxisAlignment: CrossAxisAlignment . center ,
mainAxisAlignment: MainAxisAlignment . center ,
children: [
Text (
" Powered by Cloud Solutions " ,
maxLines: 1 ,
textAlign: TextAlign . right ,
style: TextStyle ( fontSize: 14 , color: Colors . black87 ) ,
) ,
SizedBox ( width: 8 ) ,
SvgPicture . asset ( " assets/logos/cloud_logo.svg " , width: 30 , height: 30 )
] ,
) ,
SizedBox ( width: 8 ) ,
SvgPicture . asset ( " assets/logos/cloud_logo.svg " , width: 30 , height: 30 )
] ,
) ,
)